namespace ePhoneBookMvc4Application.Models { public partial class PhoneBook : ePhoneBookMvc4Application.Repositories.PhoneBook { public bool IsValid { get { return (GetRuleViolations().Count() == 0); } } public IEnumerable<RuleViolation> GetRuleViolations() { if (String.IsNullOrEmpty(FirstName)) { yield return new RuleViolation("First Name Required", "FirstName"); } if (!OnValidatePropertyForPhonebook.CharStringValidator(FirstName)) { yield return new RuleViolation("Please Enter Valid First Name", "FirstName"); } yield break; } partial void OnValidate(System.Data.Linq.ChangeAction action) { if(!IsValid) { throw new ApplicationException("Rule violations prevent saving"); } } } }
No defining declaration found for implementing declaration of partial method ePhoneBookMvc4Application.Models.PhoneBook.OnValidate(System.Data.Linq.ChangeAction)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)