Creating Business Process Objects
Follow these steps to create a custom business process:
- Right-click your business object project and select Add | New Item... from the shortcut menu
- In the left pane of the Add New Item dialog select the Visual C# Items (or VB) node. In the center pane, select the MM .NET Business Process template:

- In the Name text box, change the name of the source code file to the name you want to give your business process (for example, OrderBusinessProcess.cs or OrderBusinessProcess.vb).
- Click Add to create the source code file and open it in a code-editing window.
Note: By default, the base class of the new business process is mmBusinessProcess. The default business object base class is stored in the MM .NET business process item template. - At the top of your class definition create member variables that can hold references to the business objects used by the business process object.
For example, in C#:
public partial class OrderBusinessProcess : mmBusinessProcess { protected Order Order; protected OrderDetail OrderDetail; protected Product Product;
And in VB .NET:
Public Class OrderBusinessProcess Inherits mmBusinessProcess Protected Order As Order Protected OrderDetail As OrderDetail Protected Product As Product
- In the override of the DefineParticipatingObjects method, add code to the method that instantiates and registers the business objects with the business process object.
For example, in C#:
protected override void DefineParticipatingObjects() { this.Order = (Order)this.RegisterBizObj(new Order()); this.OrderDetail = (OrderDetail)this.RegisterBizObj(new OrderDetail()); this.Product = (Product)this.RegisterBizObj(new Product()); }
And in VB .NET:
Protected Overrides Sub DefineParticipatingObjects() Me.Order = CType(Me.RegisterBizObj(New Order()), Order) Me.OrderDetail = CType(Me.RegisterBizObj(New OrderDetail()), OrderDetail) Me.Product = CType(Me.RegisterBizObj(New Product()), Product) End Sub
- Notice in the previous step's code that a call is made to the business process object's RegisterBizObj() method. This method registers the business process object as a listener for the business object's events. If the business process object's AddBrokenRulesToProcess member variable is True (it is by default), any broken rules or warnings generated by business objects are automatically added to the business process object's broken rule object.
If you do not want the business object's rules and warnings to be automatically added to the business process object in this way, set the AddBrokenRulesToProcess member variable to False in the constructor of the business process object.
If you do not want a particular business object's broken rules automatically added to the business process object, you can simply instantiate the object without calling RegisterBizObj in the DefineParticipatingObjects method.
For example, in C#:
this.Product = new Product();
And in VB .NET:
Me.Product = New Product()
- Add a method to your business process class that uses the participating business objects to carry out the business process.
For example, in C#:
public mmSaveDataResult ProcessOrder(int orderID) { OrderEntity OrderEntity = this.Order.GetOrderByOrderID(orderID); mmBindingList<OrderDetailEntity> OrderDetailList = this.OrderDetail.GetOrderDetail(orderID); foreach (OrderDetailEntity OrderDetail in OrderDetailList) { this.Product.ReduceInventory(OrderDetail.ProductID, OrderDetail.Quantity); } // Return a result that indicates if there were any broken rules or warnings if (this.BusinessRuleObj.HasBrokenRules) { return mmSaveDataResult.RulesBroken; } if (this.BusinessRuleObj.HasWarnings) { return mmSaveDataResult.RuleWarnings; } return mmSaveDataResult.RulesPassed; }
And in VB .NET:
Public Function ProcessOrder(ByVal orderID As Integer) As mmSaveDataResult Dim Order As OrderEntity = Me.Order.GetOrderByOrderID(orderID) Dim OrderDetailList As mmBindingList(Of OrderDetailEntity) = Me.oOrderDetail.GetOrderDetail(orderID) For Each OrderDetail As OrderDetailEntity In OrderDetailList Me.Product.ReduceInventory(OrderDetail.ProductID, OrderDetail.Quantity) Next ' Return a result that indicates if there were any broken rules or warnings If Me.BusinessRuleObj.HasBrokenRules Then Return mmSaveDataResult.RulesBroken End If If Me.BusinessRuleObj.HasWarnings Then Return mmSaveDataResult.RuleWarnings End If Return mmSaveDataResult.RulesPassed End Function
Notice this code returns an mmSaveDataResult enumerated value that tells the client of the business process whether any rules or warnings were generated during the business process execution.
Creating Custom Business Process Rule Objects
By default, Business Process objects have a generic mmBusinessRule object associated with them. If you want to create a custom business rule object for a Business Process object do the following:- Right-click your business object project and select Add | New Item from the shortcut menu. In the Add New Item dialog, select your language of choice in the left pane, then select MM .NET Business Rule in the center pane. In the Name text box specify the name you want to give your business rule object (for example, OrderBusinessProcessRules). Click the Add button to add the new rule class to the project:

- To get the Business Process object to use the custom business rule class, you need to override the Business Process object's CreateBusinessRuleObject() factory method.
For example, in C#:
protected override mmBusinessRule CreateBusinessRuleObject() { return new OrderBusinessProcessRule(this); }
And in VB .NET:
Protected Overrides Function CreateBusinessRuleObject() As mmBusinessRule Return New OrderBusinessProcessRule(Me) End Function
- You can now manually define your business process rules as discussed in the topic Creating Custom Business Rules.
If you want to reference participating business objects from within the business process rule object, you can cast the rule object's HostObject property to the mmBusinessProcess type and then access its collection of participating objects.
For example, in C#:
public override bool CheckRulesHook<EntityType>(mmBindingList<EntityType> entityList) { mmBusinessProcess ProcessObject = (mmBusinessProcess)this.HostObject; mmReferenceCollection ReferenceCollection = ProcessObject.GetParticipatingObjects(); // Change this return value to indicate result of rule checking return this.ErrorProviderBrokenRuleCount == 0; }
And in VB .NET:
Public Overrides Function CheckRulesHook(Of EntityType)(ByVal entityList As mmBindingList(Of EntityType)) As Boolean Dim ProcessObject As mmBusinessProcess = CType(Me.HostObject, mmBusinessProcess) Dim ReferenceCollection As mmReferenceCollection = ProcessObject.GetParticipatingObjects() ' Change this return value to indicate result of rule checking Return Me.ErrorProviderBrokenRuleCount = 0 End Function
See Also:
Understanding Business Process Objects
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 02/12/26
Comment or report problem with topic
