I am trying to retrieve an object to allow me to update it but get the following error message:
Telerik.OpenAccess.Exceptions.MetadataException: The field 'appraisalAssignment' of class 'EMS.DAL.Appraisal' must use nested db-column extensions in a db-ref extension as the class 'EMS.DAL.AppraisalAssignment' has a composite primary key. --> EMSEntityContext/namespace[EMS.DAL]/class[Appraisal]/field[appraisalAssignment]/db-column
I am using the following to get an existing object:
StatisticalDatum updatedStats = ems.StatisticalData.Where(sd =>; sd.AppraisalId
== stats.AppraisalId).First();
where all I am interested in updating this specific object.
However, the object with the composite primary key is AppraisalAssignment which has a 4 field key and the object relationship is:
AppraisalAssignment -> Appraisal -> StatisticalDatum.
I cannot see, from the domain model, how to create the nested db-column extensions as described in the error message and in any case, I don't have all the values of the composite primary key for AppraisalAssignment at this point in the code.
How am I able to get around this situation?
Regards,
Jonathan
8 Answers, 1 is accepted
Have you used the Domain Model wizard (.rlinq file) to generate the model or is it done via the old 'Forward mapping' wizard? I guess it is via the Domain Model wizard/rlinq file .
The error message you see actually indicates invalid mapping. Can you provide us the rlinq file (app.config file if you have used the old Forward mapping wizard) so that we can have a closer look at the mapping for the 'EMS.DAL.Appraisal' type.
Looking forward to resolving the issue.
Best wishes,
Ady
the Telerik team
Regards,
Jonathan
Were you able to make further progresss with the mapping of the AppraisalAssignment reference field?
Do get back to us in case you need any assistance in doing that.
Regards,
Ady
the Telerik team
We have decided not to proceed using OpenAccess this database as there is a lot wrong with the database design anyway. If OA had worked without any bother (which it has in all our other projects), that would have been great but for the time being, I will continue to update the existing stored procedures and C# code any time there is a change to the table structure. Fortunately this does not happen too often!
Many thanks,
Jonathan
I´ve got a similiar problem (I have not designed the database in question):
I am using a MySQL db with OA Express.
--------------------------------------------------
The field x of class 'TelerikOpenAccess.y' must use nested db-column extensions in a db-ref extension as the class 'TelerikOpenAccess.z' has a composite primary key. --> MySqlEntities/namespace[TelerikOpenAccess]/class[y]/field[x]/db-column
I used the "already existing database" wizard.
Could the error be in the design of the database rather than OpenAccess?
Anyway, is there anyway I can resolve this?
Btw, I really like your OA express edition!
We are glad that you find the OpenAccess product good to use.
Sorry for this delayed reply. There seems to have been a problem with support system. I had replied a few days back. Apparantely the reply didn't get through.
This error occurs when there is a Foreign Key constraint to a destination table with a composite primary key. The corresponding reference field (Association element in the domain model) that is generated might not be completely mapped (field 'x' in your case). The mapping for this association should have column mappings for each column in the FK constraint. Can you select the association and verify the mapping in the 'Mapping details editor'?
Best wishes,
Ady
the Telerik team
I have the same problem:
The field '<value>' of class 'OpenAccessModel.Door' must use nested db-column extensions in a db-ref extension as the class 'OpenAccessModel.Sector' has a composite primary key. --> EntitiesModel/namespace[OpenAccessModel]/class[Door]/field[_sectors]/collection/db-link-table/db-value/db-column
I not sure how I can verify the mapping in the 'Mapping details editor'?
When I select the association in the diagram I cannot see something in the editor.
Best regards
Jörg
Is it possible to send me your .rlinq file? I can have a look at the mapping for this particular field and fix it for you. This would be the fastet way to get it working for you.
The excpetion is thrown when you have a reference to a class that has a composite primary key and the mapping is incomplete - maybe not all foreign keys are mapped to a primary key on the opposite side.
All the best,
Ady
the Telerik team