Entity Framework - how to chose a sequence for entity's key?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
hpn
Posts: 3
Joined: Thu 21 Aug 2008 09:16

Entity Framework - how to chose a sequence for entity's key?

Post by hpn » Tue 02 Sep 2008 09:26

Hi there

I cannot find any way on how to choose oracle sequence responsible for generating identity of given entity, any ideas?

thanks
hpn

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 02 Sep 2008 11:34

You should follow this instruction:

1. Import table in EDM Wizard (some field values of table were set with trigger). Generate a *.edmx file.
2. Open this *.edmx in XML-editor, in the CSDL part of the file set StoredGeneratedParttern="Identity" for updatable columns.
As a result, the field value will be updated after the insert command.

hpn
Posts: 3
Joined: Thu 21 Aug 2008 09:16

Post by hpn » Tue 02 Sep 2008 12:34

I don't think I understand - what I need is a way to tell the EF to use a given oracle sequence to fill the ID value (without using a trigger), is it possible?

thanks
HP

hpn
Posts: 3
Joined: Thu 21 Aug 2008 09:16

Post by hpn » Tue 02 Sep 2008 12:52

To clear the things a bit further - some ORMs assume, that the sequence name is the same as the name of the table - which is not the case in my situation, so I either have to tell EF to use such and such sequence for such and such table, or set it manually, if it's not supported (I guess EF alone doesn't support it, since it's sqlServer centric, but maybe oraDirect can do it behind the scenes?).

thanks for any info
HP

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 02 Sep 2008 15:44

Entity Framework is database independent. And it doesn't understand such object as "sequence". Further development of Schema Modeler (Entity Framework integration) will provide more ORM functionality. Probably, this feature will be supported also.

Post Reply