Creating Business Classes with the Business Layer Generator
In this topic, you learn how to generate the classes associated with a business entity such as the business object controller, business rules, and default value classes. This allows you to create or update business classes as well as move existing MM .NET classic entity-based business objects to Entity Framework.
- Launch the Business Layer Generator, by selecting Tools | MM .NET Business Layer Generator from the Visual Studio menu.
- In the first page of the BLG, select the business object project that contains the business objects and entities you want to move to the Entity Framework, then click Next:

- In the Specify the Code Generation Settings page, make sure that all four of the main checkboxes (Business Object, Entity Object, Business Rules Object, Default Values Object) are selected.
In addition, make sure the Entity Framework and EDMX Generation check boxes are also selected, then click Next.

Note: You should have an Entity Data Model file in your project before running the Business Layer Generator with the Entity Framework checkbox selected. The BLG uses information from the Entity Data Model (such as the name of the Object Context class) when generating business classes.
- In the Select Database Items page, notice there is an Entity Data Model combo box that lists all of the Entity Data Models in your project (you may only have one). Select the Entity Data Model on which you added entities in a previous step:

- Select the corresponding database from the Databases (and if applicable, Database Sets) combo boxes.
- Click the Get Data button to retrieve a list of all tables, views, and stored procedures in the specified database.
- Select the Tables, Views, or Stored Procedures from which the Entity classes will be derived by selecting the check box next to it in the list. When you do this, the BLG retrieves additional information about your selection from the database. For example:

- Under Business Object Settings, change the name of the Business Object Class Name to correspond to the business object (and its associated classes) that you are updating. For example, you might change Shippers to Shipper (if the Intelligent Renaming check box is selected, all other associated business classes are renamed accordingly).
- You can click on individual columns beneath the selected table, view, or stored procedure and specify information that correlates to the Entity class, such as Property Name, Display Name (used in business rule messages to the user), default values, and required field information.
- Click Next. This displays the Data Access Layer Options page:

When generating data access for business objects that are using the Entity Framework, the only options available are Use Dynamic SQL Statements or Create New Stored Procedures.
Note: Regardless of which option you choose, there is no custom data access class generated. This is because you don't need a custom data access class when using the Entity Framework--whether or not you are using dynamic SQL or stored procedures to insert, update, and delete entities.Using Dynamic SQL Statements
If you choose the Use Dynamic SQL Statements option, at run time, the Entity Framework automatically generates dynamic SQL for the inserting, updating, and deleting entities. However, you can still use stored procedures to retrieve entities if you would like.Creating New Stored Procedures
If you choose the Create New Stored Procedures option, the Business Layer Generator will create new Select, Insert, Update, Delete, and SelectByPK stored procedures.You can choose whether or not to let the BLG run the SQL script to automatically create the stored procedures for you by means of the Run database script check box.
It's typically a good idea to select the Refresh the DataSet option when generating stored procedures. When generating stored procedures for the Entity Framework, this adds a statement at the end of the Insert stored procedure that retrieves the new primary key value back into the entity.
After you are finished running the Business Layer Generator, you can add the generated stored procedures to your Entity Data Model as described in the topic Adding Stored Procedures for Insert, Update, Delete.
- Click Next. In the Ready to Generate page, click Finish to update your business object and associated classes to the Entity Framework, and optionally generate new stored procedures. When code generation is complete, the Code Generation Complete dialog is displayed.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 06/27/18
Comment or report problem with topic
