In this post you are going to see how you can use on more of eXpand powerfull features. 4 different ways for creating calculated runtime properties are avaliable.
- XPO way –>Using Code
Take a note at the CreateCalculabeMember extension method at the code bellowpublic class CreateRuntimeCalculatedFieldController : ViewController {
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) {
base.CustomizeTypesInfo(typesInfo);
var classInfo = XafTypesInfo.XpoTypeInfoSource.XPDictionary.GetClassInfo(typeof(Customer));
if (classInfo.FindMember("SumOfOrderTotals")==null) {
var attributes = new Attribute[] {new PersistentAliasAttribute("Orders.Sum(Total)")};
classInfo.CreateCalculabeMember("SumOfOrderTotals", typeof(float), attributes);
typesInfo.RefreshInfo(typeof(Customer));
}
}
}
- Using ModelDifference Module
Setting IsRuntimeMember attribute will create a runtime member and setting the AliasExpression will convert it to a calculated member
Take a note here that you can easily create calculabe members for the whole application or for a user role or for just one user, depending which type of model is going to host your property - Using WorldCreator extended members
This approach can be used when u want to decorate your property with more attributes , since WorldCreator supports much more than the model
- Using a WordCreator Dynamic Assembly
this approach is the most powerfull one cause allows you also to change the code template as you see in the image bellow




