views:

985

answers:

1

We are using L2E and REST in our project, and while I have been able to retrieve data from the db without issue, I am still not able to update or add new records to the db. I imagine that it's a syntax problem (we're still new to to linq), but I haven't been able to figure it out. We initially load the data in the dataservicecontext, and when updates are made they are stored in the CurrencyManager.Current of the binding source. However, when I call SaveChanges nothing gets modified in the db, and I don't know why.

For example,

Loading the data:

 var customerQuery = Program.Proxy.Customers.Where(p => p.ContactId == g);

Saving the data:

 Program.Proxy.SaveChanges();

I've confirmed that the updated copy of the entity in memory is being tracked, so I don't need to call AddObject, but I get an error ("The closed type Lynxphere.WindowsClient.LynxphereDataServices.Customers does not have a corresponding Customers settable property.") if I try to call AddLink. And I'm not even sure if this step is necessary. Help would be greatly appreciated.

A: 

Have a look on my repository pattern with a Save() function, published in the project below. There is a EntityProductRepository implemented. That might help you to do the Updates and Inserts correctly.

openticket.codeplex.com

Glenn