The base class for Business Operations.

Namespace: Xafari.BC.BusinessOperations
Assembly: Xafari.BC.BusinessOperations (in Xafari.BC.BusinessOperations.dll)

Syntax

C#

public abstract class BusinessOperationBase : IBusinessOperation

 

Remarks

To create custom Business Operations you may to implement the interface IBusinessOperation. However, it is more expedient to inherit a custom Business Operation class from this base class. It implements the core functionality of Business Operations, such as generation and processing of events, properties accessors and methods declared by the IBusinessOperation.

When you create a custom Business Operation class which is inherited from the BusinessOperationBase class in most cases you should just describe its properties. rest of the work will perform BusinessOperationBase. The following example demonstrates how to implement a custom context business operation class.

With the Business Operation class may be used the following attributes:

With properties may be used the following attributes:

 

 
 [XafDisplayName("Total orders cost")]
 [Description("Calculation of orders total cost.")]
 [DefaultOperationService(typeof(CalcWithoutDiscountList))]
 [ImageName("Action_Calculator")]
 [ExecutionWay(ExecutionWays.Synchronous)]
 [BusinessOperationCategory("Orders"), BusinessOperationCategory()]
 public class CalcOrderTotalList : BusinessOperationBase
 {
     public CalcOrderTotalList()
     {
         OrderList = new List<string>();
     }
 
     // Contest property. It is marked with special attribute. Analyzing the attribute type
     // the framework will see for what context the business operation is designed.
     [ContextProperty]
     public IEnumerable<Order> Orders { get; set; }
 
     // Processed orders list. Will be filled during calculation.
     // The setter marked as private to be not considered as input.
     [XafDisplayName("Orders"), Index(0)]
     public List<string> OrderList { get; private set; }
 
     // The result of the calculation.
     // The setter marked as internal to be not considered as input.
     [XafDisplayName("Orders total"), Index(1)]
     public decimal Total { get; internal set; }
 }
 

To make the Business Operation visible for framework you should register it in the XAF Module class. To do this the Module class have to implement the interface IBusinessOperationContainer.

 

 
 public sealed partial class MyBusinessOperationsModule : ModuleBase, IBusinessOperationContainer
 {
     ...
     public IEnumerable<Type> BusinessOperationTypes
     {
         get
         {
             yield return typeof(CalcOrderTotalList);
             ...
         }
     }
 }
 

Inheritance Hierarchy

See Also