I have a single SQL Stored procedure which runs multiple insert statements. with the Clean architecture, how do i call and execute the stored procedure? I am not sure i need to create multiple entities first to use IRepository
EF Core - Stored procedure Insert - Clean architecture
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jaimin ShethiyaRank #177 · 13.7K reputationPosted Jul 12, 2024, 12:26 AM EDT
Hello Manikandan,
Please refer to the below code.
int id = 1; var idParam = new SqlParameter("@Id", id); List lst = dataContext.Products .FromSql("Your SP Name @Id", idParam) .ToList();public static int AddSql(AppDbContext context, int id) { return context.Database.ExecuteSql($"Your SP Name @Id={id}"); }Thanks