This relates to my earlier question that I managed to solve on my own shortly after asking it…
https://www.devexpress.com/Support/Center/Question/Details/T641444/runtime-add-member-to-nonpersistent-class
The non-persistent fields I wish to create are derived from data in the database. When accessing the DB directly, it works as desired, but with the Middle-Tier server, I am unable to access the necessary data. I suspect this is not a 'supported' usage, but any tips on how to obtain access to the database at this point in the application startup would be much appreciated.
Hello Eldon,
To avoid any misunderstanding, please attach your code demonstrating the approach you are using when the application is connected to the database directly.
TimingContainer is the nonpersistent object containing one set of related fields
public override void CustomizeTypesInfo(ITypesInfo typesInfo) { base.CustomizeTypesInfo(typesInfo); IObjectSpace oSpace = Application.CreateObjectSpace(); ITypeInfo tcInfo = typesInfo.FindTypeInfo(typeof(TimingContainer)); if (tcInfo is TypeInfo tcti) { IList<ProjectEventType> eventTypes = oSpace.GetObjects<ProjectEventType>(CriteriaOperator.Parse("Obsolete = False")); foreach (ProjectEventType evt in eventTypes) { IMemberInfo member = tcti.CreateMember("ProjectEvent" + evt.Oid, typeof(ProjectEvent), "Project.TimingEvents[[EventType.Oid] = " + evt.Oid + " And [Rank] = ^.TimingEvents[[EventType.Oid] = " + evt.Oid + "].Max([Rank])].Max([This])"); XafMemberInfo xMember = member as XafMemberInfo; xMember.DisplayName = evt.Label + " Event"; } } typesInfo.RefreshInfo(typeof(BusinessObjects.Persistent.ProjectCore.TimingContainer)); }
Hello Eldon,
We need additional time to research this scenario. We will get back to you once we have any results or need additional information. Please bear with us.