using (NorthwindEntities db = new NorthwindEntities()) {

var customer1 = (from c in db.Customers
where c.CustomerID == "ALFKI"
select c).AsEnumerable().First();

Console.WriteLine("Zkaznk 1, ContactName: {0}", customer1.ContactName);
Console.WriteLine("Zkaznk 1, state: {0}", customer1.EntityState);

customer1.ContactName = "Maria Anders - Changed";

Console.WriteLine("Zkaznk 1, ContactName: {0}", customer1.ContactName);
Console.WriteLine("Zkaznk 1, state: {0}", customer1.EntityState);

var customer2 = (from c in db.Customers
where c.CustomerID == "ALFKI"
select c).AsEnumerable().First();

Console.WriteLine("Zkaznk 2, ContactName: {0}", customer2.ContactName);
Console.WriteLine("Zkaznk 2, state: {0}", customer2.EntityState);

db.SaveChanges();

Console.WriteLine("Zkaznk 1, state: {0}", customer1.EntityState);
Console.WriteLine("Zkaznk 2, state: {0}", customer2.EntityState);
Console.WriteLine("Zkaznk 1, HashCode: {0}", customer1.GetHashCode());
Console.WriteLine("Zkaznk 2, HashCode: {0}", customer2.GetHashCode());

Console.WriteLine("Odpovd zkaznk 1 zkaznkovi 2? {0}",
	customer1.Equals(customer2));
}
