Does the Entity Framework 4 support generators for id values like NHibernate? NHibernate has generator classes to help with this.
views:
125answers:
2
+3
A:
EF4 supports whatever the back-end server supports:
- IDENTITY columns or GUID columns with default values (newid(), newsequentialid()) in SQL Server
- Sequences in Oracle
- whatever other mechanism the target database might provide
EF4 itself doesn't have any built-in support for generators of any kind, as far as I know.
I'm not sure if making this the ORM's responsibility is a good idea, quite honestly. This should really be left to the backend store to handle, in my opinion.
However, you should have no trouble implementing your own custom ID generator in .NET code, and plug that into EF4, if you wish to do so.
marc_s
2010-03-09 13:12:20
A:
I am interested to know the entry points to implement a custom id generator. It is usefull at least in two cases I know about: * unique ids independently from the tables thus types * sharding and automatic detection of the shard based on information stored within the id.
Thank you.
Hicham B.
2010-09-06 20:45:31