public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { foreach (EntityPropertyInfo property in entityInfo.Properties) { if (property.Facets.Identity && IsIdentityType(property.ClrType)) { builder.IdentityField = builder.FindMember(property); } } }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { foreach (EntityPropertyInfo property in entityInfo.Properties) { if (!property.Facets.Nullable && TypeHelper.IsNullable(property.ClrType)) { MemberInfo member = builder.FindMember(property); object factory = ConstraintFactories.NotNull(member); builder.AddContraintFactory(factory); } } }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { foreach (EntityPropertyInfo property in entityInfo.Properties) { if (property.Facets.Identity && property.ClrType == typeof(Guid)) { MemberInfo member = builder.FindMember(property); object factory = ConstraintFactories.GeneratedGuid(member); builder.AddContraintFactory(factory); } } }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { IList<PropertyInfo> keyMembers = new List<PropertyInfo>(); foreach (EntityPropertyInfo property in entityInfo.KeyMembers) { PropertyInfo member = builder.FindMember(property); keyMembers.Add(member); } builder.PrimaryKey = KeyInfoHelper.CreateKeyInfo(builder.EntityType, keyMembers.ToArray()); }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { IList <PropertyInfo> keyMembers = new List <PropertyInfo>(); foreach (EntityPropertyInfo property in entityInfo.KeyMembers) { PropertyInfo member = builder.FindMember(property); keyMembers.Add(member); } builder.PrimaryKey = KeyInfoHelper.CreateKeyInfo(builder.EntityType, keyMembers.ToArray()); }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { foreach (EntityPropertyInfo property in entityInfo.Properties) { if (property.ClrType == typeof(string) && property.Facets.LimitedLength) { MemberInfo member = builder.FindMember(property); int length = property.Facets.MaxLength; object factory = ConstraintFactories.VarCharLimit(member, length); builder.AddContraintFactory(factory); } } }
public void Configure(EntityInfo entityInfo, DbTableInfoBuilder builder) { var indexes = entityInfo .Properties .SelectMany(p => p.Indexes, (p, i) => new { Property = p, Index = i }) .GroupBy(x => x.Index.Name); foreach (var indexGroup in indexes) { var index = indexGroup.First().Index; var indexProps = indexGroup .OrderBy(x => x.Index.Order) .Select(x => builder.FindMember(x.Property)) .ToArray(); var keyInfo = KeyInfoHelper.CreateKeyInfo(builder.EntityType, indexProps); builder.AddKey(keyInfo, index.IsUnique); } }