Data types using C#

Super interfaces

By making your data type inherit from one or more of the data interfaces in C1 CMS you can “subscribe” to functionality and behavior to your type. The currently super data interfaces supplied by C1 CMS are described below.

IData

All data types in C1 CMS have to derive from the IData interface.

IPublishControlled

If your type should support publishing workflows, your type has to derive from the IPublishControlled interface. Types that support publishing can exist in two scopes:

  • administrated
  • public

Published data is used when pages are rendered for the public site. See the Creating a publishable data type section for more information on types that support publishing workflows. Actually, IPublishControlled is an IData itself that has some special handling in C1 CMS. Here is how it’s defined:

[DataScope(DataScopeIdentifier.PublicName)]
[DataScope(DataScopeIdentifier.AdministratedName)]    
public interface IPublishControlled : IProcessControlled
{
    [StoreFieldType(PhysicalStoreFieldType.String, 64, IsNullable = false)]
    [ImmutableFieldId("{FAB1CF0C-66B0-11DC-A47E-CF6356D89593}")]
    [DefaultFieldStringValue("")]
    [BeforeSet(typeof(PublishControlledSetPropertyHandler))]
    [FieldPosition(50)]
    string PublicationStatus { get; set; }
}

So, when your interface inherits the IPublishControlled interface, a property is added to your type. Also, two data scopes are added.

ILocalizedControlled

If your type should support localization workflows, your type has to derive from the ILocalizedControlled interface. Types that support localization can have instances with the same ID in each active locale in a running system. In other words, if da-DK, en-US and it-IT locales have been added to a running C1 CMS solution, then an instance of your type with the ID of ‘X’ can exist in those three locales, but do not have to. If at one point a request to rendering a page in the en-US locale is made and data of your type is requested, only instances that have been added to the en-US scope will be returned. Like IPublishControlled, ILocalizedControlled is also just a specialized IData interface with some special handling in C1 CMS:

public interface ILocalizedControlled : IProcessControlled
{
    [StoreFieldType(PhysicalStoreFieldType.String, 16)]
    [ImmutableFieldId("{E271D3EB-A8EB-49ea-9BB5-E5A54F88298F}")]
    [NotNullValidator()]
    [DefaultFieldStringValue("")] // Invariant
    string CultureName { get; set; }
    [StoreFieldType(PhysicalStoreFieldType.String, 16)]
    [ImmutableFieldId("{0456EBB0-7FB1-46cd-9A23-4AE9AA3337FA}")]
    [NotNullValidator()]
    [DefaultFieldStringValue("")] // Invariant
    string SourceCultureName { get; set; }
}