locked
Dynamic Updates in Entity Framework RRS feed

  • Question

  • I am trying to port some existing LINQ to SQL (LTS) models over to EF. One of the facilities I have used extensively in LTS is the pre/post trigger facility offered by the InsertXXX/UpdateXXX/DeleteXXX partial methods where XXX refers to the entity.
    Is there any way to simulate their behaviour (ExecuteDynamicInsert/Update/Delete) in the EF or (even better) any plan to include a facility along these lines in the EF RTM?

    Regards,

    Dimitris Foukas


    Saturday, March 8, 2008 9:19 AM

Answers

  • Unfruntately the EF does not support the same set of partial methods that LINQ to SQL does, and there are not InsertXXX/UpdateXXX/DeleteXXX partial methods. There is an event on the ObjectContext called "SavingChanges" which is the only provided hook for intercpeting entities prior to them being saved to the backend store.

     

    I will be sure to add this capability to our list of DCRs. One of the big pushes for the next full version of the Entity Framework, will be better parity between EF and LINQ to SQL.

     

    Jeff

    Monday, March 10, 2008 2:32 AM

All replies

  • Unfruntately the EF does not support the same set of partial methods that LINQ to SQL does, and there are not InsertXXX/UpdateXXX/DeleteXXX partial methods. There is an event on the ObjectContext called "SavingChanges" which is the only provided hook for intercpeting entities prior to them being saved to the backend store.

     

    I will be sure to add this capability to our list of DCRs. One of the big pushes for the next full version of the Entity Framework, will be better parity between EF and LINQ to SQL.

     

    Jeff

    Monday, March 10, 2008 2:32 AM
  • Jeff,

    Thanks for the commitment to bring the APIs on a par...
    While on this subject is it too much to ask for enum type support in the EF RTM?
    I am aware of the fact that the EF FAQ contains a stmt against this but I think that supporting enums will greatly improve our migration experience with very little implementation cost on your part.

    Dimitris
    Wednesday, March 12, 2008 7:12 AM