Trying to figure out an error

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
duelingcats
Posts: 3
Joined: Sat 14 Jul 2012 19:04

Trying to figure out an error

Post by duelingcats » Sat 14 Jul 2012 19:18

Hello, I am trying to figure out why I am getting this error when I try to publish my model to my database. I am pretty new to the whole ORM idea, so you may have to explain some obvious mistake I have made.

The error I am getting is as follows:
An error occurred during creating constraint in storage model. Referential constraint property 'PersonID' association 'Instructor_Assignment' is not mapped to any column in storage table 'Employees'.
Here is my model
http://i.imgur.com/8rom4.png

I assumed that since I was inheriting from my Person class, it could use the PersonID from that class.

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

Re: Trying to figure out an error

Post by Shalex » Mon 16 Jul 2012 12:44

Could you please send us your model so that we can reproduce the issue in our environment?

duelingcats
Posts: 3
Joined: Sat 14 Jul 2012 19:04

Re: Trying to figure out an error

Post by duelingcats » Thu 19 Jul 2012 11:45

I eventually got it working, thanks though. Would you be able to tell me how I would be able to setup a serial column on a postgresql database and have my generated code not be concerned with inserting a integer for that column since it will be auto generated. Would I be able to have that integer return back so that my object is in sync?

Also, I am trying to do a many to many relationship, but can't figure out how to do it in the modeler. I would recommend adding some more documentation. Anyway, could you tell me what these column fields are for? I am trying to make a many to many relationship of student to class using attending as the linking table.

Image

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Trying to figure out an error

Post by MariiaI » Fri 27 Jul 2012 10:31

Sorry for the delay. According to the latter screenshot you are using LinqConnect. Please confirm this and specify whether you need the same information about using Entity Framework.

To be able to work with the autogenerated values, you should check that the following settings are set for the entity key in your model:
- Server Data Type = SERIAL NOT NULL;
- Auto-Sync = OnInsert;
- Auto Generated Value = true.

Also, we have sent you a sample project, that demonstrates how to work with autogenerated values in PostgreSQL. Please check that the letter is not blocked by your mail filter.

As for the many-to-many association, these columns point to the columns of the junction table, to which two other tables are associated.
For example, in your case:
on the Parent side - Class Property "ClassId' corresponds to the ClassID ('Attending' class), so you should set the Column to ClassID.
on the Child side - Class Property "PersonId' corresponds to the PersonID ('Attending' class), so you should set the Column to PersonID.

In this case you should remove the 'Attending' class from your model and just specify its name in the Association Editor, as displayed on your screenshot.
In another case, if you need this class to work in the model, you should create two associations (two 1-to-many associations with the Attending class on the many side).

As for the documentation, we're working on it now. Also, we would be grateful if you specify what else is unclear about working with our ORM solutions and what else we should add to our documentation.

duelingcats
Posts: 3
Joined: Sat 14 Jul 2012 19:04

Re: Trying to figure out an error

Post by duelingcats » Fri 27 Jul 2012 11:48

Thanks for the reply. Everything is working great for me now and I am enjoying the product :)

Post Reply