C# Class Felinesoft.UmbracoCodeFirst.Attributes.AutoContentAttribute

Inheritance: ContentFactoryAttribute, IInitialisableAttribute
Afficher le fichier Open project: DanMannMann/UmbracoCodeFirst

Méthodes publiques

Méthode Description
AutoContentAttribute ( string name, Type parentType = null, int sortOrder = 10 ) : System

When applied to a code-first document type class this attribute instructs the code-first initialiser to create a document instance of that type, if it does not exist. This attribute should only be applied to classes which inherit DocumentTypeBase and which also have a [DocumentType] attribute.

The values for the document instance can either be configured in a parameterless constructor of the document type class or in the InitialiseDefaults method if the class implements IAutoContent

Initialise ( Type targetType ) : void

Initialises the Factory property based on the type to which the attribute is applied.

Méthodes protégées

Méthode Description
ConstructFactory ( DocumentTypeBase values ) : IContentFactory

Automatically constructs a factory for any inheritor of DocumentTypeBase

GetValues ( Type targetType ) : DocumentTypeBase

Gets the document instance values for use in creating the default content

Method Details

AutoContentAttribute() public méthode

When applied to a code-first document type class this attribute instructs the code-first initialiser to create a document instance of that type, if it does not exist. This attribute should only be applied to classes which inherit DocumentTypeBase and which also have a [DocumentType] attribute.

The values for the document instance can either be configured in a parameterless constructor of the document type class or in the InitialiseDefaults method if the class implements IAutoContent

public AutoContentAttribute ( string name, Type parentType = null, int sortOrder = 10 ) : System
name string The name of the document node
parentType System.Type /// The type whose default document will be the parent of this document. /// The supplied type must inherit DocumentTypeBase and must specify a default content provider via an [AutoContent] or [ContentFactory] attribute ///
sortOrder int The sort order for the document amongst its' siblings
Résultat System

ConstructFactory() protected méthode

Automatically constructs a factory for any inheritor of DocumentTypeBase
protected ConstructFactory ( DocumentTypeBase values ) : IContentFactory
values DocumentTypeBase The document type to create
Résultat IContentFactory

GetValues() protected méthode

Gets the document instance values for use in creating the default content
protected GetValues ( Type targetType ) : DocumentTypeBase
targetType System.Type The document type
Résultat DocumentTypeBase

Initialise() public méthode

Initialises the Factory property based on the type to which the attribute is applied.
public Initialise ( Type targetType ) : void
targetType System.Type The type to which the attribute is applied
Résultat void