Difference between revisions of "Databases Using Entity Framework"
(Created page with "== SQL Server Interaction Using Entity Framework == The Entity Framework is currently Microsoft's recommended method of interacting with databases in the .NET framework. Perf...") |
(→SQL Server Interaction Using Entity Framework) |
||
Line 5: | Line 5: | ||
This Walk-Through will give a very simple example of the database first method. It is assumed an SQL Server Database already exists. | This Walk-Through will give a very simple example of the database first method. It is assumed an SQL Server Database already exists. | ||
− | 1) Open AdvancedHMI with Visual Studio | + | 1) Open AdvancedHMI with Visual Studio<br> |
− | 2) In Solution Explorer, right click the AdvancedHMI project and select Add->New Item (Ctrl+Shift+A) | + | 2) In Solution Explorer, right click the AdvancedHMI project and select Add->New Item (Ctrl+Shift+A)<br> |
− | 3) In the left pane under Common Items, select Data | + | 3) In the left pane under Common Items, select Data<br> |
− | 4) In the center pane select ADO.NET Entity Data Model | + | 4) In the center pane select ADO.NET Entity Data Model<br> |
− | 5) Give the name of MyDbModel and click the Add button | + | 5) Give the name of MyDbModel and click the Add button<br> |
− | 6) A Wizard will pop up. Select EF Designer from Database and click the Next button | + | 6) A Wizard will pop up. Select EF Designer from Database and click the Next button<br> |
− | 7) Click the New Connection button | + | 7) Click the New Connection button<br> |
− | 8) You will now need to enter the information related to your specific server and database instance | + | 8) You will now need to enter the information related to your specific server and database instance<br> |
− | 9) Click OK when finished selecting the database | + | 9) Click OK when finished selecting the database<br> |
− | 10) | + | 10)<br> |
− | 11) Give the name MyDbModel | + | 11) Give the name MyDbModel<br> |
Revision as of 17:23, 5 September 2016
SQL Server Interaction Using Entity Framework
The Entity Framework is currently Microsoft's recommended method of interacting with databases in the .NET framework. Performing a web search on Entity Framework will return a lot of tutorials and examples.
This Walk-Through will give a very simple example of the database first method. It is assumed an SQL Server Database already exists.
1) Open AdvancedHMI with Visual Studio
2) In Solution Explorer, right click the AdvancedHMI project and select Add->New Item (Ctrl+Shift+A)
3) In the left pane under Common Items, select Data
4) In the center pane select ADO.NET Entity Data Model
5) Give the name of MyDbModel and click the Add button
6) A Wizard will pop up. Select EF Designer from Database and click the Next button
7) Click the New Connection button
8) You will now need to enter the information related to your specific server and database instance
9) Click OK when finished selecting the database
10)
11) Give the name MyDbModel
Using db As New LW5Entities
End Using