C# Class Illusion.ViewModelLocator

A strategy for determining which view model to use for a given view.
Afficher le fichier Open project: kasicass/kasicass

Méthodes publiques

Свойство Type Description
InterfaceCaptureGroupName string
LocateForView object>.Func
LocateForViewType object>.Func
LocateTypeForViewType Func
NameTransformer NameTransformer
TransformName Func>

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
SetAllDefaults ( ) : void
ViewModelLocator ( ) : System

Method Details

AddDefaultTypeMapping() public static méthode

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)
Résultat void

AddNamespaceMapping() public static méthode

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)
Résultat void

AddSubNamespaceMapping() public static méthode

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)
Résultat void

AddTypeMapping() public static méthode

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)
Résultat void

ConfigureTypeMappings() public static méthode

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
Résultat void

MakeInterface() public static méthode

Makes a type name into an interface name.
public static MakeInterface ( string typeName ) : string
typeName string The part.
Résultat string

Property Details

InterfaceCaptureGroupName public_oe static_oe property

The name of the capture group used as a marker for rules that return interface types
public static string InterfaceCaptureGroupName
Résultat string

LocateForView public_oe static_oe property

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
Résultat object>.Func

LocateForViewType public_oe static_oe property

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
Résultat object>.Func

LocateTypeForViewType public_oe static_oe property

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
Résultat Func

NameTransformer public_oe static_oe property

Used to transform names.
public static NameTransformer NameTransformer
Résultat NameTransformer

TransformName public_oe static_oe property

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
Résultat Func>