예제 #1
0
 public void InsertionFonctionnelle()
 {
     Database.SetInitializer(new DropCreateDatabaseAlways<CompanyContext>());
     Customer quentin = new Customer();
     quentin.City = "Moustier";
     CompanyContext context = new CompanyContext(@"Data Source=vm-sql.iesn.be\stu3ig;Initial Catalog=DBIG3B3;User ID=IG3B3;Password=pwUserdb66");
     context.Customers.Add(quentin);
     context.SaveChanges();
     TestMethod2();
 }
예제 #2
0
        public void DetecteLesEditionsConcurrentes()
        {
            var contextedeJohn = new CompanyContext();
            var clientDeJohn = contextedeJohn.Customers.First();

            var contextedeSarah = new CompanyContext();
            var clientDeSarah = contextedeSarah.Customers.First();

            clientDeJohn.AccountBalance += 1000;
            contextedeJohn.SaveChanges();

            clientDeSarah.AccountBalance += 2000;
            contextedeSarah.SaveChanges();
        }