Extra Categories. Learn More

In addition to the customization of the Extra Categories in the Application Model, you can set Extra Categories functionality for the business-object in code, by using Xafari.BC.BOCategoryAttribute. Code snippet bellow demonstrates this.

  • c#
  • VB

[DefaultClassOptions]
[BOCategory("Customer", typeof(Customer), "Customer.Oid='{0:Oid}'"), BOCategory("Employee", typeof(Employee), "Employee.Oid='{0:Oid}'")]
public class Order : BaseObject
{
  //Description of the class
  public Customer Customer
  {
    get
    {
      return this.GetPropertyValue<Customer>("Customer");
    }
    set
    {
      this.SetPropertyValue("Customer", value);
    }
  }
  public Employee Employee
  {
    get
    {
      return this.GetPropertyValue<Employee>("Employee");
    }
    set
    {
      this.SetPropertyValue("Employee", value);
    }
  }
  //Other fields of the class …
 
 
}

<DefaultClassOptions> _
<BOCategory("Customer", GetType(Customer), "Customer.Oid='{0:Oid}'"), BOCategory("Employee", GetType(Employee), "Employee.Oid='{0:Oid}'")> _
Public Class Order
  Inherits BaseObject
  'Description of the class
  Public Property Customer As Customer
    Get
      Return Me.GetPropertyValue(Of Customer)("Customer")
    End Get
    Set
      Me.SetPropertyValue("Customer", value)
    End Set
  End Property
  Public Property Employee As Employee
    Get
      Return Me.GetPropertyValue(Of Employee)("Employee")
    End Get
    Set
      Me.SetPropertyValue("Employee", value)
    End Set
  End Property
  'Other fields of the class …
   …
   …
End Class

You can view the code used in this topic in the Xafari.Northwind|Documents|Order.cs file of the Xafari Northwind demo installed with Xafari.