Hello to all,
I am encountering a problem while I update an entity fields and want to save it back to database.
I am using Entity Framework as DAL and have designed a Repository to access the Entity objects.
Database will show that a record has been saved but if I want to update the record it will not show the new data.
InvoiceGeneratorEntities context = new InvoiceGeneratorEntities();
var test = context.CompanyInformation.First();
test.ContactName = "123";
context.AcceptAllChanges();
context.SaveChanges();
//retrieve
var test1 = context.CompanyInformation.First();
MessageBox.Show(test1.ContactName);
if we assume I have a CompanyInformation Entity the above code will not change its state.
Do anybody get around such this problem before or is aware of the solution?
Thanks in advance