Class ContentItem
The ContentItem class which itself inherits from BaseEntityInfo paves the way for easily adding support for taxonomy, tagging and other ContentItem dependant features to your DotNetNuke extensions.
Implements
Inherited Members
Namespace: DotNetNuke.Entities.Content
Assembly: DotNetNuke.dll
Syntax
public class ContentItem : BaseEntityInfo, IHydratable
Remarks
Content Items are a collection of individual pieces of content in a DotNetNuke site. Each content item is associated with a single Content Type.
Only modules that implement content items (done so by the module developers) can take advantage of some of its benefits, such as Taxonomy.
Because ContentItem already implements IHydratable, you will not do so in your custom entity class. Instead, you will need to create overrides of the KeyID property and the Fill method already implemented in the ContentItem class. Don't forget to call ContentItem's FillInternal method in your Fill method override.
Examples
[Serializable]
public class DesktopModuleInfo : ContentItem, IXmlSerializable
{
#region IHydratable Members
public override void Fill(IDataReader dr)
{
DesktopModuleID = Null.SetNullInteger(dr["DesktopModuleID"]);
PackageID = Null.SetNullInteger(dr["PackageID"]);
ModuleName = Null.SetNullString(dr["ModuleName"]);
FriendlyName = Null.SetNullString(dr["FriendlyName"]);
Description = Null.SetNullString(dr["Description"]);
FolderName = Null.SetNullString(dr["FolderName"]);
Version = Null.SetNullString(dr["Version"]);
base.FillInternal(dr);
}
#endregion
}
Constructors
| Improve this Doc View SourceContentItem()
Initializes a new instance of the ContentItem class.
Declaration
public ContentItem()
Properties
| Improve this Doc View SourceContent
Gets or sets the content.
Declaration
public string Content { get; set; }
Property Value
Type | Description |
---|---|
System.String | The content. |
ContentItemId
Gets or sets the content item id.
Declaration
public int ContentItemId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The content item id. |
ContentKey
Gets or sets the content key.
Declaration
public string ContentKey { get; set; }
Property Value
Type | Description |
---|---|
System.String | The content key. |
ContentTitle
Gets or sets the title of the ContentItem.
Declaration
public string ContentTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ContentTypeId
Gets or sets the content type id.
Declaration
public int ContentTypeId { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The content type id. |
Files
Gets files that are attached to this ContentItem.
Declaration
public List<IFileInfo> Files { get; }
Property Value
Type | Description |
---|---|
List<IFileInfo> |
Images
Gets images associated with this ContentItem.
Declaration
public List<IFileInfo> Images { get; }
Property Value
Type | Description |
---|---|
List<IFileInfo> |
Indexed
Gets or sets a value indicating whether this ContentItem is indexed.
Declaration
public bool Indexed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
KeyID
Gets or sets the key ID.
Declaration
public virtual int KeyID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The key ID. |
Remarks
If you derive class has its own key id, please override this property and set the value to your own key id.
Metadata
Gets the metadata.
Declaration
public NameValueCollection Metadata { get; }
Property Value
Type | Description |
---|---|
NameValueCollection | metadata collection. |
ModuleID
Gets or sets the module ID.
Declaration
public int ModuleID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The module ID. |
StateID
Gets or sets the Content Workflow State ID.
Declaration
public int StateID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The Content Workflow State ID. |
TabID
Gets or sets the tab ID.
Declaration
public int TabID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The tab ID. |
Terms
Gets the terms.
Declaration
public List<Term> Terms { get; }
Property Value
Type | Description |
---|---|
List<Term> | Terms Collection. |
Videos
Gets video files attached to this ContentItem.
Declaration
public List<IFileInfo> Videos { get; }
Property Value
Type | Description |
---|---|
List<IFileInfo> |
Methods
| Improve this Doc View SourceClone(ContentItem, ContentItem)
Declaration
protected void Clone(ContentItem cloneItem, ContentItem originalItem)
Parameters
Type | Name | Description |
---|---|---|
ContentItem | cloneItem | |
ContentItem | originalItem |
Fill(IDataReader)
Fill this content object will the information from data reader.
Declaration
public virtual void Fill(IDataReader dr)
Parameters
Type | Name | Description |
---|---|---|
IDataReader | dr | The data reader. |
See Also
FillInternal(IDataReader)
Fills the internal.
Declaration
protected override void FillInternal(IDataReader dr)
Parameters
Type | Name | Description |
---|---|---|
IDataReader | dr | The data reader contains module information. |
Overrides
Remarks
Please remember to call base.FillInternal or base.Fill method in your Fill method.