protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);

            if (AppConfig.EfProvider == "oracle")
            {
                // Oracle's driver does not support JsonObject
                modelBuilder.Entity <DataTypesVariable>(entity =>
                {
                    entity.Ignore(m => m.TypeJsonArray);
                    entity.Ignore(m => m.TypeJsonArrayN);
                    entity.Ignore(m => m.TypeJsonObject);
                    entity.Ignore(m => m.TypeJsonObjectN);
                });
                modelBuilder.Entity <GeneratedContact>(entity =>
                {
                    entity.Ignore(m => m.Names);
                    entity.Ignore(m => m.ContactInfo);
                });
            }
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Shorten key length for Identity
            modelBuilder.Entity <AppIdentityUser>(entity =>
            {
                entity.Property(m => m.Email).HasMaxLength(127);
                entity.Property(m => m.NormalizedEmail).HasMaxLength(127);
                entity.Property(m => m.NormalizedUserName).HasMaxLength(127);
                entity.Property(m => m.UserName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityRole>(entity =>
            {
                entity.Property(m => m.Name).HasMaxLength(127);
                entity.Property(m => m.NormalizedName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserLogin <string> >(entity =>
            {
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.ProviderKey).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserRole <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.RoleId).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserToken <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.Name).HasMaxLength(127);
            });
            modelBuilder.Entity <ProductCategory>()
            .HasKey(x => new { x.ProductId, x.CategoryId });

            modelBuilder.Entity <DataTypesVariable>(eb =>
            {
                // Need to specify the type until EF#12212 is fixed
                eb.Property(e => e.TypeJsonArray).HasColumnType("json");
                eb.Property(e => e.TypeJsonArrayN).HasColumnType("json");
                eb.Property(e => e.TypeJsonObject).HasColumnType("json");
                eb.Property(e => e.TypeJsonObjectN).HasColumnType("json");
            });

            modelBuilder.Entity <GeneratedContact>(eb =>
            {
                // Need to specify the type until EF#12212 is fixed
                eb.Property(e => e.Names).HasColumnType("json");
                eb.Property(e => e.ContactInfo).HasColumnType("json");
            });

            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);
        }
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.Entity <AppIdentityUser>(entity => entity.Property(m => m.Id).HasMaxLength(127));
     modelBuilder.Entity <IdentityRole>(entity => entity.Property(m => m.Id).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserLogin <string> >(entity => entity.Property(m => m.LoginProvider).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserLogin <string> >(entity => entity.Property(m => m.ProviderKey).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserRole <string> >(entity => entity.Property(m => m.UserId).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserRole <string> >(entity => entity.Property(m => m.RoleId).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserToken <string> >(entity => entity.Property(m => m.UserId).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserToken <string> >(entity => entity.Property(m => m.LoginProvider).HasMaxLength(127));
     modelBuilder.Entity <IdentityUserToken <string> >(entity => entity.Property(m => m.Name).HasMaxLength(127));
     CrmMeta.OnModelCreating(modelBuilder);
     GeneratedContactMeta.OnModelCreating(modelBuilder);
 }
Beispiel #5
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Shorten key length for Identity
            modelBuilder.Entity <AppIdentityUser>(entity => entity.Property(m => m.Id).HasMaxLength(127));
            modelBuilder.Entity <IdentityRole>(entity => entity.Property(m => m.Id).HasMaxLength(127));
            modelBuilder.Entity <IdentityUserLogin <string> >(entity =>
            {
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.ProviderKey).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserRole <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.RoleId).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserToken <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.Name).HasMaxLength(127);
            });

            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);

            if (AppConfig.EfProvider == "oracle")
            {
                // Oracle's driver does not support JsonObject
                modelBuilder.Entity <DataTypesVariable>(entity =>
                {
                    entity.Ignore(m => m.TypeJsonArray);
                    entity.Ignore(m => m.TypeJsonArrayN);
                    entity.Ignore(m => m.TypeJsonObject);
                    entity.Ignore(m => m.TypeJsonObjectN);
                });
                modelBuilder.Entity <GeneratedContact>(entity =>
                {
                    entity.Ignore(m => m.Names);
                    entity.Ignore(m => m.ContactInfo);
                });
            }
        }
Beispiel #6
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Shorten key length for Identity
            modelBuilder.Entity <AppIdentityUser>(entity => {
                entity.Property(m => m.Email).HasMaxLength(127);
                entity.Property(m => m.NormalizedEmail).HasMaxLength(127);
                entity.Property(m => m.NormalizedUserName).HasMaxLength(127);
                entity.Property(m => m.UserName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityRole>(entity => {
                entity.Property(m => m.Name).HasMaxLength(127);
                entity.Property(m => m.NormalizedName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserLogin <string> >(entity =>
            {
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.ProviderKey).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserRole <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.RoleId).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserToken <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.Name).HasMaxLength(127);
            });

#if POMELO
            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);
#endif

            if (AppConfig.EfSchema != null)
            {
                // Generates all models in a different schema
                modelBuilder.HasDefaultSchema(AppConfig.EfSchema);
            }
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            // Shorten key length for Identity
            modelBuilder.Entity <AppIdentityUser>(entity => {
                entity.Property(m => m.Email).HasMaxLength(127);
                entity.Property(m => m.NormalizedEmail).HasMaxLength(127);
                entity.Property(m => m.NormalizedUserName).HasMaxLength(127);
                entity.Property(m => m.UserName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityRole>(entity => {
                entity.Property(m => m.Name).HasMaxLength(127);
                entity.Property(m => m.NormalizedName).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserLogin <string> >(entity =>
            {
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.ProviderKey).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserRole <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.RoleId).HasMaxLength(127);
            });
            modelBuilder.Entity <IdentityUserToken <string> >(entity =>
            {
                entity.Property(m => m.UserId).HasMaxLength(127);
                entity.Property(m => m.LoginProvider).HasMaxLength(127);
                entity.Property(m => m.Name).HasMaxLength(127);
            });

            // Add our models fluent APIs
            CrmMeta.OnModelCreating(modelBuilder);
            GeneratedContactMeta.OnModelCreating(modelBuilder);
            PeopleMeta.OnModelCreating(modelBuilder);
        }
Beispiel #8
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     CrmMeta.OnModelCreating(modelBuilder);
 }