Simple use of the EF framework in VS2015, vs2015ef Framework Method
The following describes how to use the EF framework in VS2015:
Create a Model1.edmx File
Reference the following figure to create the model file of the AD database,
Find the following menu
Find the name of the database class to be referenced.
Reference in the background of the page
Using System; using System. collections. generic; using System. linq; using System. web; using System. web. UI; using System. web. UI. webControls; namespace WebApplication4 {public partial class WebForm1: System. web. UI. page {protected readonly tb_FaceGroup _ context; private readonly ADEntities datesql = new ADEntities (); protected void Page_Load (object sender, EventArgs e) {ADEntities db = new ADEntities (); // The class to be instantiated // Add action // tb_user dd = new tb_user (); // dd. ID = "ddsds"; // dd. wid = "dsdssd"; // db. tb_user.Add (dd); // db. saveChanges (); -- change the above Code to the database // query // List <tb_user> lstOrder = new List <tb_user> (); tb_user lstOrder = new tb_user (); // lstOrder = datesql. tb_user.GroupBy (r => r. ID = "ddsds"); var info = datesql. tb_user.OrderByDescending (r => r. ID = "ddsds ");//. firstOrDefault (r => r. ID = "ddsds"); // print the query result if (info. any () {foreach (var userEntity in info) {Console. writeLine (userEntity. ID + "----" + userEntity. wid );}}}}}
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.