-
Notifications
You must be signed in to change notification settings - Fork 0
Business Object Model Producer
This topic is about the Business Object Model producer, it describes how to configure the producer to generate the business objects layer above the persistence layer.
You can use this producer to generate .NET class for the entities declared in design model.
It also ships with one sub-producers out-of-the-box: The Object Model Cache Producer to add cache specific code to the methods of the generated .NET class.
For each entity, the BOM producer generates two business objects: one object for the entity and one object for the entity set.
You can notice that the producer generates two classes for, say, the Customer entity:
-
the Customer class with the properties, say Id, FirstName, LastName
-
the CustomerCollection class with the properties Count and the this[int index] indexer.
// Class Customer
public class Customer
{
// Fields
private string _firstName;
private int _id;
private string _lastName;
// Methods
public static bool Delete(Customer customer);
public static bool Insert(Customer customer);
public static Customer Load(int id);
public static bool Save(Customer customer);
// Properties
public string FirstName { get; set; }
public int Id { get; set; }
public string LastName { get; set; }
}
// Class CustomerCollection
public class CustomerCollection
{
// Fields
private List<Customer> _baseList;
private Dictionary<int, Customer> _baseTable;
// Methods
public static bool Delete(Customer customer);
public static bool Insert(Customer customer);
public static CustomerCollection LoadAll();
public static bool Save(Customer customer);
// Properties
public virtual int Count { get; }
public Customer this[int index] { get; set; }
}
You can also notice that the two classes generated by default have the same signature for the Insert, Save and Delete persistence method. Fortunately, for the Load method, the signature is different: The Customer class has a Load method to load one entity and the CustomerCollection class has a LoadAll method to load all the entities.
- Introduction
- Architect Guide
- Concepts
- Using Visual Studio
- Overview
- Creating a CodeModeler Project
- Visual Environment
- Project Hierarchy
- Design Surface
- Customizing Design Surfaces
- Ribbon Bar
- Property Grid
- Member Format Expressions
- Model Grid
- Method Editor
- View Editor
- Instance Editor and Grid
- Resources Editor
- Inferred Model Viewer
- Building
- Project Physical Layout
- Source Control Support
- Generating
- Aspect Oriented Design (AOD)
- Developer Guide
- The Business Object Model (BOM)
- CodeModeler Query Language (CMQL)
- Starting Guide - Tutorial
- Upgrade From CFE