Creation relations. Difference content items and records

Topics: Writing modules
Jul 4, 2011 at 7:53 PM

Hi, I followed the tutorial http://orchardproject.net/docs/Creating-1-n-and-n-n-relations.ashx#Using_the_Rewards_Part_25

and i think i'm fairly understanding the flow of creation relations. The one thing i don't understand is the following sentence:

Our third example will establish a relation between content items, which is a step up from our previous examples which were establishing relations between records.

I suppose i don't fully understand the difference between content items and records. I thought that the records are used to save the content items. So can anyone explain this sentence and the difference between the two relation types.

Jul 5, 2011 at 6:36 AM

A ContentPart uses a ContentRecord to persist data.

A ContentType is made up of ContentParts and/or ContentFields.

A ContentItem is an instance of a ContentType, meaning it will allow the user to write data to every ContentPart or ContentField that is aggregated by the ContentType, via the individual Drivers.

When that data is posted to the EditorUpdate method on the Driver, changing the values on the ContentPart will change the underlying ContentRecord. Since you have a relation between ContentRecords, you implicitly have a relation between ContentItems. It says it is a step up, because ContentItems are at a Higher Level of abstraction. A content item aggregates, based on the content type definition, one or more content parts, each content part has a content record that it uses to persist the current state.

Let's see what you understood from this post, and I'll return with additional comments as needed.

Jul 5, 2011 at 7:22 AM

Ok i thought it over at night and together with your comment it cleared allot! Summary:

You can create an relation to one individual part or to an whole content item and the content item can contain multiple parts.

Thanks!

Oct 3, 2011 at 5:43 AM
Edited Oct 4, 2011 at 7:28 AM

Hi,

 i have to store address info for the company. In real time a company might have several branches ,so multiple address for a single company(1(company):n (address)).Now is that ,i have  my user  and Address content part that can be attached to it. but this address content part part doesnt allow me to attach multiple addresses for a single user.

How can i have several addresses for a single user???Should i have to build from scratch as shown in examples? In short how can a user can have a 1:n with its content part(address)???Help me out!

 

 

Coordinator
Oct 5, 2011 at 7:22 PM

That's the n-n part of the article.