Difference between revisions of "Databases Using Entity Framework"
(→SQL Server Interaction Using Entity Framework) |
(→SQL Server Interaction Using Entity Framework) |
||
Line 17: | Line 17: | ||
11) Give the name MyDbModel<br> | 11) Give the name MyDbModel<br> | ||
− | + | [code] | |
Using db As New LW5Entities | Using db As New LW5Entities | ||
End Using | End Using | ||
+ | [/code] |
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
[code] Using db As New LW5Entities
End Using [/code]