一、问题
1. 在XAF中如何验证多个属性唯一值?
二、解决方法
使用RuleCombinationOfPropertiesIsUnique
[RuleCombinationOfPropertiesIsUnique("SampleRule", DefaultContexts.Save, "Description, Id")]
public class SampleClass : BaseObject {
private int id;
private string description; public SampleClass(Session session) : base(session) { } public int Id {
get { return id; }
set { SetPropertyValue("Id", ref id, value); }
}
public string Description {
get { return description; }
set { SetPropertyValue("Description", ref description, value); }
}
}