C# Class Sdl.Web.Common.Models.ModelTypeRegistry

Represents a Registry of View Model Types and associated Semantics.
Exibir arquivo Open project: sdl/dxa-web-application-dotnet Class Usage Examples

Public Methods

Method Description
GetMappedModelTypes ( string semanticTypeName ) : IEnumerable

Gets the Model Types mapped to a given semantic type name.

GetSemanticPropertyNames ( Type modelType, string propertyName ) : string[]

Gets the semantic property names for a given Model Type and property name.

GetSemanticTypes ( Type modelType, string>.IDictionary &prefixMappings ) : string[]

Gets the semantic types (and prefix mappings) for a given Model Type.

GetViewModelType ( MvcData viewData ) : Type

Get the View Model Type for a given View.

RegisterViewModel ( MvcData viewData, Type modelType ) : void

Registers a View Model and associated View.

RegisterViewModel ( MvcData viewData, string viewVirtualPath ) : void

Registers a View Model mapping by compiling a given view file and obtaining its model type.

Private Methods

Method Description
ExtractSemanticInfo ( Type modelType ) : SemanticInfo
GetSemanticInfo ( Type modelType ) : SemanticInfo
RegisterModelType ( Type modelType ) : SemanticInfo

Method Details

GetMappedModelTypes() public static method

Gets the Model Types mapped to a given semantic type name.
public static GetMappedModelTypes ( string semanticTypeName ) : IEnumerable
semanticTypeName string The semantic type name qualified with vocabulary ID.
return IEnumerable

GetSemanticPropertyNames() public static method

Gets the semantic property names for a given Model Type and property name.
public static GetSemanticPropertyNames ( Type modelType, string propertyName ) : string[]
modelType System.Type The Model Type.
propertyName string The property name.
return string[]

GetSemanticTypes() public static method

Gets the semantic types (and prefix mappings) for a given Model Type.
public static GetSemanticTypes ( Type modelType, string>.IDictionary &prefixMappings ) : string[]
modelType System.Type The Model Type.
prefixMappings string>.IDictionary The prefix mappings for the prefixes used by the types.
return string[]

GetViewModelType() public static method

Get the View Model Type for a given View.
public static GetViewModelType ( MvcData viewData ) : Type
viewData MvcData The data for the View.
return System.Type

RegisterViewModel() public static method

Registers a View Model and associated View.
public static RegisterViewModel ( MvcData viewData, Type modelType ) : void
viewData MvcData The data for the View to register or null if only the Model Type is to be registered.
modelType System.Type The model Type used by the View.
return void

RegisterViewModel() public static method

Registers a View Model mapping by compiling a given view file and obtaining its model type.
public static RegisterViewModel ( MvcData viewData, string viewVirtualPath ) : void
viewData MvcData The data for the View to register.
viewVirtualPath string The (virtual) path to the View file.
return void