What does this message mean?

What does this message mean?

Postby TonyV » Tue 11 Oct 2011 13:16

I have an Entity Model for my code. There's one table, called Images, which has the following definition:

Code: Select all
CREATE TABLE "CarSystem"."Images" (
   "ImageId"         UUID      PRIMARY KEY DEFAULT UUID_GENERATE_V4(),
   "ReadId"         UUID      NOT NULL REFERENCES "CarSystem"."Reads"        ( "ReadId" ),
   "ImageTypeId"         INT      NOT NULL REFERENCES "CarSystem"."ImageTypes"   ( "ImageTypeId" ),
   "ImageClassId"         INT      NOT NULL REFERENCES "CarSystem"."ImageClasses" ( "ImageClassId" ) DEFAULT 3,
   "ImageOid"         INT      NOT NULL,
   "OrigX"            INT      NULL,
   "OrigY"            INT      NULL,
   "Width"            INT      NULL,
   "Height"         INT      NULL,
   "Camera"         VARCHAR(16)   NULL,
   "TimeStamp"         TIMESTAMPTZ   NOT NULL,
   "CreatedDate"         TIMESTAMPTZ   NOT NULL DEFAULT CURRENT_TIMESTAMP,
   i_active         SMALLINT   NOT NULL DEFAULT 1,
   "ModifyDate"         TIMESTAMPTZ   NULL
);


There are 2 different types of images: Overviews & Plates. The ImageTypeId is used to tell these apart.

In the Entity Developer, I selected the OrigX, OrigY, Width, and Height columns and dragged them out onto the design surface. I chose to make them a Derived Class, called PlateImage. After completing these tasks, I got the error below:

Problem in mapping fragments starting at lines 143, 177:Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with different keys to the same group of rows.

What does this message mean? How do I correct it?

Thanks

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Re: What does this message mean?

Postby Shalex » Wed 12 Oct 2011 11:42

TonyV wrote:In the Entity Developer, I selected the OrigX, OrigY, Width, and Height columns and dragged them out onto the design surface. I chose to make them a Derived Class, called PlateImage.

Additionally, please follow these steps in the designer:
1. Right click on the PlateImage entity class > Mapping Details > add the "ImageTypeId=1" condition in the Conditions section.
2. Right click on the Image entity class > Mapping Details > add the "ImageTypeId=0" condition in the Conditions section.
3. Remove the ImageTypeId property of your Image entity class.
Shalex
Devart Team
 
Posts: 7793
Joined: Thu 14 Aug 2008 12:44

Thanks, but now what?

Postby TonyV » Wed 12 Oct 2011 15:07

Shalex:

Thank you very much! That did indeed fix that issue. However, I am now getting another message:

No mapping specified for the following EntitySet/AssociationSet - ImageTypes_ImagesSet.

How do I fix this issue? I tried to add a mapping to the association and I can't because the ImageTypeId property is gone from the Image entity class.

Thanks

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Tue 18 Oct 2011 16:07

1. Please send us the DDL script of your "CarSystem"."ImageTypes" table because it is referenced by the ImageTypeId field of your Images table. There is no errors in the model that is based on "CarSystem"."Images", references of which are removed.
2. Do we need to perform any additional steps (except those mentioned in my previous post) to reproduce the error "No mapping specified for the following EntitySet/AssociationSet - ImageTypes_ImagesSet"?
Shalex
Devart Team
 
Posts: 7793
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Thu 20 Oct 2011 08:43

TonyV wrote:No mapping specified for the following EntitySet/AssociationSet - ImageTypes_ImagesSet.

How do I fix this issue? I tried to add a mapping to the association and I can't because the ImageTypeId property is gone from the Image entity class.

This functionality is not supported by Entity Framework.
Shalex
Devart Team
 
Posts: 7793
Joined: Thu 14 Aug 2008 12:44

Postby TonyV » Mon 24 Oct 2011 18:08

Shalex wrote:1. Please send us the DDL script of your "CarSystem"."ImageTypes" table because it is referenced by the ImageTypeId field of your Images table. There is no errors in the model that is based on "CarSystem"."Images", references of which are removed.
2. Do we need to perform any additional steps (except those mentioned in my previous post) to reproduce the error "No mapping specified for the following EntitySet/AssociationSet - ImageTypes_ImagesSet"?


Here is the DDL of the ImageTypes table:

Code: Select all
CREATE TABLE "CarSystem"."ImageTypes" (
   "ImageTypeId"               SERIAL          PRIMARY KEY,
   "ImageTypeName"          VARCHAR(80)     NOT NULL UNIQUE,
   "CreatedDate"               TIMESTAMPTZ     NOT NULL DEFAULT CURRENT_TIMESTAMP,
   i_active                       SMALLINT        NOT NULL DEFAULT 1,
   "ModifyDate"                TIMESTAMPTZ     NULL
);


No, there are no other steps to perform. I can use the Entity Model as it is. It would be nice to have separate types for plate images & for Overview images, but it's not necessary.

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Thu 27 Oct 2011 16:20

Entity Framework doesn't allow to use the discriminator property for creating associations.
Shalex
Devart Team
 
Posts: 7793
Joined: Thu 14 Aug 2008 12:44

I don't understand

Postby TonyV » Thu 27 Oct 2011 19:16

Alex:

I don't follow what you mean. What is the discriminator property? The ImageTypeId? Are you saying that because the ImageTypeId is a foreign key that it can't be used to discriminate between an Overview and a Plate Image?

In that case, if I remove the ImageTypes table from the model, would I be able to do what I want to do?

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03

Postby Shalex » Mon 31 Oct 2011 13:30

TonyV wrote:What is the discriminator property? The ImageTypeId? Are you saying that because the ImageTypeId is a foreign key that it can't be used to discriminate between an Overview and a Plate Image?

This is correct.
TonyV wrote:if I remove the ImageTypes table from the model, would I be able to do what I want to do?

Yes, you would. I have managed to create a derived class successfully in the model without the ImageTypes table.
Shalex
Devart Team
 
Posts: 7793
Joined: Thu 14 Aug 2008 12:44

OK

Postby TonyV » Mon 31 Oct 2011 13:44

Alex:

Thanks! That makes sense.

Tony
TonyV
 
Posts: 74
Joined: Wed 25 May 2011 15:03


Return to dotConnect for PostgreSQL