C# Entity Framework Sqlquery Example


Example 1: entity framework with query c#

using (var ctx = new SchoolDBEntities()) {     var studentName = ctx.Students.SqlQuery("Select studentid, studentname, standardId from Student where studentname='Bill'").FirstOrDefault<Student>(); }  //Reference Link //https://www.entityframeworktutorial.net/Querying-with-EDM.aspx

Example 2: entity framework with query C#

using (var ctx = new SchoolDBEntities()) {     var studentName = ctx.Students.SqlQuery("Select studentid, studentname, standardId from Student where studentname='Bill'").FirstOrDefault<Student>(); }     //https://www.entityframeworktutorial.net/Querying-with-EDM.aspx //https://www.entityframeworktutorial.net/EntityFramework4.3/raw-sql-query-in-entity-framework.aspx

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable