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

Help: Error in DAL -Multi Tenant, Many to Many

3 Answers 166 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 21 Apr 2010, 01:33 AM
Hi,
I'm trying to use OA to set up a DAL to a multi-tenant many to many database, but I'm having trouble setting up my DAL.
Thou I get the following message:
Error    1    OpenAccess Error: Telerik.OpenAccess: Updating SQL schema failed. Using a duplicate column name attempted for field 'staffSite' of class 'ClassLibrary.Site'.
There seems to be another field 'staffSite' defined in the model using the same name 'tenantid'.
You must specify an unique column name for the field 'staffSite' explicitly. Open the 'Forward Mapping' dialog from OpenAccess, select the class 'ClassLibrary.Site' and field 'staffSite' and set an explicit column name. This generates the needed db-column extension in the config file.     Data    
Error    2    OpenAccess Error: Using a duplicate column name attempted for field 'staffSite' of class 'ClassLibrary.Site'.
There seems to be another field 'staffSite' defined in the model using the same name 'tenantid'.
You must specify an unique column name for the field 'staffSite' explicitly. Open the 'Forward Mapping' dialog from OpenAccess, select the class 'ClassLibrary.Site' and field 'staffSite' and set an explicit column name. This generates the needed db-column extension in the config file.     Data    




I have a class library called "Entities" which holds my reverse mapped presistant classes.
I have a class library called "Data" which has a reference to entities, and is suppose to have the data access layer.
(I also have my Silverlight server-client project, thou these are not used yet)

Here is a picture of my database diagram

The unique thing about my setup is that The staff site has 3 variables: staffid, siteid, tenantid
The two sets of foreign keys are:
i) staffid, tenantid
ii) siteid, tenantid
(And ADO EFM fail at mapping these correctly -or at least I fail at mapping them with ADO, hence why I'm trying OpenAccess)




Can anyone help me sort this out?







Also, the forward mapper gives this error
Error    1    OpenAccess: Field 'staff' of class 'ClassLibrary.CashSale' is the master of a shared column 'tenantid', but a second reference field 'banking' tries to master this column too.
Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.

How do I resolve this?



3 Answers, 1 is accepted

Sort by
0
Accepted
Ady
Telerik team
answered on 27 Apr 2010, 07:08 AM
Hello Alexander Sun,

 I have provided the reason for the errors in my reply to your similar support thread,
As mentioned earlier, this error occurs if 2 fields are mapped to the same column. Do you have 2 fields in the same class that are mapped to the 'tenantid' column?

The Forward mapping error that you mention occurs when 2 reference fields are mapped to the same column. The 'staff' reference field obtains its value from the 'tenantid' column and another reference field - 'banking' also seems to be mapped to the same column. This is not allowed. The column can be shared only between the reference field (staff) and it's corresponding simple field (if you have generated it).

Kind regards,
Ady
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Castgroup srl
Top achievements
Rank 2
answered on 01 Jul 2010, 04:43 PM
OK.
I have the same problem: 2 Object fields in the same class that are mapped to the same column?
I have a lot of relations of this type.
The release 2009.2.701.5 of the ORM didn't has this so strict restriction.
I am still blocked at this revision because the upgrade need a refactor so expensive that I can't do.
Can't you build a custom release that simply doesn't make this chek and let me go forward with the ORM
like the old release?
0
Ady
Telerik team
answered on 07 Jul 2010, 02:08 PM
Hi Luca Costa,

It is allowed to have 2 reference fields mapped to the same column but what is not allowed is - 2 reference fields and a simple field mapped to the same column.

Do you have only 2 reference fields or also an extra corresponding simple field mapped to the column?


Regards,
Ady
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
Alex
Top achievements
Rank 1
Answers by
Ady
Telerik team
Castgroup srl
Top achievements
Rank 2
Share this question
or