I'm migrating from SubSonic to EF4. In SubSonic models had a function called Save, if the key of the model was 0 an insert was done, otherwise an update.
Is there a way to make a generic Save function like in SubSonic? For exmaple using an extension method?
Yes but you have to do it yourselves. Try something like this:
I think a little bit better version will be public static void SaveOrUpdate(this T entity) where T : IEntity