Strange errors after update to latest version

Mar 23, 2011 at 10:49 PM

I had a model which generated and compiled fine with a prior version of NHydrate.  Today I downloaded the latest version and the generated for NHDAL.  I now get the errors below and was wondering what I am doing wrong.  The affected table DEVICEPART is my only Associative table so it may be related to that. The errors are all in the generated code.

Error    1    Inconsistent accessibility: parameter type 'TTE.CALTRACK.Business.Objects.DEVICEPARTPaging' is less accessible than method 'TTE.CALTRACK.Business.SelectCommands.DEVICEPARTSelectByFK_DeviceId.DEVICEPARTSelectByFK_DeviceId(int, TTE.CALTRACK.Business.Objects.DEVICEPARTPaging)'    C:\Oak Knoll Software\TTE\TTECalTrack\TTE.CALTRACK\Business\SelectCommands\DEVICEPART.Generated.cs    72    10    TTE.CALTRACK

Error    2    Inconsistent accessibility: parameter type 'TTE.CALTRACK.Business.Objects.DEVICEPARTPaging' is less accessible than method 'TTE.CALTRACK.Business.SelectCommands.DEVICEPARTSelectByFK_DeviceIdRange.DEVICEPARTSelectByFK_DeviceIdRange(int, int, TTE.CALTRACK.Business.Objects.DEVICEPARTPaging)'    C:\Oak Knoll Software\TTE\TTECalTrack\TTE.CALTRACK\Business\SelectCommands\DEVICEPART.Generated.cs    206    10    TTE.CALTRACK

Error    3    Inconsistent accessibility: parameter type 'TTE.CALTRACK.Business.Objects.DEVICEPARTPaging' is less accessible than method 'TTE.CALTRACK.Business.SelectCommands.DEVICEPARTSelectByFK_PartId.DEVICEPARTSelectByFK_PartId(int, TTE.CALTRACK.Business.Objects.DEVICEPARTPaging)'    C:\Oak Knoll Software\TTE\TTECalTrack\TTE.CALTRACK\Business\SelectCommands\DEVICEPART.Generated.cs    337    10    TTE.CALTRACK

Error    4    Inconsistent accessibility: parameter type 'TTE.CALTRACK.Business.Objects.DEVICEPARTPaging' is less accessible than method 'TTE.CALTRACK.Business.SelectCommands.DEVICEPARTSelectByFK_PartIdRange.DEVICEPARTSelectByFK_PartIdRange(int, int, TTE.CALTRACK.Business.Objects.DEVICEPARTPaging)'    C:\Oak Knoll Software\TTE\TTECalTrack\TTE.CALTRACK\Business\SelectCommands\DEVICEPART.Generated.cs    471    10    TTE.CALTRACK

Mar 24, 2011 at 12:17 AM

I have confirmed that it is related to being an Associative table.  I set the Associative property to false, re-generated and re-compiled without error.  When I put the table back to being Associative=True, re-generated and the compiler errors returned.

Coordinator
Mar 24, 2011 at 2:43 AM

Could you send your model to feedback@nhydrate.org? I have tested with numerous models with associative tables and do not see this. Please help me reproduce this issue.

Mar 24, 2011 at 3:25 PM

Did you receive the model that I e-mailed last night?  Also, I took the model and added it to a blank solution and was confirmed that the issue still occurs in there as well.  As noted in my e-mail this is the VS2008 version of NHydrate.  I am unable to test in the VS2010 version.

Coordinator
Mar 24, 2011 at 4:17 PM

I have you model and used it to determine the issue. First your associative table is not strictly an associative table. It has more fields in it than needed. I know some people need to add more fields to this table so this is fine. However you mark the extra field as serachable which noramlly generates some extra code for paged searching and select by that field. This is what caused the issue. I have corrected this in that these extra methods will not be generated for associative tables. You can solve this now by marking your "DevicePartId" as not searchable. However there will be a post for this fix this weekend.

Mar 24, 2011 at 4:34 PM

Thank you that did correct the issue.  Could you let me know what  the correct fields would be in an associative table?  I am linking the DEVICE and PART tables as TABLE DEVICEPART with an autoincrement field for the primary key and then foreign keys to the DeviceID and PartID (primary keys in the two tables).

DevicePartId (primary key)
FK_DeviceId (foreign to DEVICE table)
DK_PartId (foreign to PART table)

Coordinator
Mar 24, 2011 at 8:22 PM

You only need the PK of the two related tables. You already have this. You also added a surragate key of DevicePartID that is not needed. Simply mark both fields FK_DeviceId and DK_PartId as PK in that table and remove the DevicePartId field. You do not need it.