What does this message mean?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
TonyV
Posts: 74
Joined: Wed 25 May 2011 15:03

What does this message mean?

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: What does this message mean?

Post by 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.

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

Thanks, but now what?

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by 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
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by 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.

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

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 27 Oct 2011 16:20

Entity Framework doesn't allow to use the discriminator property for creating associations.

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

I don't understand

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by 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.

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

OK

Post by TonyV » Mon 31 Oct 2011 13:44

Alex:

Thanks! That makes sense.

Tony

Post Reply