I created different store procedures and execute them through dbcontext and get results in respected viewmodels. I want to generalize this. I am doing like
switch (report.StoreProcedure)
{
case "SP_BranchSaleReport":
result = context.Database.SqlQuery<BranchReportVM>("dbo.SP_BranchSaleReport").ToList();
return PartialView("~/Views/Auto/Reports/InnerPartials/SP_BranchSaleReport.cshtml", result);
}
I want to make TElement in context.Database.SqlQuery<DYNAMICTYPE> dynamic so that I avoid using switch. I was unable to do it through reflection. How can I generalize it and avoid writing number of lines.
Aucun commentaire:
Enregistrer un commentaire