1
我尝试了一个方法,其结果是布尔型自定义验证在模型中!Silverlight Sync
[CustomValidation(typeof(SpecialValidator), "IsUniQueCountryCode")]
它必须同步,因此方法可以有一个结果值:
public static ValidationResult IsUniQueCountryCode(string value) {
if (value.Length > 0)
{
DSCountry _context = new DSCountry();
ObservableCollection<MCountry> List = new ObservableCollection<MCountry>();
LoadOperation<Country> loadOp = _context.Load((_context.GetCountryByCodeQuery(value)).Where(s => s.ISOCode == value));
IEnumerable<Country> Entities;
bool test = false;
loadOp.Completed += (s, e) =>
{
test = true;
};
//
if (test == true)
{
}
//
}
return ValidationResult.Success;
}
我怎样才能使负载同步?