Wednesday, September 19, 2012 2:54 PM
our Oracle-database uses sequences to generate the primary keys. In our Hibernate-Solution they do it like this:
<class name="SomeClass" table="SomeTable"> <id name="Id" column="SC_ID" type="Int64"> <generator class="sequence"> <param name="sequence">SQ_SC_ID</param> </generator> </id>
I am playing a little with Code First and Fluent Configuration. How can specify this in EF?
Tnx - daProgramma
Friday, September 21, 2012 8:55 AMModerator
Friday, September 21, 2012 1:25 PM
tnx for the answer. But it does not help - DatabaseGenerationOption.Identity says that the database will generate the value. This is not what I want. I need to use a Sequence to get the value for my PK.
I found that this is not possible with EF. What I now do is that when creating an Entity I manually query the sequence and use the value as PK. Of course, this works with DatabaseGeneratedOption.None.
Not nice - but works for the moment.
Tuesday, September 25, 2012 8:54 AMModerator
I think you can submit this feature request here: http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by daProgramma Tuesday, September 25, 2012 3:04 PM