EPR类企业管理系统

在我们现有系统基础上或全新开发,提供定制服务
为您的企业高效快速实施ERP,WMS,MES,CRM管理系统
全面管控物料仓库、销售业务、采购业务、仓库业务
生产过程、质量检验、组织架构、业务报表


定制
QQ:460-3528

开发
QQ群:3360-90194

源码
微信:136-3650-3721

XPO中的参考属性

下面的示例说明了如何在XPO持久类中实现引用(外键,复杂类型)属性

private ReferencedObject lookupReferencedObject;
// Displayed in a lookup control:
public ReferencedObject LookupReferencedObject {
    get { return lookupReferencedObject; }
    set { SetPropertyValue(nameof(LookupReferencedObject), ref lookupReferencedObject, value); }
}

private ExpandPropertiesObject expandPropertiesObject;
// Displayed in a set of editors. Each editor represents an individual property of the referenced object:
[Aggregated, ExpandObjectMembers(ExpandObjectMembers.Always)]
public ExpandPropertiesObject ExpandPropertiesObject {
    get { return expandPropertiesObject; }
    set { SetPropertyValue(nameof(ExpandPropertiesObject), ref expandPropertiesObject, value); }
}

private EmbeddedDetailViewObject embeddedDetailViewObject;
// Displayed in a Detail Property Editor that shows a referenced object's Detail View:
[Aggregated, EditorAlias(EditorAliases.DetailPropertyEditor), ExpandObjectMembers(ExpandObjectMembers.Never)]
public EmbeddedDetailViewObject EmbeddedDetailViewObject {
    get { return embeddedDetailViewObject; }
    set { SetPropertyValue(nameof(EmbeddedDetailViewObject), ref embeddedDetailViewObject, value); }
}

private PopupDetailViewObject popupDetailViewObject;
// Displayed in a button edit that invokes a referenced object's Detail View in a separate modal window:
[Aggregated, ExpandObjectMembers(ExpandObjectMembers.Never)]
public PopupDetailViewObject PopupDetailViewObject {
    get { return popupDetailViewObject; }
    set { SetPropertyValue(nameof(PopupDetailViewObject), ref popupDetailViewObject, value); }
}

如果将“详细信息属性编辑器”用作参考属性,或将ExpandObjectMembers属性应用于参考属性,则在创建新的父对象时需要初始化此类属性。否则,引用属性的字段将为只读。初始化应通过以下方式在重写的AfterConstruction方法中完成:

public override void AfterConstruction() {
    base.AfterConstruction();
    embeddedDetailViewObject = new EmbeddedDetailViewObject(Session);
}
相关文章

转载保留此链接,注明出处