Wednesday, 19 January 2011

SpecialNeeds handling

Was hoping to ignore the difference in the SpecialNeeds table regarding it only having a singular primary key (ShortListSpecialNeed_ID).

It appears though, because the client only returns an array of tags, each tag containing only the Code string and Description string, not the ID of the Code in CodeSpecialNeeds table, i am not able to correctly setup the relationship between the SpecialNeed and ShortList (via the ShortListSpecialNeed table), without the Code.ID !

So, i either re-write the client code to return the Code ID, which breaks the current paradigm, or, i change the structure of the ShortListSpecialNeed table so that its primary key is a composite of the ShortList_ID and CodeSpecialNeed_ID.

This will pave the way for me to:

  • take advantage of EntitySpaces FindByPrimaryKey method for the ShortListSpecialNeedCollection(shortListID)
  • More importabtly, i can actually setup the relationship between the two tables via the EntitySpaces "UpTo..." properties:

    ensShortListSpecialNeed addedNeed = this.ensShortListSpecialNeedCollectionByShortListID.AddNew();
    addedNeed.UpToensCodeSpecialNeedByCodeSpecialNeedID.CodeSpecialNeedID = tag.CodeItem.ID;