コード例 #1
0
        public void DemoVanVeelOpVeelRelatie()
        {
            using (var context = new TailSpinToysContext())
            {
                var store = new Store
                {
                    Name = "Bart Smit",
                    Address = new Address
                    {
                        City = "Veenendaal",
                        Zip = "3906LE"
                    },

                };

                var supplier = new Supplier
                {
                    Name = "Fisherprice",
                    Address = new Address
                    {
                        City = "Birmingham",
                        Zip = "1234"
                    },

                    Stores = new List<Store> { store }
                };

                store.Suppliers = new List<Supplier> { supplier };
                context.Stores.Add(store);

                context.SaveChanges();
            }
        }
コード例 #2
0
 public void ShowMeTheDefaultTPH()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new ExpensiveToy {
             Name = "Gold Plated Helicopter", Price = 500m, Commission = 3
         });
         context.SaveChanges();
     }
 }
コード例 #3
0
 public void TestMethod1()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new Toy {
             Name = "Helicopter", Price = 5m
         });
         context.SaveChanges();
     }
 }
コード例 #4
0
        public void DemoVanConcurrencyAttribute()
        {
            using (var context = new TailSpinToysContext())
            {
                context.Toys.Add(new Toy
                {
                    Name = "Lego", Price = 19.99m
                });

                context.SaveChanges();

                Thread.Sleep(15000);
                var toy = context.Toys.First();
                toy.Name = "Lego City";

                context.SaveChanges();
            }
        }
コード例 #5
0
        public void DemoVanConcurrencyAttribute()
        {
            using (var context = new TailSpinToysContext())
            {
                context.Toys.Add(new Toy
                {
                    Name = "Lego", Price = 19.99m
                });

                context.SaveChanges();

                Thread.Sleep(15000);
                var toy = context.Toys.First();
                toy.Name = "Lego City";

                context.SaveChanges();
            }
        }
コード例 #6
0
 public void DemoVanForeignKeyRelaties()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new ExpensiveToy
         {
             Name = "Gold Plated Helicopter",
             Price = 500m,
             Commission = 3,
             Supplier = new Supplier
             {
                 Name = "Fisherprice",
                 Address = new Address
                 {
                     City = "Birmingham",
                     Zip = "1234"
                 }
             }
         });
         context.SaveChanges();
     }
 }
コード例 #7
0
 public void DemoVanForeignKeyRelaties()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new ExpensiveToy
         {
             Name       = "Gold Plated Helicopter",
             Price      = 500m,
             Commission = 3,
             Supplier   = new Supplier
             {
                 Name    = "Fisherprice",
                 Address = new Address
                 {
                     City = "Birmingham",
                     Zip  = "1234"
                 }
             }
         });
         context.SaveChanges();
     }
 }
コード例 #8
0
        public void DemoVanVeelOpVeelRelatie()
        {
            using (var context = new TailSpinToysContext())
            {
                var store = new Store
                {
                    Name    = "Bart Smit",
                    Address = new Address
                    {
                        City = "Veenendaal",
                        Zip  = "3906LE"
                    },
                };

                var supplier = new Supplier
                {
                    Name    = "Fisherprice",
                    Address = new Address
                    {
                        City = "Birmingham",
                        Zip  = "1234"
                    },

                    Stores = new List <Store> {
                        store
                    }
                };

                store.Suppliers = new List <Supplier> {
                    supplier
                };
                context.Stores.Add(store);

                context.SaveChanges();
            }
        }
コード例 #9
0
 public void TestMethod1()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new Toy { Name = "Helicopter", Price = 5m });
         context.SaveChanges();
     }
 }
コード例 #10
0
 public void ShowMeTheDefaultTPH()
 {
     using (var context = new TailSpinToysContext())
     {
         context.Toys.Add(new ExpensiveToy { Name = "Gold Plated Helicopter", Price = 500m, Commission = 3 });
         context.SaveChanges();
     }
 }