n-n example with content items

Topics: Writing modules
Aug 29, 2011 at 1:33 PM


What steps do i need to take to convert the many-2-many example shown here http://www.orchardproject.net/docs/Creating-1-n-and-n-n-relations.ashx#Building_an_iN-Ni_Relationship_34 to work with content items. The example prepopulates the database with values but i would like the user to create these via a contenttype.

thank you

Aug 29, 2011 at 2:29 PM

What ive done so far is:

  1. Created a part called RewardProgramPart
  2. Made it attachable in Migration
  3. Created a content type called RewardProgram and added the above part and made it createable
  4. Created "standard" driver and handler RewardProgramPart
  5. Created views for editing and displaying

When i then try and save a new content item using RewardProgram contenttype i get this error:

Cannot insert explicit value for identity column in table 'Rewards_RewardProgramRecord' when IDENTITY_INSERT is set to OFF.

i think this is down to the initial DB strucuture but not sure what i need to modify for this to work.

Any help would be very welcome



Aug 29, 2011 at 4:36 PM


I took the identity of the id column and it seems to be working ok.