C# Class 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.
Afficher le fichier Open project: agardiner/hfmcmd

Méthodes publiques

Свойство Type Description
MissingArgHandler object>.Func

Protected Properties

Свойство Type Description
_context List
_dependencyList List>.Dictionary
_log log4net.ILog
_purgeList List
_registry Registry

Méthodes publiques

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

Méthodes protégées

Méthode Description
RemoveDependencies ( object val ) : void

Private Methods

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

Method Details

Context() public méthode

public Context ( Registry registry ) : System
registry Registry
Résultat System

Context() public méthode

public Context ( Registry registry, object>.Func missingArgHandler ) : System
registry Registry
missingArgHandler object>.Func
Résultat System

FindPathToType() public méthode

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

GetSettings() public méthode

Returns the SettingAttributes for the specified type.
public GetSettings ( Type type ) : List
type System.Type
Résultat List

HasObject() public méthode

Returns true if the Context currently contains an instance of the requested type.
public HasObject ( Type type ) : bool
type System.Type
Résultat bool

Invoke() public méthode

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

Remove() public méthode

Removes the first object that is an instance of type.
public Remove ( Type type ) : object
type System.Type
Résultat object

RemoveDependencies() protected méthode

protected RemoveDependencies ( object val ) : void
val object
Résultat void

Set() public méthode

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

Set() public méthode

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

Verify() public méthode

Verifies that all commands can be invoked successfully.
public Verify ( ) : void
Résultat void

this() public méthode

public this ( Type type ) : object
type System.Type
Résultat object

Property Details

MissingArgHandler public_oe property

public Func MissingArgHandler
Résultat object>.Func

_context protected_oe property

protected List _context
Résultat List

_dependencyList protected_oe property

protected Dictionary> _dependencyList
Résultat List>.Dictionary

_log protected_oe static_oe property

protected static ILog,log4net _log
Résultat log4net.ILog

_purgeList protected_oe property

protected List _purgeList
Résultat List

_registry protected_oe property

protected Registry,Command _registry
Résultat Registry