Generated Data Layer Class Files

 

If you open the Visual Studio.NET solution file (.sln) which was generated after clicking the Generate Data Layer button you will notice a similar layout to the one shown below for the OleroTraining database.

 

 

 

 

 

Generated Data Layer Project

 

By default two projects are created during the file generation process. The first project is a simple console based application named TestApp which is useful for testing and ensuring that the data object model project will compile and work correctly. 

 

The second project is by default named [DatabaseName]Biz (i.e. OleroTrainingBiz) and contains the generated class files and templates which implement the ORM.NET Data Layer. You compile this project into a .NET assembly for use within your application. You will notice that a separate class file is generated for each table object where the Generate Code For setting was enabled.

 

In addition, a sub-directory called \do_not_edit is created with related files as shown below. As the name implies the files contained in this directory should not be edited because they are re-created each time the Data Layer is re-generated (i.e. whenever you click the Generate Data Layer button within the Object Browser).

 

Any changes made to the class files within the do_not_edit directory will be overwritten each time the data layer is regenerated and ,therefore, should not be edited. Instead edit the derived table class files i.e. Contact.cs

 

 

 

 

Instead developers can customize and override the default behavior of the generated data layer using the table object class files created directly under the main project directory. In the example screen shot from the OleroTraining database these files would include Contact.cs, Course.cs, Enrollment.cs, Room.cs, Schedule.cs, Student.cs, Teacher.cs class files. These class files inherit from the generated Templates.cs class files in the do_not_edit sub-directory.

 

Changes made to the main class files will  NOT be overridden by subsequent re-generation of the data layer and allow developers to extend the Data Layer object model that ORM.NET creates to meet their requirements.

 

Refer to the Sub-classing generated Data Layer class files in the Code Examples section for more information on how to customized the table object files to provide additional functionality.