Step 2: Adding the Business Object Project

In this step you will add an existing Order System Business Object project to your new Web Forms solution.

  1. Go to the Solution Explorer and right-click the solution node (the first node), and select Add | Existing Project... from the shortcut menu.

    In the Add Existing Project dialog, navigate to one of these folders depending on the type of business object project you have created:

    • C:\MM .NET Jump Start\Order System Business Objects EF CSharp
    • C:\MM .NET Jump Start\Order System Business Objects EF Code First

    Select the .csproj file.

  2. Next, click the Open button. Your Solution Explorer should now look something like this:

  3. Only if you have added a Code First business object project, go to the project's ABusinessObject class and change the code in the CreateDbContext() method to the following:

    /// <summary>
    /// Create the DbContext object
    /// </summary>
    /// <returns></returns>
    protected override DbContext CreateDbContext()
    {
    	var context = new EntityDataModelContainer();
    	context.Configuration.ProxyCreationEnabled = true;
    	return context;
    }

    This code turns off the creation of proxy entity objects. Dynamic proxies are used for lazy loading and change tracking. In an ASP.NET application, this gets in the way of serialization and MM .NET is performing its own change tracking.

  4. When you eventually build this solution (not yet), the business object project will produce a dll and the Web Forms project will produce another dll. In this step you will add a reference to the business object dll in the Web Forms project. To do this, right-click the Order System Web CSharp project's References node and select Add Reference... from the shortcut menu.

    In the Add References dialog, select Projects | Solution , select the business object project then click OK to add the assembly to the project.

  5. Right-click the solution (the first node in the Solution Explorer) and select Project Dependencies... from the shortcut menu, you can select Order System Web CSharp in the Projects combo box and see that it Depends on the Order System Business Objects EF CSharp project. This means when you rebuild the entire solution, the business object project is built first, then the Web Forms project is built afterwards:

    Click OK to close this dialog.

  6. Now we need to add the Entity Framework NuGet package to the WPF project. To do this, right-click the Order System Web CSharp project in the Solution Explorer, and select Manage NuGet Packages... from the shortcut menu.

  7. In the NuGet Package Manager, select the Browse panel, then select EntityFramework and click the Install button, and then accept all acknowledgement dialogs:

  8. Next, rebuild the new solution to make sure everything's set up properly. To do this, select Build | Build Solution from the main menu. If everything's fine, you should see the following message in the Visual Studio Output Window:

  9. At times you may want to rebuild AND run a solution. You can do this by selecting Debug | Start from the main menu, or by pressing F5, or by clicking the Start button on the Visual Studio toolbar:

    See also:
    Step 3: Setting up Data Access


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/25/18
Comment or report problem with topic