This is a migrated thread and some comments may be shown as answers.

Reverse Map Views

2 Answers 99 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick Wood
Top achievements
Rank 1
Nick Wood asked on 15 Mar 2010, 05:55 AM
Hi There

how can we reverse map a view without a primary key. In most cases, views are combinations of other tables and may or may not have a primary key for the view, but I keep getting "No primary key errors".

How can I get arround this?

2 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 15 Mar 2010, 04:22 PM
Hello Nick Wood,

I am afraid this is not possible at the moment. It is a requirement of the OpenAccess' runtime that each class has an identity field. Note that it is not required that the column mapped to the identity field should be a primary key. However, if there are duplicating values in that column, you will get duplicating results when executing a query (e.g. instead of retrieving three different objects you will get the first one three times) due to the caching mechanism. To avoid such behavior you can mark as identity several fields that form a combination which identifies each row uniquely. Hope that helps.

Kind regards,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sergej Mertens
Top achievements
Rank 1
answered on 15 Mar 2010, 04:36 PM
Hi Nick,

check this out: http://blogs.telerik.com/openaccessteam/posts/09-07-13/reverse_mapping_and_using_database_views_with_telerik_openaccess_orm.aspx

Especially: "... Note that views without primary key columns are not currently supported..."
and
 "... NOTE: It is user’s responsibility to set a real primary key – in the case where no real identity column is included in the view, you should use a composite key developed by including multiple columns from the available, trying to produce unique combination – usually meaning that all of the columns should be marked as such. ..."

Greetings,
Daniel
Tags
General Discussions
Asked by
Nick Wood
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Sergej Mertens
Top achievements
Rank 1
Share this question
or