示例#1
0
    static void Main()
    {
        using (NorthwindEntities northwindEnteties = new NorthwindEntities())
            {
                var person = northwindEnteties.Employees.FirstOrDefault(e => e.EmployeeID == 11);
                person.FirstName = "AAAAA";

                northwindEnteties.SaveChanges();
            }

            using (SecondContext.SecondContextEntities northwindEnteties2 = new SecondContext.SecondContextEntities())
            {
                var person = northwindEnteties2.Employees.FirstOrDefault(e => e.EmployeeID == 11);
                person.FirstName = "DDDD";
                northwindEnteties2.SaveChanges();
            }
    }
示例#2
0
    static void Main()
    {
        using (NorthwindEntities northwindEnteties = new NorthwindEntities())
        {
            var person = northwindEnteties.Employees.FirstOrDefault(e => e.EmployeeID == 11);
            person.FirstName = "AAAAA";

            northwindEnteties.SaveChanges();
        }

        using (SecondContext.SecondContextEntities northwindEnteties2 = new SecondContext.SecondContextEntities())
        {
            var person = northwindEnteties2.Employees.FirstOrDefault(e => e.EmployeeID == 11);
            person.FirstName = "DDDD";
            northwindEnteties2.SaveChanges();
        }
    }