I have to create a solution in Asp.net core and I have to use a stored procedure based approach. So is it feasible to use Entity Framework core for the application? Because data return from the stored procedure, not an object declared in Entity Core
It is important to understand what is needed. Entity Framework & using normal SQl command, both has it's pros & cons.
Basic points are :
Entity Framework
Can act as ORM for different databases, if you application uses two or more databases like SQL server & oracle. Almost same code can be used. Also it is easier to switch from one db to another.
EF has both code first & db first, also maintains connections & query generation so less concern for SQL injection & faster changes
Using EF however if your team has many developers who are committing EF changes frequently it is hard to merge internal layers code conflicts for EF.
If you have strong middleware & caching, EF can be optimised for application caching.
SQL Command object
More control over SQL since query generated in EF are at runtime so hard to analyse & optimize indices, & execution plan.
Need to take care for sql injections, parameter sniffing issues.
No issues for code merges till DB design is done with consultation in large Dev Teams.
SQL Command objects are easier to debug & analyse in maintenance with less effort in change since you need not to update whole EF files & related code.
Teams with dedicated DBA & large server for DB choose SQL command, Teams with small agile team with full stack dev with strong middleware usually go for EF.
Both of them are good for some use cases & none of them is silver bullet for all. so pick what suits you best.
EF Core provides the following methods to execute a stored procedure:
DbSet<TEntity>.FromSql()
DbContext.Database.ExecuteSqlCommand()
var data = context.DbSet<TEntity>.FromSql("SPName").ToList();
var rowsAffected = context.Database.ExecuteSqlCommand("sql command");
For more details : entityframeworktutorial
and for use fields that not exist in model you can declare these in model and use NotMapped
attribute. NotMapped Attribute
And for mapping stored procedures, fluently look at this link