use of a generator sequence
-
Wednesday, September 19, 2012 2:54 PM
Hello,
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
All Replies
-
Friday, September 21, 2012 8:55 AMModerator
Hi DaProgramma,
Welcome to the MSDN forum.
Please check the [Key] and [DatabaseGenerated(DatabaseGenerationOption.Identity)] Data Annotation in this page: http://msdn.microsoft.com/en-us/data/jj591583
Have a nice day.
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us
-
Friday, September 21, 2012 1:25 PM
Howdy,
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.
daProgramma
-
Tuesday, September 25, 2012 8:54 AMModerator
Hi DaProgramma,
I think you can submit this feature request here: http://data.uservoice.com/forums/72025-ado-net-entity-framework-ef-feature-suggestions
Good day.
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by daProgramma Tuesday, September 25, 2012 3:04 PM

