C# Класс Illusion.ViewModelLocator

A strategy for determining which view model to use for a given view.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
InterfaceCaptureGroupName string
LocateForView object>.Func
LocateForViewType object>.Func
LocateTypeForViewType Func
NameTransformer NameTransformer
TransformName Func>

Открытые методы

Метод Описание
AddDefaultTypeMapping ( string viewSuffix = "View" ) : void

Adds a default type mapping using the standard namespace mapping convention

AddNamespaceMapping ( string nsSource, string nsTargets, string viewSuffix = "View" ) : void

Adds a standard type mapping based on simple namespace mapping

AddSubNamespaceMapping ( string nsSource, string nsTargets, string viewSuffix = "View" ) : void

Adds a standard type mapping by substituting one subnamespace for another

AddTypeMapping ( string nsSourceReplaceRegEx, string nsSourceFilterRegEx, string nsTargetsRegEx, string viewSuffix = "View" ) : void

Adds a standard type mapping based on namespace RegEx replace and filter patterns

ConfigureTypeMappings ( TypeMappingConfiguration config ) : void

Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration.

MakeInterface ( string typeName ) : string

Makes a type name into an interface name.

Приватные методы

Метод Описание
SetAllDefaults ( ) : void
ViewModelLocator ( ) : System

Описание методов

AddDefaultTypeMapping() публичный статический Метод

Adds a default type mapping using the standard namespace mapping convention
public static AddDefaultTypeMapping ( string viewSuffix = "View" ) : void
viewSuffix string Suffix for type name. Should be "View" or synonym of "View". (Optional)
Результат void

AddNamespaceMapping() публичный статический Метод

Adds a standard type mapping based on simple namespace mapping
public static AddNamespaceMapping ( string nsSource, string nsTargets, string viewSuffix = "View" ) : void
nsSource string Namespace of source type
nsTargets string Namespaces of target type as an array
viewSuffix string Suffix for type name. Should be "View" or synonym of "View". (Optional)
Результат void

AddSubNamespaceMapping() публичный статический Метод

Adds a standard type mapping by substituting one subnamespace for another
public static AddSubNamespaceMapping ( string nsSource, string nsTargets, string viewSuffix = "View" ) : void
nsSource string Subnamespace of source type
nsTargets string Subnamespaces of target type as an array
viewSuffix string Suffix for type name. Should be "View" or synonym of "View". (Optional)
Результат void

AddTypeMapping() публичный статический Метод

Adds a standard type mapping based on namespace RegEx replace and filter patterns
public static AddTypeMapping ( string nsSourceReplaceRegEx, string nsSourceFilterRegEx, string nsTargetsRegEx, string viewSuffix = "View" ) : void
nsSourceReplaceRegEx string RegEx replace pattern for source namespace
nsSourceFilterRegEx string RegEx filter pattern for source namespace
nsTargetsRegEx string Array of RegEx replace values for target namespaces
viewSuffix string Suffix for type name. Should be "View" or synonym of "View". (Optional)
Результат void

ConfigureTypeMappings() публичный статический Метод

Specifies how type mappings are created, including default type mappings. Calling this method will clear all existing name transformation rules and create new default type mappings according to the configuration.
public static ConfigureTypeMappings ( TypeMappingConfiguration config ) : void
config TypeMappingConfiguration An instance of TypeMappingConfiguration that provides the settings for configuration
Результат void

MakeInterface() публичный статический Метод

Makes a type name into an interface name.
public static MakeInterface ( string typeName ) : string
typeName string The part.
Результат string

Описание свойств

InterfaceCaptureGroupName публичное статическое свойство

The name of the capture group used as a marker for rules that return interface types
public static string InterfaceCaptureGroupName
Результат string

LocateForView публичное статическое свойство

Locates the view model for the specified view instance.
Pass the view instance as a parameters and receive a view model instance.
public static Func LocateForView
Результат object>.Func

LocateForViewType публичное статическое свойство

Locates the view model for the specified view type.
Pass the view type as a parameter and receive a view model instance.
public static Func LocateForViewType
Результат object>.Func

LocateTypeForViewType публичное статическое свойство

Determines the view model type based on the specified view type.
Pass the view type and receive a view model type. Pass true for the second parameter to search for interfaces.
public static Func LocateTypeForViewType
Результат Func

NameTransformer публичное статическое свойство

Used to transform names.
public static NameTransformer NameTransformer
Результат NameTransformer

TransformName публичное статическое свойство

Transforms a View type name into all of its possible ViewModel type names. Accepts a flag to include or exclude interface types.
Arguments: typeName = The name of the View type being resolved to its companion ViewModel. includeInterfaces = Flag to indicate if interface types are included
public static Func> TransformName
Результат Func>