This project has moved. For the latest updates, please go here.

EF API: Constructors on model creation?

Nov 22, 2013 at 6:23 AM
Is there a way to automatically invoke a model's constructor, or fire some sort of OnCreated event when a model is created? I only see a method that fires when a property is changed, so I'm guessing there isn't much here yet. I would be happy to contribute pull requests for smaller things like this.

Thank you.
Coordinator
Nov 22, 2013 at 7:57 AM
Hi,

There isn't any way to do that currently - some sort of OnCreated event would be a nice addition. If you have chance to create a pull request for it, that would be much appreciated!

Cheers

Kal


Nov 23, 2013 at 5:46 AM
Coordinator
Nov 23, 2013 at 2:21 PM
Hi Nuzz,

Thanks for the pull request! I made a slight tweak so that the event gets raised from the BrightstarEntityObject constructor - this means that it also now gets raised when the developer uses the entity constructor directly (e.g. var p = new Person(); ). I added a guard so that it doesn't get invoked when just binding entities that are retrieved through linq queries, so the OnCreated event really means that a new entity is being created.

The changes are now pushed to the develop branch.

Cheers

Kal