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

4 posts, 1 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 20 Apr 2010 Link to this post

    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?



  2. Answer
    Ady
    Admin
    Ady avatar
    589 posts

    Posted 27 Apr 2010 Link to this post

    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.
  3. DevCraft banner
  4. Luca Costa
    Luca Costa avatar
    8 posts
    Member since:
    Jun 2009

    Posted 01 Jul 2010 Link to this post

    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?
  5. Ady
    Admin
    Ady avatar
    589 posts

    Posted 07 Jul 2010 Link to this post

    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
Back to Top