Reference Properties in Domain Components
- 2 minutes to read
The example below illustrates how to implement Reference (Foreign Key, Complex Type) Properties in a Domain Component interface.
// Displayed in a lookup control:
IReferencedObject LookupReferencedObject { get; set; }
// Displayed in a set of editors. Each editor represents an individual property of the referenced object:
[DevExpress.ExpressApp.DC.AggregatedAttribute, ExpandObjectMembers(ExpandObjectMembers.Always)]
IExpandPropertiesObject ExpandPropertiesObject { get; set; }
// Displayed in a Detail Property Editor that shows a referenced object's Detail View:
[DevExpress.ExpressApp.DC.AggregatedAttribute, EditorAlias(EditorAliases.DetailPropertyEditor)]
[ExpandObjectMembers(ExpandObjectMembers.Never)]
IEmbeddedDetailViewObject EmbeddedDetailViewObject { get; set; }
// Displayed in a button edit that invokes a referenced object's Detail View in a separate modal window:
[DevExpress.ExpressApp.DC.AggregatedAttribute, ExpandObjectMembers(ExpandObjectMembers.Never)]
IPopupDetailViewObject PopupDetailViewObject { get; set; }
If you use Detail Property Editor for a reference property, or apply ExpandObjectMembers attribute to a reference property, it is required to initialize such a property in the when a new parent object is created. Otherwise, the reference property’s fields will be read-only. The initialization should be done in the overridden AfterConstruction method of the attached Domain Logic the following way: