How To Map The Results Of Sql Query Onto Objects In Net Core2?
How can I map the results of a SQL command into a class object in Net Core, with SqlCommand() or FromSql()? Can someone update this answer for Net Core, or is the syntax still the
Solution 1:
With EntityFramework Core, you simply use yourDbContextInstance.Set<T>().FromSql("your sql statement");
Where T is your class.
However, your sql MUST return all the properties on your class.
See documentation for more details on this.
Post a Comment for "How To Map The Results Of Sql Query Onto Objects In Net Core2?"