Interface for the application context.
Default constructor
public Void ApplicationContext()
Provides access to configuration.
public IConfiguration Configuration { get; set; }
The application context.
public ApplicationContext Current { get; set; }
Collection of factories contained in this application context.
public ICollection<IObjectFactory> Factories { get; }
A dictionary that holds objects of any kind.
public IDictionary<String, Object> Items { get; }
Collection of packages contained in this application context.
public ICollection<IPackage> Packages { get; }
Finds out if the application context contains a factory of the given name.
public Boolean ContainsFactory(name)
true if the object factory exists or false otherwise.
Name | Type | Summary |
---|---|---|
name | String | The name of the object factory to verify. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when the name is null or empty. |
Finds out if the application context contains an object of the given name.
public Boolean ContainsObject(name)
true if the application context contains the object or false if not.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to verify. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when the name is null or empty. |
Finds out if the application context contains an object of the given Type.
public Boolean ContainsObject(objectType)
true if the application context contains the object or false if not.
Name | Type | Summary |
---|---|---|
objectType | Type | The Type of the object to verify. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when objectType is null. |
Find out if the application context contains a package of the given name.
public Boolean ContainsPackage(name)
true if the application context contains the software package or false if not.
Name | Type | Summary |
---|---|---|
name | String | The name of the package to verify. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when the name is null or empty. |
Performs application specific clean up.
public Void Dispose()
Retrieves the object factory of the given name.
public IObjectFactory GetFactory(name)
The IObjectFactory of the given name.
Name | Type | Summary |
---|---|---|
name | String | The name of the object factory to retrive. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when the name is null or empty. |
NoSuchFactoryException | Thown when the specify object factory does not exists. |
Retrieves an initialized instance of the object for the given type
public GetObject<T>()
Retrieves an initialized instance of the object for the given type
public GetObject<T>(args)
Name | Type | Summary |
---|---|---|
args | Object[] | Constructor arguments. |
Type | Summary |
---|---|
NoSuchObjectException | Thrown when the Factory does not contains the required object. |
Retrieves an initialized instance of the object of the given name.
public Object GetObject(name)
The object of the given name.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to retrieve. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Retrieves an initialized instance of the object of the given name throwing an exception only id specified.
public Object GetObject(name, thrown)
The object of the given name.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to retrieve. |
thrown | Boolean | true if an exception should be thrown or false if null should be returned. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Retrieves an initialized instance of the object for the given name, passing the arguments to the object constructor.
public Object GetObject(name, args)
The context object.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to retrive. |
args | Object[] | The arguments to pass to the constructor. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Retrives an initialized instance of the object of the given name only if it is of the given Type.
public Object GetObject(name, requiredType)
The object of the given name.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to retrive. |
requiredType | Type | The required Type of the object. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
ObjectNotOfRequiredTypeException | Thrown the the object is not of the required type. |
Retrieves an initialized instance of the first object of objectType type.
public Object GetObject(objectType)
Name | Type | Summary |
---|---|---|
objectType | Type | The exact type of the object to retrive. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when objectType is null. |
NoSuchObjectException | Thrown when there is no objects of the required object. |
Retrieves an initialized instance of the first object of objectType type.
public Object GetObject(objectType, args)
Name | Type | Summary |
---|---|---|
objectType | Type | The exact type of the object to retrive. |
args | Object[] | Constructor arguments. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when objectType is null. |
NoSuchObjectException | Thrown when there is no objects of the required object. |
Get a list of objects that are assignable from type
public IEnumerable GetObjectsAssignableFrom<T>()
A list of objects assignable from type
Get a list of objects that are assignable from type.
public IEnumerable<Object> GetObjectsAssignableFrom(type)
A list of objects assignable from type type.
Name | Type | Summary |
---|---|---|
type | Type | The type that the objects are assignable from. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when type is null. |
Retrieves a list of initialized context object that are assignable from type type.
public IEnumerable<Object> GetObjectsOfContextAssignableFrom(type)
A list of objects assignable from type.
Name | Type | Summary |
---|---|---|
type | Type | The type that the objects are asignable from. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when type is null. |
Retrieves a list of initialized context object that are assignable from type
public IEnumerable GetObjectsOfContextAssignableFrom<T>()
A list of objects assignable from type
Retrieves the software package of the given name.
public IPackage GetPackage(name)
The software package of the given name.
Name | Type | Summary |
---|---|---|
name | String | The name of the package to retrives. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchPackageException | Thown the the required package does not exists. |
Retrives the Type of the object of the given name.
public Type GetType(name)
The Type of the context object.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to retrive it's type. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Inject into the object o the dependencies of an object named name.
public Void InjectDependencies(name, o)
Name | Type | Summary |
---|---|---|
name | String | The name of the object to get it's dependencies. |
o | Object | The object where to inject the dependencies. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
ArgumentNullException | Thrown when o is null. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Finds out if the object of the given name is a singleton.
public Boolean IsSingleton(name)
true if the object is a singleton or false if not.
Name | Type | Summary |
---|---|---|
name | String | The name of the object to verify. |
Type | Summary |
---|---|
ArgumentNullOrEmptyException | Thrown when name is null or empty. |
NoSuchObjectException | Thrown when there is not object of the given name. |
Adds the specified IObjectFactory to the factory list.
public Void RegisterFactory(factory)
Name | Type | Summary |
---|---|---|
factory | IObjectFactory | The factory to add to the application context. |
Type | Summary |
---|---|
ArgumentNullException | Thown when factory is null. |
ContextConfigurationException | Thown when a factory with the same name already exists. |
Adds the specified software package to the packages list.
public Void RegisterPackage(package)
Name | Type | Summary |
---|---|---|
package | IPackage | The package to add to the application context. |
Type | Summary |
---|---|
ArgumentNullException | Thown when the argument package is null. |
ContextConfigurationException | Thrown when package configuration is invalid. |
Returns a textual representation of the object.
public String ToString()
In this document