Esempio n. 1
0
 public static void CreateDB()
 {
     using (InheritanceMappingContext db = new InheritanceMappingContext()) {
         if (!db.Database.Exists())
         {
             db.Database.Initialize(true);
             db.Database.CreateIfNotExists();
             db.Dispose();
         }
     }
 }
Esempio n. 2
0
        public static void AddBankAccount()
        {
            CreateDB();
            InheritanceMappingContext db = new InheritanceMappingContext();

            db.BillingDetails.Add(new BankAccount()
            {
                Number   = "10",
                NumberA  = 10.ToString(),
                Owner    = "me",
                BankName = "Nordea",
                Swift    = "3333"
            });
            db.SaveChanges();
            db.Dispose();
        }
Esempio n. 3
0
        public static void AddCreditCard()
        {
            CreateDB();
            InheritanceMappingContext db = new InheritanceMappingContext();

            db.BillingDetails.Add(new CreditCard()
            {
                CardType    = 1,
                ExpiryMonth = "Feb",
                ExpiryYear  = "2020",
                Number      = "10",
                NumberA     = 10.ToString(),
                Owner       = "me"
            });
            db.SaveChanges();
            db.Dispose();
        }