This question is locked. New answers and comments are not allowed.
Hi all,
I want to write a generic update method to update any of my entity.
I want to pass the updated entity to that function say user so i will pass the updated user object and now i want that updated object to be persisted in the database.
So how to do this and remember the update method should be generic. In my situation i have million of similar updates so i dont want to write that code by hand , my create method looks like this , similar generic method iwant for update as well
I want to write a generic update method to update any of my entity.
I want to pass the updated entity to that function say user so i will pass the updated user object and now i want that updated object to be persisted in the database.
So how to do this and remember the update method should be generic. In my situation i have million of similar updates so i dont want to write that code by hand , my create method looks like this , similar generic method iwant for update as well
| public void Create(T item) |
| { |
| using (var scope = ObjectScopeProvider1.GetNewObjectScope()) |
| { |
| scope.Transaction.Begin(); |
| scope.Add(item); |
| scope.Transaction.Commit(); |
| } |
| } |