How to: Initialize Business Objects with Default Property Values

4种属性的初始化分别如下:

Simple Property:

  All the base persistent classes are derived from the PersistentBase class. This class exposes the AfterConstruction method intended for object initialization. The AfterConstruction method is called only once for an object - after the object is created. Whenever you need to initialize an object, you should override these methods and place the initialization code into its body. As this method is specifically designed for initialization, there is no need to check the current object state when assigning values to the object properties.

Reference Property:

  Initialization of reference properties primarily differs from initialization of simple properties, in that you may need to obtain a reference to an existing object. For this purpose, use the Session.FindObject method of the object 's Session.

Collection Property :

  To populate business object collections, use the XPCollection.Add method.

Calculated Property :

  A calculated property value is automatically updated when the associated property values are changed. To learn how to implement a regular calculated property, refer to the Make a Property Calculable tutorial lesson.

 

Initialize an Object Created via the New Action

  In certain scenarios you may need to initialize only objects created specifically via the New Action. To learn how to do this, refer to the How to: Initialize an Object Created via the New Action help topic.

 

转载于:https://www.cnblogs.com/zyongzhi/archive/2010/09/22/1833173.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值