-1

Whenever there are any changes in table column the whole file generated by entity framework replaces all the code with auto generated one. Now I'm using partial class to avoid this problem, But now I have come across a situation where some list has to be initialized in constructor since there are no partial constructor this is not possible, Please suggest any work around to avoid code replace or to do it in a better way.

1 Answers1

0

Not really shure about that, but as i know you can use partial method OnCreate:

public partial class Entity1
    {
        partial void OnCreated()
        {
            //modify your entity here
        }
    }

It will fire when new entity is created

layonez
  • 1,746
  • 1
  • 16
  • 20