예제 #1
0
 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);
         }
     }
 }
예제 #2
0
 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);
         }
     }
 }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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)
        {
            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);
                }
            }
        }
예제 #7
0
        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());
        }
예제 #8
0
        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)
        {
            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);
                }
            }
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
        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);
            }
        }