ironcev / Pragmatic

[The description is yet to come]
5 stars 3 forks source link

Add support for custom id generation function #2

Closed mroncev closed 10 years ago

mroncev commented 10 years ago

Currently, new entity Id is always generated by calling the Guid.NewGuid() method. Can you add options to override this default behaviour, maybe something like:

protected virtual Func{Guid} IdGenerator

Default behaviour can be Guid.NewGuid(). Id generator for Guid.NewGuidComb() can be also added within the library as another useful id generator.

ironcev commented 10 years ago

Hi mroncev,

The requested support is added, but not via protected virtual method. I wanted to avoid calling virtual methods in constructor. Please take a look at the Example project to see how to customize Entity id generation based on Entity type.

BR Igor