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

How to Avoid Duplicated Metadata Entries in ORM Model

2 Answers 59 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.
Jeff
Top achievements
Rank 1
Jeff asked on 25 Jun 2013, 01:31 PM
Hi All!

I have a question about the Open Access Model.  I have two separate models in the same project, both of which contain the same reference table.

When I compile the project, I get a "Duplicated Metadata entries found for type PartMaster. Please use only one way of mapping." comiler error.  It seems that the Enhancer is throwing this error.

I can see a couple of solution paths, but I am not sure how to embark on either, so some guidance would be appreciated.  Here are the solution paths:
Option 1: Create a Fluent Model that tells the Enhancer to IGNORE the reference table in question.  I have found documentation that tells me that the presence of a Fluent Model will tell the Enhancer to only follow the explicitly mapped entities.  This is not what I want, as I want to indicate that the reference table entity should be ignored.

Option 2: Add some logic to the models to tell each that the reference table is the same entity.  Not sure how to do this... Is there a way to tell the model that the entity is the same persisted entity in another model.

Any ideas would be much appreciated.

j.

2 Answers, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 25 Jun 2013, 02:52 PM
Ok, after some investigation, I have found a solution for having two ORM Domain Models in the same project.

Other than separating the domain models into separate libraries, the manner that worked was to rename the reference entity in one of the models to a new name.  This forces the Enhancer to treat the object as a separate mapping.

What would be really useful, is to have an option on the designer to indicate that a model references an entity in another model for mapping purposes, particularly if the reference is a ReadOnly reference anyway.

j.
0
Alexander
Telerik team
answered on 28 Jun 2013, 09:47 AM
Hello Jeff,

You have found the right solution. At the moment it is not allowed one class to take part in two models, so renaming one of the classes is the easiest option.

Regards,
Alexander
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
Tags
General Discussions
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or