Sdílet prostřednictvím


Choose Your Data Connection Dialog Box (Entity Data Model Wizard)

The Choose Your Data Connection dialog box is the part of the Entity Data Model Wizard that enables you to specify the data source, connection options, and database to use to generate the .edmx file.

Which Data Connection Should Your Application Use to Connect to the Database?

Choose an existing connection from the drop-down list of connections, or click New Connection to open the Connection Properties dialog box and create a new connection to the database.

If you are logging onto the database server by using SQL Server Authentication, you must decide whether to include sensitive data (such as user name and password) in the connection string, or whether you will handle the sensitive data in your application code. Select the option that corresponds to your choice. For more information about security issues when you use connection strings, see Protecting Connection Information (ADO.NET).

Entity Connection String

The Entity Connection String box displays the connection information based on your server and database connection selections.

Save Entity Connection Settings in App.Config or Web.Config File

To save entity connection settings in the App.Config or Web.Config file (depending on the project type), select Save the entity connection settings. Type a name for the connection or use the provided default name.

Saving connection strings in the configuration file simplifies maintaining your application if the database connection changes. If the database connection changes, you can edit the connection string in the configuration file. This means that you do not have to edit the source code and recompile the application. If you do not save the connection string, you will have to supply the connection string to a ObjectContext object to execute queries.

NoteNote

Information is stored in the App.Config or Web.Config file as plain text. To reduce the risk of unauthorized access to sensitive information, you might want to encrypt your data.

See Also

Other Resources

Entity Data Model Wizard
ADO.NET Entity Data Model Tools