Step 3: Setting up Data Access for the WPF Project
This step configures your application to access the SQL Server Northwind database.
- In the Solution Explorer, double-click the Order System WPF CSharp project's app.config file to open it in the code-editing window. This configuration file contains settings that define (among other things) information about each database used by the application. You should see the following element that specifies the connection string for attaching to the Northwind database:
<databases> <add key="Northwind\Connection" value="Data Source=(local);Initial Catalog=Northwind;Integrated Security=True" /> <add key="Northwind\DataAccessClass" value="DataAccessSql" /> </databases>
Next, open up your Business Object project's app.config file. The Business Object project's app.config file is used when you test or deploy a stand-alone business object project. The WPF project's app.config is used when you test or deploy the Business Object project along with a WPF project.
Copy the entire <databases> element from the Business Object project's app.config file and completely overwrite the <databases> element in your WPF project's app.config file.
- You also need to copy the Entity Framework connection string found in the app.config <connectionStrings> element. Copy this element from your Business Object project's app.config file and paste it into your WPF Project's app.config file immediately before the closing </configuration> element. Your app.config file should look something like this:
<databases> <add key="Northwind\Connection" value="Data Source=(local);Initial Catalog=Northwind;Integrated Security=True" /> <add key="Northwind\DataAccessClass" value="DataAccessSql" /> <add key="EntityDataModelContainer\DataAccessClass" value="DataAccessSqlEF" /> </databases> <connectionStrings> <add name="EntityDataModelContainer" connectionString="data source=(local);initial catalog=Northwind;integrated security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> </connectionStrings>
- Close the app.config file and save changes
For more information on connection strings see the Help topic How Database Connections Work in MM .NET.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/19/18
Comment or report problem with topic
