Example #1
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <tblCountryMaster>().HasIndex(c => new { c.CountryName }).IsUnique();
            modelBuilder.Entity <tblStateMaster>().HasIndex(c => new { c.CountryId, c.StateName }).IsUnique();
            modelBuilder.Entity <tblStateMaster>().Property(o => o.longitude).HasColumnType("decimal(18,14)");
            modelBuilder.Entity <tblStateMaster>().Property(o => o.latitude).HasColumnType("decimal(18,14)");
            modelBuilder.Entity <tblPaymentRequest>().Property(p => p.Status).IsConcurrencyToken();

            DefaultData defaultData = new DefaultData(modelBuilder);

            modelBuilder.Entity <tblCustomerBalance>(entity => entity.HasCheckConstraint("CK_tblCustomerMaster_WalletBalance", "WalletBalance >= 0"));
            modelBuilder.Entity <tblCustomerBalance>(entity => entity.HasCheckConstraint("CK_tblCustomerMaster_CreditBalance", "CreditBalance >= 0"));

            defaultData.InsertRoleClaim();
            defaultData.InsertCustomerMaster();
            defaultData.InsertUser();
            defaultData.InsertAirport();
            defaultData.InsertAirline();
            defaultData.InsertServiceProvider();
            defaultData.InsertBank();


            #region ************** Remove Default Identity Columns *******************
            modelBuilder.Entity <tblCustomerBalance>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerGSTDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerIPFilter>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerBankDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerPanDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerMarkup>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblWalletBalanceAlert>().Property(et => et.CustomerId).ValueGeneratedNever();
            #endregion
        }