Entity Key mapping bug

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Entity Key mapping bug

Post by danielliu8 » Fri 26 Jun 2009 17:36

Hi,

I have a problem to use "ADO.Net Entity Data model" and "dotConnect for Oracle" to create Model.edmx.

If any of columns in Oracle 10g tables is not Nullable, that column in Model.edmx will be a Entity Key.

Most of columns in our Oracle Tables do not accept null value, so all those columns in .edmx are Entity Key, we could not update any of those columns from Entity Frameworks project. Here is the error:

The property 'DESCR' is part of the object's key information and cannot be modified


But we could update them in Oracle directly.

Would you tell how to fix these false Entity Key bug?

thanks

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Entity Key mapping bug

Post by danielliu8 » Mon 29 Jun 2009 17:31

Hi,

Any one could help for this problem?
:?:
Thanks

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Entity Key mapping bug

Post by danielliu8 » Mon 29 Jun 2009 19:52

Hi,

Please help us for this problem ASAP.

We bought dotConnect for Oracle to build a asp.net web appplication to talk to PeopleSoft/Oracle 10g, we could not change the columns in Oracle table to nullable.

Your timely response will be much appreciated.

thanks

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 30 Jun 2009 06:51

It seems you don't have a Primary Key defined in your model, the default Entity Framework behaviour in this case is to generate the Entity Key over all not nullable columns.
You have several ways to deal with the problem:
1. Modify your database objects to contain the explicit Primary Key.
2. Modify the storage part of the generated model with XML Editor. Please note that this way is not very reliable, because running Update model from database wizard will discard the changes.
3. Use Entity Developer to generate Devart Entity model. Our model supports editing the Store part of Entity Framework model. Also, if you have a unique index, in case of Primary Key absence the key will be generated over it.

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Tue 30 Jun 2009 15:59

Thanks for your reply.

Here is our real case:

1. Modify your database objects to contain the explicit Primary Key.

There are composite keys in most of PeopleSoft/Oracle 10g tables, we could not change it.

2. Modify the storage part of the generated model with XML Editor. Please note that this way is not very reliable, because running Update model from database wizard will discard the changes.

This seems not a good option.

3. Use Entity Developer to generate Devart Entity model. Our model supports editing the Store part of Entity Framework model. Also, if you have a unique index, in case of Primary Key absence the key will be generated over it.

I generated .edmx file from Entity Developer, I could edit the Entity Key property in store part and class part.

But When I add Existing Items to my VS2008 Project, only .edml file added, no edmx file. I am not sure how to use edml file in my asp.net project.

Would you please tell the detail tutorial for how to use .edml file?

Thanks for your prompt help!
Last edited by danielliu8 on Tue 30 Jun 2009 22:56, edited 3 times in total.

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Tue 30 Jun 2009 21:34

Hi,

I double checked our Oracle tables, we don't have a Primary Key defined in any tables, but we have unique index on some of our comlumns, and most of our columns are not nullable columns.

Is is possible to generate the Entity Key over all the unique indexed columns only? It is not right to generate the entity key on not nullable columns.

Please reply ASAP.

Thanks

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 01 Jul 2009 08:47

Add the .edml file to your ASP.NET project to your App_Code folder.
The only problem so far is the lack of design-time support for EntityDataSource, we are working on it.
In all runtime aspects the .edml file repeats the functionality of the .edmx file.

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Wed 01 Jul 2009 17:13

We have separate class projects to hold the edmx files.

Here is the details what I did:

1.
Add all the existing files which generated from Entity Developer to class project,
2.
Compile class project, failed. I deleted .cs file, keep the designer.cs file, compile success.
3.
Add class project referances to web project, pluralizes all the class names(another bug!).
Compile success finally.

But web project runs failed!
Here is the error:

The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.


I read all your documentations, and post on your forum, but still could not solve this kind of basic function problem.

Quite Frustrated with your poorly documentation and slow response.

Would you please reply within same day???

Thanks for your help.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 02 Jul 2009 07:55

This problem was already discussed at our forums.
Please take a look at this post:
http://devart.com/forums/viewtopic.php?t=14973

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Thu 02 Jul 2009 16:41

Thanks, Andrey.

It cost too much time to use it now, we will stop using Entity Developer until your new release available.

One important request to your manage team:

None-primary key table and not-nullable columns are basic PeopleSoft database design.

Only if your team could remove the entity key for all the not-nullable columns in your new release, PeopleSoft users would be able to use your products.

Please notify once your new release ready to download.

Thanks a lot.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 03 Jul 2009 09:43

I have made some tests using the current 2.0.21 build of Entity Developer and succeeded in generation of Entity Keys over the unique keys in the database.
Please send me a script of the objects you experience the wrong behaviour with.

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Mon 06 Jul 2009 16:24

I have no problem on generating of Entity Keys over the unique keys in the database, my only problem is generating Entity Keys over not-nullable columns.

To reproduce the problem:
You could create a oracle table without primary key, all the columns not-nullable. It will create entity keys on all the columns automatically.

Please let me know.

thanks

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 08 Jul 2009 13:11

Sorry, but this is a default behaviour of the Entity Framework.
If the table does not have Primary Key defined (or at least Unique Key, if you use Entity Developer),
the Entity Key will be generated using all not null columns. This is because every Entity must have an Entity Key defined.

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Wed 08 Jul 2009 15:51

We have Unique keys on all the PeopleSoft tables, and most of columns are not-null columns.

It is right to generate Entity Keys on Primary Key or Unique keys, but it does not make sense to generate Entity keys on all the not-null columns.

not-null columns should not be the Entity Keys.

Thanks

danielliu8
Posts: 33
Joined: Wed 17 Jun 2009 22:59
Location: ca

Post by danielliu8 » Wed 08 Jul 2009 16:08

Hi,

Since this bug seems not a quick fix for your company. We need to finish our project by deadline.

Would you tell the details for your Suggestion 2:
" Modify the storage part of the generated model with XML Editor. "?

Would you please show the detail tutorial how to Modify the storage part of the generated model with XML Editor?

Thanks

Post Reply