C# Класс Command.Context

Records the current context within which Commands are executed. A Context is like a session object; it holds the current set of live object instances on which commands will be invoked. The Context is also able to use the Factory registration information to create new object instances as required, provided they can be created from objects currently in the context.
Показать файл Открыть проект

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

Свойство Тип Описание
MissingArgHandler object>.Func

Защищенные свойства (Protected)

Свойство Тип Описание
_context List
_dependencyList List>.Dictionary
_log log4net.ILog
_purgeList List
_registry Registry

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

Метод Описание
Context ( Registry registry ) : System
Context ( Registry registry, object>.Func missingArgHandler ) : System
FindPathToType ( Type t, Command cmd ) : Stack

Determines the sequence of command invocations, property accesses, and constructor calls that are required to instantiate an object of the requested type, given the current state of the context.

GetSettings ( Type type ) : List

Returns the SettingAttributes for the specified type.

HasObject ( Type type ) : bool

Returns true if the Context currently contains an instance of the requested type.

Invoke ( string command, object>.Dictionary args ) : object

Invoke an instance of the named command, using the supplied arguments dictionary to obtain parameter values. If necessary, this will execute Factory constructors, properties, and commands to obtain the necessary source object on which to invoke the command.

Remove ( Type type ) : object

Removes the first object that is an instance of type.

Set ( object value ) : void

Sets an object in the context. Only a single object of a given type is permitted, so any existing object of this type is replaced.

Set ( object value, object dependency ) : void

Sets an object in the context. Only a single object of a given type is permitted, so any existing object of this type is replaced.

Verify ( ) : void

Verifies that all commands can be invoked successfully.

this ( Type type ) : object

Защищенные методы

Метод Описание
RemoveDependencies ( object val ) : void

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

Метод Описание
ConvertSetting ( object val, ISetting setting ) : object
Instantiate ( Factory step, object>.Dictionary args ) : object
InvokeCommand ( Command cmd, object>.Dictionary args ) : object
InvokeConstructor ( ConstructorInfo ctor ) : object
LogSettingNameValue ( StringBuilder sb, string name, ISetting setting, object val ) : void
LogSettingValue ( StringBuilder sb, ISetting setting, object val ) : void
PrepareCommandArguments ( Command cmd, object>.Dictionary args, string &paramLog ) : object[]
PrepareSettingsCollectionArg ( Command cmd, CommandParameter param, object>.Dictionary args, StringBuilder sb ) : ISettingsCollection
PurgeSingleUseObjects ( ) : void

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

Context() публичный Метод

public Context ( Registry registry ) : System
registry Registry
Результат System

Context() публичный Метод

public Context ( Registry registry, object>.Func missingArgHandler ) : System
registry Registry
missingArgHandler object>.Func
Результат System

FindPathToType() публичный Метод

Determines the sequence of command invocations, property accesses, and constructor calls that are required to instantiate an object of the requested type, given the current state of the context.
Throws ContextException if an object of the desired type /// cannot be created from the current context. ///
public FindPathToType ( Type t, Command cmd ) : Stack
t System.Type
cmd Command
Результат Stack

GetSettings() публичный Метод

Returns the SettingAttributes for the specified type.
public GetSettings ( Type type ) : List
type System.Type
Результат List

HasObject() публичный Метод

Returns true if the Context currently contains an instance of the requested type.
public HasObject ( Type type ) : bool
type System.Type
Результат bool

Invoke() публичный Метод

Invoke an instance of the named command, using the supplied arguments dictionary to obtain parameter values. If necessary, this will execute Factory constructors, properties, and commands to obtain the necessary source object on which to invoke the command.
public Invoke ( string command, object>.Dictionary args ) : object
command string
args object>.Dictionary
Результат object

Remove() публичный Метод

Removes the first object that is an instance of type.
public Remove ( Type type ) : object
type System.Type
Результат object

RemoveDependencies() защищенный Метод

protected RemoveDependencies ( object val ) : void
val object
Результат void

Set() публичный Метод

Sets an object in the context. Only a single object of a given type is permitted, so any existing object of this type is replaced.
public Set ( object value ) : void
value object
Результат void

Set() публичный Метод

Sets an object in the context. Only a single object of a given type is permitted, so any existing object of this type is replaced.
public Set ( object value, object dependency ) : void
value object
dependency object
Результат void

Verify() публичный Метод

Verifies that all commands can be invoked successfully.
public Verify ( ) : void
Результат void

this() публичный Метод

public this ( Type type ) : object
type System.Type
Результат object

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

MissingArgHandler публичное свойство

public Func MissingArgHandler
Результат object>.Func

_context защищенное свойство

protected List _context
Результат List

_dependencyList защищенное свойство

protected Dictionary> _dependencyList
Результат List>.Dictionary

_log защищенное статическое свойство

protected static ILog,log4net _log
Результат log4net.ILog

_purgeList защищенное свойство

protected List _purgeList
Результат List

_registry защищенное свойство

protected Registry,Command _registry
Результат Registry