EntityFramework, Oracle, and Guid as PrimaryKey - HOWTO?

EntityFramework, Oracle, and Guid as PrimaryKey - HOWTO?

Postby BadOracle » Wed 27 May 2009 14:31

My company is probably getting a big deal with another company, which requires us to use an oracle-db instead of SQLServer 2008.

I am looking right now for an Entity Framework Provider which fits our needs. Your product looks very promising though.

I am absolutely new to Oracle databases.

How do you create a table with GUID/uniqueidentifier as primary-key?
I read about raw(32), raw(32), varchar(32),varchar(36) etc.
There is a function called SYS_GUID() which seemd to work.

The db i have created worked with generated guids,too.
But when i added them to the Entity Framework i got this problems:

Message 2 The table/view 'Catalog1.WPC.PROJECT' has column 'PROJECT_ID' defined as a primary key, but the column type 'RAW' is not a valid type for a key in EDM. An attempt will be made to define the table/view as a read-only table/view.

So my question would be, how to do it? Is it possible?

Strange new world these oracle databases... The most important thing i noticed is that they really like CAPS_LOCK.....

Thx for your help!
Posts: 1
Joined: Wed 27 May 2009 14:20

Postby robymes » Wed 27 May 2009 15:04

Guid in Oracle is RAW(16), if you set a primary key field in this way, when you update from the Entity Framework designer, automatically it recognizes the RAW(16) field type and will map it Guid in you entity class.
Posts: 29
Joined: Tue 09 Sep 2008 09:46

Return to dotConnect for Oracle