'The field name isn't known in the element' error with TargetPerEntity

Posts   
 
    
Posts: 21
Joined: 18-Sep-2006
# Posted on: 12-Dec-2006 17:22:21   

I'm using a TargetPerEntity structure that looks something like this:

HistoryEntity * Guid Id (primary key) * Guid ChildId (FK to Id) * Guid CurrentChildId (FK to Id) * Guid ParentId (FK to Id) * bool IsCurrent * DateTime ActionDate * ActionType ActionType * string ActionComment * Guid AuthorId (FK to Person.Id) * Guid PAuthorId (FK to Person.Id) * ItemType ItemType

PersonEntity extends HistoryEntity * Guid Id (primary key, and FK to History.Id)

ItemType and ActionType are custom enumeration structures, but LLBLGen deals with them as integers.

To insert initial data into the database, all constraints are temporarily suppressed and a simple tool fills the fields of entities, which are then saved via a DataAccessAdapter.

For testing, this initial data consists of a single Person entity. However, when it is saved I get the following ArgumentException:

The field name 'ActionDate' isn't known in the element 'HistoryEntity' Parameter name: fieldName

Since all the fields are present on the History entities' backing table, this is really bizarre. It seems to suggest a problem with the generated code, but I don't know whereabouts to start looking in said code for the cause of this problem.

Note that the LLBLGen assemblies were generated from a project built by another custom tool. I know the project will not load in the LLBLGen GUI due to the handling of custom enumerations (requires a generified TypeConverter, subject of a previous topic) so I can't verify the inheritance hierarchy built by it.

Just to check, setting up TPE inheritance involves the following steps in the custom tool: 1. Ensure the supertype is either a TPE root or already a member of a TPE structure. 2. Use SetSuperTypeEntity with the subtype's combined primary/foreign key relation to the supertype. 3. Ensure all field targets are mapped to fields.

I haven't missed anything obvious here, have I? The project built in memory by the tool is almost identical to the GUI-produced project I built for reference purposes. Could the problem possibly be caused by Person only having a single field?

Posts: 21
Joined: 18-Sep-2006
# Posted on: 12-Dec-2006 17:50:34   

Whoops! Turned out to be an out of date assembly being linked at runtime!

That'll teach me to clean a target dir before relying on its contents...