Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

How to create a database connection in WPF and add it to Entity Framework

02.08.2018 (👁304)

 

How to create a database connection in WPF?

 

If you've added an existing database as a draft to the WPF project, the easiest way to create a data connection is to double-click the database under Visual Studio

 

 

This opens the Server Explorer and integrates the SQL Server database as Datat Connections

 

This process is important if you then want to build an Entity Framework connection.

When going under WPF Project-> Add-> New Item

 

Then in the dialog Add New Item-> Data-> ADO.Net Entity Data Model

Name: dbModel

 

Integrate a new EF database structure

 

And Entity Data Model Wizard-> Choose Model Contents-> EF Designer from Database

 

AND NOW:

Is the generated data connection proposed to the local database

Under Save connection settings in App.Config

Is it possible to specify the database context like: dbTables_and_Views.

 

Then finally select the tables

Tip: Save model namespace as dbModel

 

Done: integrated into the WPF project