C# Class Felinesoft.UmbracoCodeFirst.Content.Factories.ContentFactoryBase

Creates an instance of a document type using values supplied as a strongly-typed model.

The RootContentFactory and ChildContentFactory[T] implementations work with the IAutoContent interface and the [AutoContent] attribute to place the content creation logic into methods on the code-first document type model. The recommended route to content generation is to implement IAutoContent on the document type model and apply an [AutoContent] attribute to the document type model.

Implementing a custom factory may be required for some scenarios such as creating a collection of content items or creating a nested structure in a single factory. A custom factory type can be specified using a [ContentFactory] attribute.

Inheritance: IContentFactory
Show file Open project: DanMannMann/UmbracoCodeFirst

Public Methods

Method Description
GetIfExists ( ) : Umbraco.Core.Models.IContent

Gets the IContent instance if it exists, otherwise returns null

GetOrCreate ( ) : Umbraco.Core.Models.IContent

Gets the IContent instance if it already exists, otherwise creates it

GetPublishedIfExists ( ) : IPublishedContent

Gets the IPublishedContent instance if it exists, otherwise returns null

Protected Methods

Method Description
ContentFactoryBase ( DocumentTypeBase values ) : System

Creates an instance of a document type using values supplied as a strongly-typed model.

The RootContentFactory and ChildContentFactory[T] implementations work with the IAutoContent interface and the [AutoContent] attribute to place the content creation logic into methods on the code-first document type model. The recommended approach for content creation is to implement IAutoContent on the document type model and apply an [AutoContent] attribute to the document type model.

Implementing a custom factory may be required for some scenarios such as creating a collection of content items or creating a nested structure in a single factory. A custom factory type can be specified using a [ContentFactory] attribute.

GetIfExists ( IEnumerable rootContent ) : Umbraco.Core.Models.IContent

Gets the IContent instance if it exists, otherwise returns null

GetOrCreate ( int parentId ) : Umbraco.Core.Models.IContent

Gets the IContent instance if it already exists, otherwise creates it

GetPublishedIfExists ( IEnumerable rootContent ) : IPublishedContent

Gets the IPublishedContent instance if it exists, otherwise returns null

Method Details

ContentFactoryBase() protected method

Creates an instance of a document type using values supplied as a strongly-typed model.

The RootContentFactory and ChildContentFactory[T] implementations work with the IAutoContent interface and the [AutoContent] attribute to place the content creation logic into methods on the code-first document type model. The recommended approach for content creation is to implement IAutoContent on the document type model and apply an [AutoContent] attribute to the document type model.

Implementing a custom factory may be required for some scenarios such as creating a collection of content items or creating a nested structure in a single factory. A custom factory type can be specified using a [ContentFactory] attribute.

protected ContentFactoryBase ( DocumentTypeBase values ) : System
values DocumentTypeBase The values to use to create the document
return System

GetIfExists() public abstract method

Gets the IContent instance if it exists, otherwise returns null
public abstract GetIfExists ( ) : Umbraco.Core.Models.IContent
return Umbraco.Core.Models.IContent

GetIfExists() protected method

Gets the IContent instance if it exists, otherwise returns null
protected GetIfExists ( IEnumerable rootContent ) : Umbraco.Core.Models.IContent
rootContent IEnumerable The collection of content to search for the existing node.
return Umbraco.Core.Models.IContent

GetOrCreate() public abstract method

Gets the IContent instance if it already exists, otherwise creates it
public abstract GetOrCreate ( ) : Umbraco.Core.Models.IContent
return Umbraco.Core.Models.IContent

GetOrCreate() protected method

Gets the IContent instance if it already exists, otherwise creates it
protected GetOrCreate ( int parentId ) : Umbraco.Core.Models.IContent
parentId int The ID of the parent node
return Umbraco.Core.Models.IContent

GetPublishedIfExists() public abstract method

Gets the IPublishedContent instance if it exists, otherwise returns null
public abstract GetPublishedIfExists ( ) : IPublishedContent
return IPublishedContent

GetPublishedIfExists() protected method

Gets the IPublishedContent instance if it exists, otherwise returns null
protected GetPublishedIfExists ( IEnumerable rootContent ) : IPublishedContent
rootContent IEnumerable The collection of content to search for the existing node.
return IPublishedContent