Saturday 15 May 2010

Pulling a table from a SQL Server database into a List in C# using Entity Framework -


I'm a programmer who is just starting working in a Windows environment and I'm new to web development and Near the last database is bad experience. Currently in my internship, I was asked to draw information from a large SQL Server database and submit a list and display a website to display a website. Being new to most of these concepts, I'm studying on MVC, Linux, and EF because that's what they use primarily.

I am trying to try to drag the table into a list, but so far there is not much help in the internet. Most of the solutions are for the database you have created in the project or they use the CodeFirst method. I am working in Visual Studio (2012), which is working extensively and the database is already included in the project .

From what I had collected, I must make a square for the table and create an object for each column and then that class should be listed in the list; & Lt; & Gt; There is a part of the database to inquire and store all the elements, which relieves me, I was reading for a few days, but there is a problem in understanding how to do it. Should I Use the Interface? (In addition, I have searched the source code and they do not really use DBCnet or anything ... half the reason I am confused.)

Sorry to show me that The actual code for, but I would appreciate any insights! I can clarify what I want to thank you!

  list & lt; YourTable & gt; List; (YourDataBaseEntities Reference = New Using YourDataBaseEntities ()) {list = context.YourTables.toList (); }   

You will find every object from the table specified in your database YourTable will be an object associated with that table and your databases entity will be an object for your database, as you have by the unit framework model Has been prepared.

No comments:

Post a Comment