Sitefinity CMS

Important Interfaces of Generic Content Module Send comments on this topic.
Developing with Sitefinity > Modules > Modules API > Generic Content > Important Interfaces of Generic Content Module

Glossary Item Box

The Generic Content module creates and works with instances of the following interfaces:

  • IContent - content items implement it.  
  • IComment - comment items implement it. Comments are added to content items
  • ICategory - category items implement it. Categories are like folders - a single content item could belong to only one category.
  • ITag - tag items implement it. Unlike with categories, a single content item could belong (or be assigned) to more than one tag.
  • ITaggedContent
  • IMetaSearchInfo

  

Following is a description of the interfaces and their members: 

IContent Members

All content objects generated by Generic Content based modules (such as blog posts, news items, and so on) implement IContent interface. By taking advantage of this common interface all Generic Content based modules are able to share various functionality, such as tagging, categorizing and commenting.

If you are developing a new module based on Generic Content module, make sure that you implement IContent interface on the content objects your new module will work with.

 

Member name  Member type  Comments
ID  Guid  Unique identifier (Primary key) of the content item.
ParentID Guid 

Unique identifier (Primary key) of the parent of the content item.

The implementation of this property is optional. For example, the News module does not use this property, while the Blogs module does. In Blogs module, the IContent object (which represents blog posts) sets the ParentID property to the ID of the blog to which it belongs.
MimeType string 

Gets or sets the MIME type of the current content object.

Content object

Gets or sets the content of the current content object.

Content property of IContent is of object type. When working with modules such as News or Blogs, you will be able to cast this property to string, since it holds the html of the IContent object in question. Other modules, such as Images&Documents, will be of type binary, since they hold the image or document inside of this property.

ProviderName string Gets the name of the provider of that manages this content item.
Comments IList Gets the list of all comments (IComment) that belong to this IContent item.
Language string Gets the language of the content item.
Languages IList<string> Gets the list of all languages.
DateCreated DateTime Date and time of creation of the content item.
DateModified DateTime Date and time of last modification of the content item.
Status ContentStatus

Status of the IContent item. ContentStatus is an enumeration which consists of the following possibilities:

  • Draft
  • Published 
  • Archived
This property applies only to modules that implement workflow. Workflow needs to be additionally turned on for a module that works with the IContent object.
Thumbnails IList Ready-only. Returns a list of thumbnails for the IContent object, in case the Content property is a binary object that holds an image.
Url string Gets or sets the URL of the IContent object.The IContent object that holds image or document can be requested directly through a URL without the need to have a page as a container.
ItemInfo string Additional information about the content item.
GetMetaData(string key) object Returns the meta data of the specified key. The possible key values could be found in the web.config file, in the <metaFields> section, for the given module. For example, for Generic Content, the key starts with Generic_Content (such as Generic_Content.Author for the Author meta field). Thus, a key that could be passed as parameter is "Author".
SetMetaData(string key, object value) void Assigns the specified value to the specified key. The possible key values could be found in the web.config file, in the <metaFields> section, for the given module. For example, for Generic Content, the key starts with Generic_Content (such as Generic_Content.Author for the Author meta field). Thus, a key that could be passed as parameter is "Author", while a value could be "John".
UnreadCommentsCount(string userName) int Gets the number of comments made on the IContent object which are not read by the currently logged-in user.

 

IComment Members

Member name  Member type  Comments
ID  Guid  Unique identifier (Primary key) of the comment.
Parent IContent The content item which is commented.
Text string  Text in the comment.
Author string  User who created the comment.
Email string  Email address of the author.
Website string 

Web site of the author.

IpAddress string  IP address of the author.
Owner string  Owner of the comment.
Visible bool If true, comment is visible.
IsReadByUser(string userName) bool

If true, the comment is read by the specified user.

GetCreationDate DateTime Date and time of creation of the comment.

 

ICategory Members

Member name  Member type  Comments
ID  Guid  Unique identifier (Primary key) of the category.
CategoryName string  Name of the category.
Application string  Name of the application in which the ICategory object exists (this
value is retrieved from the provider).
DateCreated DateTime Date and time the category is created.
ContentCount int Number of IContent objects belonging to this ICategory object.

 

ITag Members

Member name  Member type  Comments
ID  Guid  Unique identifier (Primary key) of the tag.
TagName string  Name of the tag.
ContentsTagged int Number of IContent objects tagged with ITag object.
TaggedContent IList IList of ITaggedContent objects that represents a lookup table between ITag and IContent objects.
 

ITaggedContent Members

The ITaggedContent object represents an object that connects
ITag and IContent objects. Every time an IContent object is tagged with an ITag object, a new ITaggedContent object will be created and persisted.

Member name  Member type  Comments
Aplication string  Name of the application in which an ITaggedContent object exists (this value is retrieved from the provider).
ContentID Guid  Unique identifier (Primary key) of the content that forms this relation.
TagID Guid  Unique identifier (Primary key) of the tag that forms this relation.
Owner string  Username of the user who has tagged the IContent object with an ITag object.

  

IMetaSearchInfo Members

 Provides basic functionality for searching meta information.

Member name  Member type  Comments
ValueType MetaValueTypes

Read-only property. Gets the type of the value. MetaValueTypes is an enumeration which consists of the following possibilities:

  • ShortText

  • LongText

  • DateTime

  • Integer

  • FloatingPoint

  • Boolean

  • Guid

  • Binary

Key string Read-only property. Gets the object used as key to access data. The possible key values could be found in the web.config file, in the <metaFields> section, for the given module. For example, for Generic Content, the key starts with Generic_Content (such as Generic_Content.Author for the Author meta field).
Value object Read-only property. Gets the value itself.
Condition SearchCondition

Read-only property. Gets the search condition. SearchCondition is an enumeration which consists of the following possibilities:

  • Equal = 1 (Performs a comparison to determine if two expressions are equal.) 
    Equal is the DEFAULT value!
  • NotEqual = 2 (Performs a comparison to determine if two expressions are not equal.)
  • LessThen = 3 (Performs a comparison to determine if one expression is less than another.)
  • LessOrEqual = 4 (Performs a comparison to determine if one expression is less or equal to another.)
  • GreaterThen = 5 (Performs a comparison to determine if one expression is greater than another.)
  • GreaterOrEqual = 6 (Performs a comparison to determine if one expression is greater or equal to another.)
  • Like = 7 (Determines whether a given character string matches a specified pattern.)
  • Null = 8 (Determines whether a given expression is NULL.)
  • NotNull = 9 (Determines whether a given expression is NOT NULL.)
JoinType JoinType

Read-only property. Gets the type of join condition. JoinType is an enumeration which consists of the following possibilities:

  • And (Combines two Boolean expressions and returns true when both expressions are true.)
    And is the DEFAULT value!
  • Or (Combines two conditions and returns true when either of them is true.)