rasel,
In the earlier post you were actually creating 2 entities with the same ID. (i.e. not modifying the entity the second time around)
In that case, you will get a save exception. (unless the IDs are being resolved at the datasource level)
If you want to modify an entity, it must exist in the datasource first. So you'd need to retrieve it, make the changes, and then save back to the datasource:
var testEm = new boolEntities(compositionContextName: CompositionContext.Fake.Name);
var testProducts = new Product[] {
new Product {ProductID = 0, Name = "test", Description = "tesr", Price = 12, Category = "test"} };
testEm.AddEntities(testProducts);
testEm.SaveChanges();
testEm.Clear();
var prod = testEm.Products.FirstOrDefault(p => p.ProductID == prod.ProductID);
prod.Description = "test";
SaveResult sr = testEm.SaveChanges(new Product[] {prod});
I suggest you visit our
DevForce Resource Center. There you will have access to several articles and samples that will help better understand how DevForce works.
Regards,
Silvio.