Class ObjectFactoryBase
Represents an abstract class for Object Factory.
Inherited Members
Namespace: Swan.DependencyInjection
Syntax
public abstract class ObjectFactoryBase
Properties
AssumeConstruction
Whether to assume this factory successfully constructs its objects
Generally set to true for delegate style factories as CanResolve cannot delve into the delegates they contain.
Declaration
public virtual bool AssumeConstruction { get; }
Property Value
Type | Description |
---|---|
Boolean |
Constructor
Constructor to use, if specified.
Declaration
public ConstructorInfo Constructor { get; }
Property Value
Type | Description |
---|---|
ConstructorInfo |
CreatesType
The type the factory instantiates.
Declaration
public abstract Type CreatesType { get; }
Property Value
Type | Description |
---|---|
Type |
MultiInstanceVariant
Gets the multi instance variant.
Declaration
public virtual ObjectFactoryBase MultiInstanceVariant { get; }
Property Value
Type | Description |
---|---|
ObjectFactoryBase | The multi instance variant. |
Exceptions
Type | Condition |
---|---|
DependencyContainerRegistrationException | multi-instance. |
SingletonVariant
Gets the singleton variant.
Declaration
public virtual ObjectFactoryBase SingletonVariant { get; }
Property Value
Type | Description |
---|---|
ObjectFactoryBase | The singleton variant. |
Exceptions
Type | Condition |
---|---|
DependencyContainerRegistrationException | singleton. |
StrongReferenceVariant
Gets the strong reference variant.
Declaration
public virtual ObjectFactoryBase StrongReferenceVariant { get; }
Property Value
Type | Description |
---|---|
ObjectFactoryBase | The strong reference variant. |
Exceptions
Type | Condition |
---|---|
DependencyContainerRegistrationException | strong reference. |
WeakReferenceVariant
Gets the weak reference variant.
Declaration
public virtual ObjectFactoryBase WeakReferenceVariant { get; }
Property Value
Type | Description |
---|---|
ObjectFactoryBase | The weak reference variant. |
Exceptions
Type | Condition |
---|---|
DependencyContainerRegistrationException | weak reference. |
Methods
GetFactoryForChildContainer(Type, DependencyContainer, DependencyContainer)
Gets the factory for child container.
Declaration
public virtual ObjectFactoryBase GetFactoryForChildContainer(Type type, DependencyContainer parent, DependencyContainer child)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type. |
DependencyContainer | parent | The parent. |
DependencyContainer | child | The child. |
Returns
Type | Description |
---|---|
ObjectFactoryBase |
GetObject(Type, DependencyContainer, DependencyContainerResolveOptions)
Create the type.
Declaration
public abstract object GetObject(Type requestedType, DependencyContainer container, DependencyContainerResolveOptions options)
Parameters
Type | Name | Description |
---|---|---|
Type | requestedType | Type user requested to be resolved. |
DependencyContainer | container | Container that requested the creation. |
DependencyContainerResolveOptions | options | The options. |
Returns
Type | Description |
---|---|
Object | Instance of type. |