/// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity1>()
            .ToTable("Entity1")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity1>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity2>()
            .ToTable("Entity2")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity2>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity2>()
            .Property(t => t.FK)
            .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute()));
            modelBuilder.Entity <global::Sandbox_EF6_Test.Entity2>()
            .HasOptional(x => x.Entity1)
            .WithMany(x => x.Entity2)
            .HasForeignKey(p => p.FK);

            OnModelCreatedImpl(modelBuilder);
        }
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::MultiContext.Context1.Entity1>()
            .ToTable("Entity1")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::MultiContext.Context1.Entity1>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::MultiContext.Context1.Entity2>()
            .ToTable("Entity2")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::MultiContext.Context1.Entity2>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::MultiContext.Context1.Entity2>()
            .HasRequired(x => x.Entity1)
            .WithMany(x => x.Entity2)
            .Map(x => x.MapKey("Entity1_Id"));

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 3
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox_EF6.BaseClass>()
            .ToTable("BaseClasses")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6.BaseClass>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Sandbox_EF6.Detail>()
            .ToTable("Details");
            modelBuilder.Entity <global::Sandbox_EF6.Detail>()
            .HasMany(x => x.BaseClasses)
            .WithRequired()
            .Map(x => x.MapKey("Detail.BaseClasses_Id"));

            modelBuilder.Entity <global::Sandbox_EF6.Master>()
            .ToTable("Masters");
            modelBuilder.Entity <global::Sandbox_EF6.Master>()
            .HasMany(x => x.Details)
            .WithOptional()
            .Map(x => x.MapKey("Master.Details_Id"))
            .WillCascadeOnDelete(true);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 4
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox_EF6.Role>()
            .ToTable("Roles")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6.Role>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Sandbox_EF6.User>()
            .ToTable("Users")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6.User>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox_EF6.User>()
            .HasRequired(x => x.Role)
            .WithMany(x => x.Users)
            .Map(x => x.MapKey("Role_Id"));

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 5
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     if (_schema != null) // Some databases don't support schemata at all (e.g. SQLite, MySQL)
     {
         modelBuilder.HasDefaultSchema(_schema);
     }
 }
Esempio n. 6
0
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder mb)
        {
            base.OnModelCreating(mb);

            mb.HasDefaultSchema("dbo");
            mb.Conventions.Remove <System.Data.Entity.ModelConfiguration.Conventions.PluralizingTableNameConvention>();
            mb.Conventions.Remove <System.Data.Entity.ModelConfiguration.Conventions.ColumnAttributeConvention>();

            mb.Entity <Log>().HasRequired(x => x.Tapete).WithMany(x => x.Logs).Map(y => y.MapKey("TapeteId"));
        }
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //modelBuilder.Entity<ApplicationUser>().ToTable("WebUsers");
            //modelBuilder.Entity<IdentityUserRole>().ToTable("WebUserRoles");
            //modelBuilder.Entity<IdentityUserLogin>().ToTable("WebUserLogins");
            //modelBuilder.Entity<IdentityUserClaim>().ToTable("WebUserClaims");
            //modelBuilder.Entity<IdentityRole>().ToTable("WebRoles");
            modelBuilder.Conventions.Remove <PluralizingTableNameConvention>();
            modelBuilder.HasDefaultSchema("bourguestMob");
        }
Esempio n. 8
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Model.Entity1>()
            .ToTable("Entity1")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Model.Entity1>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 9
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
#if !EFCORE
            /*
             * EF Core is better at choosing the most appropriate default schema, see https://docs.microsoft.com/en-us/ef/core/modeling/relational/default-schema
             * > By convention, the database provider will choose the most appropriate default schema. For example, Microsoft SQL Server will use the dbo schema and SQLite will not use a schema (since schemas are not supported in SQLite).
             * But EF 6 needs a bit of help to choose an appropriate default schema.
             */
            var isSqlServer = Database.Connection.GetType().FullName == "System.Data.SqlClient.SqlConnection";
            if (!isSqlServer) // setting "" as default schema for SqlServer somehow turns it into "CodeFirstDatabase"
            {
                modelBuilder.HasDefaultSchema("");
            }
#endif
            modelBuilder.Entity <Customer>().ToTable("tCustomers");
            modelBuilder.Entity <Order>().ToTable("tOrders");
        }
Esempio n. 10
0
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.HasDefaultSchema("DBOFERTAS".ToUpper());

            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.Id).HasColumnName("ID");
            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.Email).HasColumnName("EMAIL");
            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.EmailConfirmed).HasColumnName("EMAIL_CONFIRMADO");
            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.PasswordHash).HasColumnName("PASSWORD");
            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.SecurityStamp).HasColumnName("SELLO_SEGURIDAD");
            modelBuilder.Entity <ApplicationUser>().ToTable("PERSONA").Property(p => p.UserName).HasColumnName("RUT");

            modelBuilder.Entity <IdentityUserRole>().ToTable("PERFIL_PERSONA").Property(P => P.RoleId).HasColumnName("ID_PERFIL");
            modelBuilder.Entity <IdentityUserRole>().ToTable("PERFIL_PERSONA").Property(P => P.UserId).HasColumnName("ID_PERSONA");

            modelBuilder.Entity <IdentityRole>().ToTable("PERFIL").Property(P => P.Name).HasColumnName("NOMBRE");
            modelBuilder.Entity <IdentityRole>().ToTable("PERFIL").Property(P => P.Id).HasColumnName("ID");
        }
Esempio n. 11
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox_EF6.PressRelease>()
            .ToTable("PressReleases")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6.PressRelease>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox_EF6.PressRelease>()
            .HasMany(x => x.PressReleaseDetails)
            .WithRequired()
            .Map(x => x.MapKey("PressRelease.PressReleaseDetails_Id"))
            .WillCascadeOnDelete(false);

            modelBuilder.Entity <global::Sandbox_EF6.PressReleaseDetail>()
            .ToTable("PressReleaseDetails")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox_EF6.PressReleaseDetail>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox_EF6.PressReleaseDetail>()
            .HasMany(x => x.PressReleases)
            .WithRequired()
            .Map(x => x.MapKey("PressReleaseDetail.PressReleases_Id"))
            .WillCascadeOnDelete(false);
            modelBuilder.Entity <global::Sandbox_EF6.PressReleaseDetail>()
            .HasRequired(x => x.PressRelease)
            .WithMany(x => x.PressReleaseDetailHistory)
            .Map(x => x.MapKey("PressRelease_Id"))
            .WillCascadeOnDelete(false);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 12
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox.Entity1>()
            .ToTable("Entity1")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity1>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity1>()
            .HasRequired(x => x.Entity2)
            .WithMany()
            .Map(x => x.MapKey("Entity2_Id"));

            modelBuilder.Entity <global::Sandbox.Entity2>()
            .ToTable("Entity2")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .Property(t => t.Foo)
            .IsRequired()
            .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute()));
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .HasMany(x => x.Entity4)
            .WithRequired()
            .HasForeignKey(p => p.Bar);
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .HasRequired(x => x.Entity5)
            .WithMany(x => x.Entity2)
            .HasForeignKey(p => p.Foo);

            modelBuilder.Entity <global::Sandbox.Entity3>()
            .ToTable("Entity3")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity3>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Sandbox.Entity4>()
            .ToTable("Entity4")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity4>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity4>()
            .Property(t => t.xx)
            .IsRequired()
            .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute()));
            modelBuilder.Entity <global::Sandbox.Entity4>()
            .HasMany(x => x.Entity3)
            .WithMany(x => x.Entity4)
            .Map(x => { x.ToTable("Entity3_x_Entity4"); x.MapLeftKey("Entity4_Id"); x.MapRightKey("Entity3_Id"); });

            modelBuilder.Entity <global::Sandbox.Entity5>()
            .ToTable("Entity5")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity5>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 13
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Sandbox.Entity1>()
            .ToTable("Entity1")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity1>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity1>()
            .HasRequired(x => x.Entity2)
            .WithMany()
            .Map(x => x.MapKey("Entity2_Id"));

            modelBuilder.Entity <global::Sandbox.Entity2>()
            .ToTable("Entity2")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .HasMany(x => x.Entity4)
            .WithRequired()
            .Map(x => x.MapKey("Entity2.Entity4_Id"));
            modelBuilder.Entity <global::Sandbox.Entity2>()
            .HasRequired(x => x.Entity5)
            .WithMany(x => x.Entity2)
            .Map(x => x.MapKey("Entity5_Id"));

            modelBuilder.Entity <global::Sandbox.Entity3>()
            .ToTable("Entity3")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity3>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Sandbox.Entity4>()
            .ToTable("Entity4")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity4>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Sandbox.Entity4>()
            .HasRequired(x => x.Entity3)
            .WithMany(x => x.Entity4)
            .Map(x => x.MapKey("Entity3_Id"));

            modelBuilder.Entity <global::Sandbox.Entity5>()
            .ToTable("Entity5")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Sandbox.Entity5>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 14
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::SRUL.CountryInformation>()
            .ToTable("CountryInformations")
            .HasKey(t => t.Name);
            modelBuilder.Entity <global::SRUL.CountryInformation>()
            .Property(t => t.Name)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::SRUL.Games>()
            .ToTable("Games")
            .HasKey(t => t.Name);
            modelBuilder.Entity <global::SRUL.Games>()
            .Property(t => t.Name)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::SRUL.Games>()
            .HasMany(x => x.Versions)
            .WithRequired()
            .Map(x => x.MapKey("Games.Versions_Name"));

            modelBuilder.Entity <global::SRUL.Offset>()
            .ToTable("Offsets")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::SRUL.Offset>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::SRUL.Offset>()
            .HasRequired(x => x.UnitInformation)
            .WithMany(x => x.Pointers)
            .Map(x => x.MapKey("UnitInformation_UnitID"));

            modelBuilder.Entity <global::SRUL.Pointers>()
            .ToTable("Pointers")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::SRUL.Pointers>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::SRUL.Pointers>()
            .HasRequired(x => x.Versions)
            .WithMany(x => x.Pointers)
            .Map(x => x.MapKey("Versions_GameName"));
            modelBuilder.Entity <global::SRUL.Pointers>()
            .HasRequired(x => x.Games)
            .WithMany(x => x.Pointers)
            .Map(x => x.MapKey("Games_Name"));

            modelBuilder.Entity <global::SRUL.UnitInformation>()
            .ToTable("UnitInformations")
            .HasKey(t => t.UnitID);
            modelBuilder.Entity <global::SRUL.UnitInformation>()
            .Property(t => t.UnitID)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::SRUL.Versions>()
            .ToTable("Versions")
            .HasKey(t => t.GameName);
            modelBuilder.Entity <global::SRUL.Versions>()
            .Property(t => t.GameName)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 15
0
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <ApplicationUserLogin>().Map(c =>
            {
                c.ToTable("UserLogin");
                c.Properties(p => new
                {
                    p.UserId,
                    p.LoginProvider,
                    p.ProviderKey
                });
            }).HasKey(p => new { p.LoginProvider, p.ProviderKey, p.UserId });

            // Mapping for ApiRole
            modelBuilder.Entity <ApplicationRole>().Map(c =>
            {
                c.ToTable("Role");
                c.Property(p => p.Id).HasColumnName("RoleId");
                c.Properties(p => new
                {
                    p.Name
                });
            }).HasKey(p => p.Id);
            modelBuilder.Entity <ApplicationRole>().HasMany(c => c.Users).WithRequired().HasForeignKey(c => c.RoleId);

            modelBuilder.Entity <ApplicationUser>().Map(c =>
            {
                c.ToTable("User");
                c.Property(p => p.Id).HasColumnName("UserId");
                c.Properties(p => new
                {
                    p.AccessFailedCount,
                    p.Email,
                    p.EmailConfirmed,
                    p.PasswordHash,
                    p.PhoneNumber,
                    p.PhoneNumberConfirmed,
                    p.TwoFactorEnabled,
                    p.SecurityStamp,
                    p.LockoutEnabled,
                    p.LockoutEndDateUtc,
                    p.UserName
                });
            }).HasKey(c => c.Id);
            modelBuilder.Entity <ApplicationUser>().HasMany(c => c.Logins).WithOptional().HasForeignKey(c => c.UserId);
            modelBuilder.Entity <ApplicationUser>().HasMany(c => c.Claims).WithOptional().HasForeignKey(c => c.UserId);
            modelBuilder.Entity <ApplicationUser>().HasMany(c => c.Roles).WithRequired().HasForeignKey(c => c.UserId);

            modelBuilder.Entity <ApplicationUserRole>().Map(c =>
            {
                c.ToTable("UserRole");
                c.Properties(p => new
                {
                    p.UserId,
                    p.RoleId
                });
            })
            .HasKey(c => new { c.UserId, c.RoleId });

            modelBuilder.Entity <ApplicationUserClaim>().Map(c =>
            {
                c.ToTable("UserClaim");
                c.Property(p => p.Id).HasColumnName("UserClaimId");
                c.Properties(p => new
                {
                    p.UserId,
                    p.ClaimValue,
                    p.ClaimType
                });
            }).HasKey(c => c.Id);
        }
Esempio n. 16
0
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.HasDefaultSchema("admin");
            modelBuilder.Entity <Models.Student>().ToTable("StudentInfo");
            modelBuilder.Entity <Models.Standard>().ToTable("StandardInfo", "dbo");

            modelBuilder.Entity <Models.Standard>()
            .HasKey <int>(current => current.StandardKey);
            modelBuilder.Entity <Models.Student>()
            .Property(current => current.DateOfBirth)
            .HasColumnName("Column01")
            .HasColumnOrder(3)
            .HasColumnType("datetime2");
            modelBuilder.Entity <Models.Student>()
            .Property(current => current.Height)
            .IsOptional()
            .HasPrecision(2, 2);
            modelBuilder.Entity <Models.Student>()
            .Property(current => current.Weight)
            .IsRequired();
            modelBuilder.Entity <Models.Student>()
            .Property(current => current.StudentName)
            .HasMaxLength(50)
            .IsConcurrencyToken();     //Optimistic Concurrency != Pessimistic Concurrency

            //CHAR
            //.IsFixedLength()
            //.IsUnicode(false);

            //NCHAR
            //.IsFixedLength()
            //.IsUnicode();

            //NVARCHAR(MAX)
            //.IsVariableLength()
            //.IsUnicode()
            //.IsMaxLength();

            //NVARCHAR(Number)
            //.IsUnicode()
            //.IsVariableLength()
            //.HasMaxLength(50);

            //VARCHAR(MAX)
            //.IsVariableLength()
            //.IsUnicode(false)
            //.IsMaxLength();

            //VARCHAR(Number)
            //.IsVariableLength()
            //.HasMaxLength(50);

            // One to One
            modelBuilder.Entity <StudentAddress>()
            .HasKey(s => s.Id);
            modelBuilder.Entity <Student>()
            .HasOptional(s => s.StudentAddress)
            .WithRequired(ad => ad.Student);

            // One to Many
            modelBuilder.Entity <Student>()
            .HasRequired <Standard>(s => s.Standard)
            .WithMany(st => st.Students)
            .HasForeignKey(s => s.Standard);

            // Many to Many
            modelBuilder.Entity <Student>()
            .HasMany <Course>(s => s.Courses)
            .WithMany(c => c.Students)
            .Map(cs =>
            {
                cs.MapLeftKey("StudentId");
                cs.MapRightKey("CourseId");
                cs.ToTable("StudentCourse");
            });
        }
Esempio n. 17
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Testing.AbstractBaseClass>();

            modelBuilder.Entity <global::Testing.AllPropertyTypesOptional>().ToTable("AllPropertyTypesOptionals").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.AllPropertyTypesOptional>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().ToTable("AllPropertyTypesRequireds").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.BinaryAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.BooleanAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.ByteAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.DateTimeAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.DateTimeOffsetAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.DecimalAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.DoubleAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.GuidAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.Int16Attr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.Int32Attr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.Int64Attr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.SingleAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.TimeAttr).IsRequired();
            modelBuilder.Entity <global::Testing.AllPropertyTypesRequired>().Property(t => t.StringAttr).IsRequired();

            modelBuilder.Entity <global::Testing.BaseClass>();

            modelBuilder.Entity <global::Testing.BaseClassWithRequiredProperties>().ToTable("BaseClassWithRequiredProperties").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.BaseClassWithRequiredProperties>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.BaseClassWithRequiredProperties>().Property(t => t.Property0).IsRequired();

            modelBuilder.Entity <global::Testing.BChild>().ToTable("BChilds").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.BChild>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.BChild>().HasRequired(x => x.BParentRequired).WithOptional(x => x.BChildOptional);
            modelBuilder.Entity <global::Testing.BChild>().HasRequired(x => x.BParentRequired_1).WithRequiredPrincipal(x => x.BChildRequired);
            modelBuilder.Entity <global::Testing.BChild>().HasRequired(x => x.BParentRequired_2).WithMany(x => x.BChildCollection).Map(x => x.MapKey("BParentRequired_2Id"));
            modelBuilder.Entity <global::Testing.BChild>().HasMany(x => x.BParentCollection).WithRequired(x => x.BChildRequired).Map(x => x.MapKey("BChildRequiredId"));
            modelBuilder.Entity <global::Testing.BChild>().HasMany(x => x.BParentCollection_1).WithMany(x => x.BChildCollection).Map(x => { x.ToTable("BParentCollection_1_x_BChildCollection"); x.MapLeftKey("BChild_Id"); x.MapRightKey("BParentCollection_Id"); });
            modelBuilder.Entity <global::Testing.BChild>().HasMany(x => x.BParentCollection_2).WithOptional(x => x.BChildOptional).Map(x => x.MapKey("BChildOptionalId"));
            modelBuilder.Entity <global::Testing.BChild>().HasOptional(x => x.BParentOptional).WithRequired(x => x.BChildRequired);
            modelBuilder.Entity <global::Testing.BChild>().HasOptional(x => x.BParentOptional_1).WithMany(x => x.BChildCollection).Map(x => x.MapKey("BParentOptional_1Id"));
            modelBuilder.Entity <global::Testing.BChild>().HasOptional(x => x.BParentOptional_2).WithOptionalPrincipal(x => x.BChildOptional);

            modelBuilder.Entity <global::Testing.BParentCollection>().ToTable("BParentCollections").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.BParentCollection>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.BParentOptional>().ToTable("BParentOptionals").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.BParentOptional>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.BParentRequired>().ToTable("BParentRequireds").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.BParentRequired>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.Child>().ToTable("Children").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.Child>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.Child>().HasRequired(x => x.Parent).WithMany(x => x.Children).Map(x => x.MapKey("ParentId"));

            modelBuilder.Entity <global::Testing.ConcreteDerivedClass>();

            modelBuilder.Entity <global::Testing.ConcreteDerivedClassWithRequiredProperties>();
            modelBuilder.Entity <global::Testing.ConcreteDerivedClassWithRequiredProperties>().Property(t => t.Property1).IsRequired();

            modelBuilder.Entity <global::Testing.DerivedClass>();

            modelBuilder.Entity <global::Testing.HiddenEntity>().ToTable("HiddenEntities").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.HiddenEntity>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.Master>().ToTable("Masters").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.Master>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.Master>().HasMany(x => x.Children).WithRequired().Map(x => x.MapKey("MasterChildrenId"));

            modelBuilder.Entity <global::Testing.ParserTest>().ToTable("ParserTests").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.ParserTest>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            modelBuilder.Entity <global::Testing.ParserTest>().Property(t => t.foo).IsRequired();

            modelBuilder.Entity <global::Testing.RenamedColumn>().ToTable("RenamedColumns").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.RenamedColumn>().Property(t => t.Id).IsRequired().HasColumnName("Foo").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.SpatialProperties>().ToTable("SpatialProperties").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.SpatialProperties>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            modelBuilder.Entity <global::Testing.UChild>().ToTable("UChilds").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.UChild>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            modelBuilder.Entity <global::Testing.UParentCollection>().ToTable("UParentCollections").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.UParentCollection>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.UParentCollection>().HasRequired(x => x.UChildRequired).WithMany().Map(x => x.MapKey("UChildRequiredId"));
            modelBuilder.Entity <global::Testing.UParentCollection>().HasMany(x => x.UChildCollection).WithMany().Map(x => { x.ToTable("UParentCollection_x_UChildCollection"); x.MapLeftKey("UParentCollection_Id"); x.MapRightKey("UChild_Id"); });
            modelBuilder.Entity <global::Testing.UParentCollection>().HasOptional(x => x.UChildOptional).WithMany().Map(x => x.MapKey("UChildOptionalId"));

            modelBuilder.Entity <global::Testing.UParentOptional>();
            modelBuilder.Entity <global::Testing.UParentOptional>().HasOptional(x => x.UChildOptional).WithOptionalDependent();
            modelBuilder.Entity <global::Testing.UParentOptional>().HasMany(x => x.UChildCollection).WithOptional().Map(x => x.MapKey("UParentOptionalUChildCollectionId"));
            modelBuilder.Entity <global::Testing.UParentOptional>().HasRequired(x => x.UChildRequired).WithOptional();

            modelBuilder.Entity <global::Testing.UParentRequired>().ToTable("UParentRequireds").HasKey(t => t.Id);
            modelBuilder.Entity <global::Testing.UParentRequired>().Property(t => t.Id).IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Testing.UParentRequired>().HasRequired(x => x.UChildRequired).WithRequiredDependent();
            modelBuilder.Entity <global::Testing.UParentRequired>().HasMany(x => x.UChildCollection).WithRequired().Map(x => x.MapKey("UParentRequiredUChildCollectionId"));
            modelBuilder.Entity <global::Testing.UParentRequired>().HasOptional(x => x.UChildOptional).WithRequired().WillCascadeOnDelete(true);

            OnModelCreatedImpl(modelBuilder);
        }
Esempio n. 18
0
 protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
 {
     modelBuilder.HasDefaultSchema(ConfigurationManager.AppSettings["DefaultSchema"]);
     base.OnModelCreating(modelBuilder);
 }
Esempio n. 19
0
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            if (this.TenantSchema != null)
            {
                #region User Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <User>()
                .ToTable("Users");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <UserAddressDetail>()
                .ToTable("UserAddressDetails");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <UserRoleMapping>()
                .ToTable("UserRoleMappings");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustomAddressDetail>()
                .ToTable("CustomAddressDetails");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <UserSecurityQuestion>()
                .ToTable("UserSecurityQuestion");

                #endregion

                #region Role Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <RoleMaster>()
                .ToTable("RoleMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <MenuMaster>()
                .ToTable("MenuMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AccessURL>()
                .ToTable("AccessURLs");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <RoleMenuMapping>()
                .ToTable("RoleMenuMappings");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <MenuGroupMaster>()
                .ToTable("MenuGroupMasters");

                #endregion

                #region Loan Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <Loan>()
                .ToTable("Loans");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <LoanDetail>()
                .ToTable("LoanDetails");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <LoanImage>()
                .ToTable("LoanImages");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <LoanSearch>()
                .ToTable("LoanSearch");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <LoanPDF>()
                .ToTable("LoanPDF");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <PurgeStaging>()
                .ToTable("PurgeStaging");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <PurgeStagingDetails>()
                .ToTable("PurgeStagingDetails");
                #endregion

                #region Customer Master Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustomerMaster>()
                .ToTable("CustomerMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <ReviewTypeMaster>()
                .ToTable("ReviewTypeMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <LoanTypeMaster>()
                .ToTable("LoanTypeMasters");


                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <ReviewPriorityMaster>()
                .ToTable("ReviewPriorityMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <DocumentTypeMaster>()
                .ToTable("DocumentTypeMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <DocumentFieldMaster>()
                .ToTable("DocumentFieldMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CheckListMaster>()
                .ToTable("CheckListMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CheckListDetailMaster>()
                .ToTable("CheckListDetailMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <RuleMaster>()
                .ToTable("RuleMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <StackingOrderMaster>()
                .ToTable("StackingOrderMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <StackingOrderDetailMaster>()
                .ToTable("StackingOrderDetailMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustomerConfig>()
                .ToTable("CustomerConfig");

                #endregion

                #region Mapping Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustReviewMapping>()
                .ToTable("CustReviewMapping");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustReviewLoanMapping>()
                .ToTable("CustReviewLoanMapping");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustLoanDocMapping>()
                .ToTable("CustLoanDocMapping");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustReviewLoanCheckMapping>()
                .ToTable("CustReviewLoanCheckMapping");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <CustReviewLoanStackMapping>()
                .ToTable("CustReviewLoanStackMapping");

                #endregion

                #region IntellaLend Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <WorkFlowStatusMaster>()
                .ToTable("WorkFlowStatusMaster");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <TenantMaster>()
                .ToTable("TenantMasters");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <ServiceConfig>()
                .ToTable("ServiceConfigs");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <EmailMaster>()
                .ToTable("EmailMaster");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AppConfig>()
                .ToTable("AppConfig");

                if (!this.TenantSchema.Equals(this.SystemSchema))
                {
                    modelBuilder.Entity <SystemReviewTypeMaster>()
                    .ToTable(String.Format("{0}.ReviewTypeMasters", this.SystemSchema));

                    modelBuilder.Entity <SystemLoanTypeMaster>()
                    .ToTable(String.Format("{0}.LoanTypeMasters", this.SystemSchema));
                }

                #endregion

                #region Master Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <SecurityQuestionMasters>()
                .ToTable("SecurityQuestionMasters");

                #endregion

                #region Audit Loan Tables

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AuditLoan>()
                .ToTable("AuditLoan");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AuditLoanDetail>()
                .ToTable("AuditLoanDetails");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AuditLoanMissingDoc>()
                .ToTable("AuditLoanMissingDoc");

                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <AuditLoanSearch>()
                .ToTable("AuditLoanSearch");

                #endregion

                #region BoxAPI
                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <BoxUserToken>()
                .ToTable("BoxUserToken");
                modelBuilder.HasDefaultSchema(this.TenantSchema).Entity <BoxDownloadQueue>()
                .ToTable("BoxDownloadQueue");
                #endregion
            }

            base.OnModelCreating(modelBuilder);
        }
 protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.HasDefaultSchema("ADMNALRRHH");
     // modelBuilder.Ignore<People>();
 }
Esempio n. 21
0
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.HasDefaultSchema("unknown");
 }
Esempio n. 22
0
 protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     modelBuilder.HasDefaultSchema("");
 }
Esempio n. 23
0
        /// <inheritdoc />
        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            OnModelCreatingImpl(modelBuilder);

            modelBuilder.HasDefaultSchema("dbo");

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Accommodation>()
            .ToTable("Accommodations")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Accommodation>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Accommodation>()
            .Property(t => t.Address)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Activity>()
            .ToTable("Activities")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Activity>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Activity>()
            .Property(t => t.Place)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.CustomItem>()
            .ToTable("CustomItems")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.CustomItem>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.CustomItem>()
            .Property(t => t.Key)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.CustomItem>()
            .Property(t => t.Value)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExchangeRate>()
            .ToTable("ExchangeRates")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExchangeRate>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExchangeRate>()
            .Property(t => t.FromCurrency)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExchangeRate>()
            .Property(t => t.ToCurrency)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExternalLink>()
            .ToTable("ExternalLinks")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExternalLink>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.ExternalLink>()
            .Property(t => t.URL)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Transportation>()
            .ToTable("Transportations")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Transportation>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Transportation>()
            .Property(t => t.Type)
            .IsRequired();

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .ToTable("Trips")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .Property(t => t.TripId)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .Property(t => t.Name)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .Property(t => t.DateFrom)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.Transportations)
            .WithRequired()
            .Map(x => x.MapKey("Trip.Transportations_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.Accommodations)
            .WithRequired()
            .Map(x => x.MapKey("Trip.Accommodations_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.Sightseeings)
            .WithRequired()
            .Map(x => x.MapKey("Trip.Sightseeings_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.ExchangeRates)
            .WithRequired()
            .Map(x => x.MapKey("Trip.ExchangeRates_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.WeatherForecasts)
            .WithRequired()
            .Map(x => x.MapKey("Trip.WeatherForecasts_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.Trips)
            .WithRequired()
            .Map(x => x.MapKey("Trip.Trips_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.ExternalLinks)
            .WithRequired()
            .Map(x => x.MapKey("Trip.ExternalLinks_Id"));
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.Trip>()
            .HasMany(x => x.CustomItems)
            .WithRequired()
            .Map(x => x.MapKey("Trip.CustomItems_Id"));

            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.WeatherForecast>()
            .ToTable("WeatherForecasts")
            .HasKey(t => t.Id);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.WeatherForecast>()
            .Property(t => t.Id)
            .IsRequired()
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.WeatherForecast>()
            .Property(t => t.Location)
            .IsRequired();
            modelBuilder.Entity <global::Tripplanner.DatabaseDesign.WeatherForecast>()
            .Property(t => t.LastTemperature)
            .IsRequired();

            OnModelCreatedImpl(modelBuilder);
        }