有三种方法设置默认值:
1.BaseObject.AfterConstruction,覆写AfterConstruction方法
public override void AfterConstruction() {
base.AfterConstruction();
Priority = Priority.Normal;
}
base.AfterConstruction();
Priority = Priority.Normal;
}
2.IXPObject.OnSaving,覆写OnSaving()方法
protected override void OnSaving() {
Priority = Priority.Normal;
base.OnSaving();
}
Priority = Priority.Normal;
base.OnSaving();
}
3.In a field declaration,在字段定义中
private Priority priority = Priority.Normal;
public Priority Priority {
get { return priority; }
set {
SetPropertyValue("Priority", ref priority, value);
}
}
public Priority Priority {
get { return priority; }
set {
SetPropertyValue("Priority", ref priority, value);
}
}
欢迎转载,转载请注明出处:http://www.cnblogs.com/Tonyyang/