none
Problem with EF 6 in Property Change Event RRS feed

  • Question

  • Am using Visual Studio 2013(C#) and Entity Framework 6.1 installed with SQL server 2008 r2, Working on important project which includes number of trasactions.

    Previously build few classes with EF 4.0 but recently updated to EF 6 facing a problem while building. (Model first approach)

    Following are my few doubts:

    1. PropertyChangeEvent in EF 6 not available. Is there any other event respective to the same??

    2. T4 template code generation ?

    3. How to implement Business logic in Partial class with EF6 ?

    Friday, July 4, 2014 6:45 AM

Answers

  • Hello,

    >>1. PropertyChangeEvent in EF 6 not available. Is there any other event respective to the same??

    PropertyChangedEvent in EF6 is not available because the code generator uses the designed T4 template which does not provide this event.

    If you want to still work with ObjectContext which has this event in EF 6, you could right click on the Code Generations Strategy and click ReSet, and you need to delete the context.tt and .tt files or it throws errors. Please take care this way is irreversible that means you cannot change your context class derived from DbContext.

    Or you can use the Generator which generates a legacy ObjectContext class and non-POCO entity classes:

    http://visualstudiogallery.msdn.microsoft.com/66612113-549c-4a9e-a14a-f629ceb3f89a

    If you want to work with DbContext and let it implement this event, you may need to modify this T4 template which I think it is not easy.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 7, 2014 7:24 AM
    Moderator

All replies

  • Hello,

    >>1. PropertyChangeEvent in EF 6 not available. Is there any other event respective to the same??

    PropertyChangedEvent in EF6 is not available because the code generator uses the designed T4 template which does not provide this event.

    If you want to still work with ObjectContext which has this event in EF 6, you could right click on the Code Generations Strategy and click ReSet, and you need to delete the context.tt and .tt files or it throws errors. Please take care this way is irreversible that means you cannot change your context class derived from DbContext.

    Or you can use the Generator which generates a legacy ObjectContext class and non-POCO entity classes:

    http://visualstudiogallery.msdn.microsoft.com/66612113-549c-4a9e-a14a-f629ceb3f89a

    If you want to work with DbContext and let it implement this event, you may need to modify this T4 template which I think it is not easy.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 7, 2014 7:24 AM
    Moderator
  • Thank you very much Fred.

    VBA7

    Monday, July 14, 2014 8:42 AM