I have been using the below approach to call stored procedure in EF core 2.1
In DBContext
public DbQuery<SomeModel> SomeModels { get; set; }
Class
var result = context.SomeModels.FromSql("SQL_SCRIPT").ToList();
I'm trying to create a generic method to execute all stored procedures so that I don't need to physically attach a model with context each time when I call a stored procedure. I'm looking for something like what I have below (Ignore the syntax). Please advice.
public Response SoftDelete<T>(T entity) where T : class
{
var result = context.<T>.FromSql("SQL_SCRIPT").ToList();
}