protected override void OnValidate() { var result = (from person in _dp.GetAll() where person.SSN == _ssn select person).Count <Person>(); if (result != 0) { Invalidate("SSN of a new person should be unique! A person with this SSN is already in the database!"); } }
/// <summary> /// Invoked by GetAllCommand() if validation and business rules execute successfully /// </summary> protected virtual IEnumerable <T> GetAll(ExecutionContext <T> context) { return(_dataProxy.GetAll()); }