0
私はFoolproofの検証を使用しています。MVCサーバー側の検証
を呼び出すとき[RequiredIfTrue( "CommonUseStatus")]
誰にでもできるReqiuredIfAttributeはSystem.NullReferenceExceptionを与えます。 CommonUseInfoにはCommonUseStatusプロパティがないため、 です。 この方法でこの属性を使用するにはどうすればよいですか?
public class FoundationCode : SpatialEntity
{
public bool CommonUseStatus {get; set;}
public string FullFoundationCode { get; set; }
public string ProvinceCode { get; set; }
public string DistrictCode { get; set; }
public bool FoundationOwner { get; set; }
public virtual CommonUseInfo CommonUseInfo { get; set; }
}
public class CommonUseInfo : BaseEntity
{
public int CommonUseSchool { get; set; }
**[RequiredIfTrue("CommonUseStatus")]**
public DateTime CommonUseStartingDate { get; set; }
**[RequiredIfTrue("CommonUseStatus")]**
public DateTime CommonUseEndDate { get; set; }
public virtual FoundationCode FoundationCode { get; set; }
}
FoundatinCodeにはCommonUseStatusプロパティがあります。私は質問を追加するのを忘れました –
@AliFuat:そのライブラリの内部の動作は私には分かっていないのでほとんどの推測ですが、属性に "FoundationCode.CommonUseStatus"を使用できますか? – David
作業をしないFoundationCose.CommonUseStatus –