Hi,
I am using an ObjectDataSource with a GridView in ASP.NET 2.0 and letting the ODS automatically update and delete the object by setting the UpdateMethod and DeleteMethod properties along with the DataObjectTypeName property.
So, my service layer has 2 methods like below:
Code:
public static void Update(Customer customer)
public static void Delete(Customer customer)
It appears that when I update an object via the GridView, a Customer object is being instantiated and then all the properties are being set (including the key) before my Update method is called. The session must look at the key and know what to do with this object because it is being updated correctly in the DB.
When an object is being deleted via the GridView, a Customer object is being instantiated and just the key property is being set before my Delete method is called. Again, the session is able to deal with this and delete the object from the DB.
Is it safe to let it operate this way or should the object really be loaded via the session first before Session.Update or Session.Delete are called?
Thanks,
Jason