One to One Association Problem

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Lucas Phillip
Posts: 10
Joined: Wed 29 Jun 2011 14:37

One to One Association Problem

Post by Lucas Phillip » Wed 16 Nov 2011 14:57

Hi there,

I'm trying to create a one to one association with two tables but i keep getting FK constraint error. I've tried to change my association to one to many and the exact same model worked. So, I came here for help.

Here are my tables (they were modified to be tested easily)

Code: Select all

CREATE TABLE public."BaseEntities" (
   "Id" SERIAL NOT NULL,
   "Any" VARCHAR,
   "Father" INT4,
   CONSTRAINT "PK_BaseEntities" PRIMARY KEY ("Id"),
   CONSTRAINT "FK_BaseEntities_BaseEntities_0" FOREIGN KEY ("Father") REFERENCES public."BaseEntities" ("Id")
);


CREATE TABLE public."Parameters" (
   "Id" SERIAL NOT NULL,
   "Value" FLOAT4 NOT NULL,
   CONSTRAINT "PK_Parameters" PRIMARY KEY ("Id"),
   CONSTRAINT "FK_Parameters_BaseEntities_0" FOREIGN KEY ("Id") REFERENCES public."BaseEntities" ("Id")
);
I've looked at the sql generated and when the association is one to many, the "Parameters" FK get inserted with the correct value. But in a oneToOne case, the Parameters FK always get a 0 value, which breaks the execution.

What's wrong??

Thanks

Edit:
I forgot. I'm using LinqConnect 3.0.14, Windows 7, Postgresql 9.1 (although I also tried on SQL Server)

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 18 Nov 2011 15:35

This is a known issue. We are working on it, but cannot provide any timeframe at the moment. We will inform you when this problem is fixed.

Lucas Phillip
Posts: 10
Joined: Wed 29 Jun 2011 14:37

Post by Lucas Phillip » Mon 26 Dec 2011 15:18

Was this bug fixed with build 3.1.19?

Cause I tested and it's still not working.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 27 Dec 2011 14:05

Yes, the issue was fixed in the 3.1.19 build of LinqConnect. You can also try the latest 3.1.21 build.

I've sent you a sample project, please specify what should be changed in it to reproduce the issue with the new builds.

Post Reply