internal void MutateName() { var name = Name; var index = 0; do { index++; Name = MutateHelper.MutateString(name, index); } while (EntityObjectRepository.CheckNameUniqueness(this)); }
protected virtual RulesException ValidateUnique(RulesException errors) { if (!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(EntityTypeCode)) { if (EntityObjectRepository.CheckNameUniqueness(this)) { errors.Error(UniquePropertyName, Name, PropertyIsNotUniqueMessage); } } return(errors); }
/// <summary> /// Проверяет уникальность имен /// </summary> /// <param name="item">сущность</param> /// <returns>true или false</returns> public static bool CheckNameUniqueness(EntityObject item) => EntityObjectRepository.CheckNameUniqueness(item);