I intend to extend the constructors of some of the entities in my Entity Framework (4).
However how do I ensure that my constructor is run after the model has run its. i.e. I want to ensure that the the object holds the data from the database before I work on it in my constructor.
There is no generated constructor besides the default one; the objects are created via a factory method, and are simply initialized after construction.
You can write your own default constructor, and the generated code will call it before initializing all of the generated properties. If you write your own non-default constructor, you will also have to write your own default constructor, or else the designer file will not compile, since it assumes a default constructor exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With