Last post Aug 19, 2014 10:13 PM by George Hua - MSFT
Aug 12, 2014 08:42 AM|Raj4MS|LINK
public Customer function1()
var customer = _context.Customers.FirstOrDefault();
I am passing this customer object to another function
public void function2()
var cust = function1();
_context.SaveChanges();//Does the name gets updated after save changes.
Aug 12, 2014 09:06 AM|PatriceSc|LINK
What is the return value for SaveChanges? Is it 0 or 1 ? Also make sure that _context was not changed between those calls (ie that this is still the same object than the one you used to read the object from the db).
Sometimes it can be also that the db which is updated is not the one you think especially if you are working with a database file location rather than just a server/db name...
Aug 12, 2014 09:49 AM|ryanbesko|LINK
where are you calling _context.Entry(cust).EntityState = EntityState.Modified? This needs to get called before you call _context.SaveChanges(), or nothing will be saved.
Aug 19, 2014 10:13 PM|George Hua - MSFT|LINK
For additional information, please take a look at:
context.SaveChanges not working
Attaching and Detaching Objects