Skip to content

Commit

Permalink
Refactor according to blog post:
Browse files Browse the repository at this point in the history
  • Loading branch information
apobekiaris committed Jan 30, 2013
1 parent 00d2b89 commit d378ff1
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Base;
using DevExpress.Xpo;
using Xpand.ExpressApp;
using Xpand.Xpo;

Expand All @@ -10,11 +9,15 @@ public class CreateRuntimeCalculatedFieldController : ViewController {
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo) {
base.CustomizeTypesInfo(typesInfo);
var classInfo = XpandModuleBase.Dictiorary.GetClassInfo(typeof(Customer));

if (classInfo.FindMember("SumOfOrderTotals")==null) {

if (classInfo.FindMember("SumOfOrderTotals") == null) {
var xpandCalcMemberInfo = classInfo.CreateCalculabeMember("SumOfOrderTotals", typeof(float), "Orders.Sum(Total)");
var attributes = new Attribute[] {new VisibleInListViewAttribute(false),new VisibleInLookupListViewAttribute(false),
new VisibleInDetailViewAttribute(false),new PersistentAliasAttribute("Orders.Sum(Total)")};
classInfo.CreateCalculabeMember("SumOfOrderTotals", typeof(float), attributes);
new VisibleInDetailViewAttribute(false)};
foreach (var attribute in attributes) {
xpandCalcMemberInfo.AddAttribute(attribute);
}

typesInfo.RefreshInfo(typeof(Customer));
}
}
Expand Down

0 comments on commit d378ff1

Please sign in to comment.