public InsqlEntityPropertyBuilder(IInsqlEntityMap entityMap, PropertyInfo propertyInfo) { if (entityMap.Properties.Any(o => o.PropertyInfo.Name == propertyInfo.Name)) { throw new Exception($"insql entity builder type : {entityMap.EntityType} `{propertyInfo.Name}` property have been mapped!"); } this.entityMap = entityMap; this.propertyMap = new InsqlPropertyMap(propertyInfo); this.entityMap.Properties.Add(this.propertyMap); }
public void Validate(IInsqlEntityMap entityMap) { foreach (var groupItem in entityMap.Properties.Where(item => !item.IsIgnored).GroupBy(item => item.ColumnName)) { if (groupItem.Count() > 1) { throw new Exception($"insql entity type : {entityMap.EntityType} `{groupItem.Key}` column name already exist!"); } } if (entityMap.Properties.Where(item => !item.IsIgnored).Count(item => item.IsIdentity) > 1) { throw new Exception($"insql entity type : {entityMap.EntityType} identity column already exist!"); } }
public DapperTypeMap(IInsqlEntityMap entityMap) { this.entityMap = entityMap; this.typeMap = new CustomPropertyTypeMap(entityMap.EntityType, this.GetProperty); }