Reputation: 170
I have a problem when I add an entity object with ObjectContext.AddObject method because I can't retrieve that object with LINQ querying my ObjectContext.Person entities. I know that this new added object is stored somewhere, because it is used to update database after SaveChanges method. That's bothers me because I want to update my datagrid DataContext without saving changes unless I really want to do it. It doesn't help if I add the same object to DataContext list myself directly. Also, when I call DeleteObject method it just marks object for deleting but I have to find it an remove it from DataGrid and retrieve if I cancel changes.
Upvotes: 0
Views: 516
Reputation: 126557
If you add an object to your ObjectContext
and want to retrieve it without querying the database, you can use ObjectContext.GetObjectByKey.
Your second question is unclear to me.
Upvotes: 2