views:

100

answers:

1

I would like to look at and modify the information submitted via the PUT verb inside a changeInterceptor.

For instance I might want to scrub all values passed in before updating my dataSource.

Or maybe I could call a Data Service via java script and not pass in all the current properties on the object rather complete there values on the server.

Soo...

OnChangeMyObject<MyObject,Update...>{
   if(UpdateOperations == UpdateOperations.change){
     MyObject == the object to be updated but not the object passed in from the 
     caller. How can I access the object from the caller?
   }
}
A: 

I think you could do something like this in your change interceptor:

if (operations == UpdateOperations.Change)
{
  CurrentDataSource.SavingChanges += (o,e) => ValidatePutData(yourEntityObject);
}

Where the method ValidatePutData checks the changed object data. The method will be called when the EF saves your changes. At that point in time the instance of entity object contains the new data which was transmitted with the PUT reqest.