![]() |
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Implements the IBeanContext interface to manage singleton instances, handle auto-binding of dependencies, and scan classes in assemblies. More...
Public Member Functions | |
BeanContext () | |
Initializes a new instance of the BeanContext class. | |
T | CreateSingleton< T > (params object[] args) |
Creates a singleton instance of the specified type. | |
object | CreateSingleton (System.Type type, params object[] args) |
Creates a singleton instance of the specified type. | |
T | GetSingleton< T > () |
Gets a singleton instance of the specified type. | |
object | GetSingleton (System.Type type) |
Gets a singleton instance of the specified type. | |
void | SetSingleton (object singletonObj, System.Type type) |
Sets a singleton instance for the specified type. | |
void | SetSingleton< T > (T singletonObj) |
Sets a singleton instance for the specified type. | |
System.Collections.Generic.IEnumerable< object > | GetSingletons () |
Gets all singleton instances in the context. | |
void | AutoBind (object singletonObj) |
Automatically binds dependencies to the specified singleton object. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClass (string prefixNamespace) |
Scans and retrieves types within the specified namespace. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClass (string prefixNamespace, System.Collections.Generic.IEnumerable< Assembly > assemblies) |
Scans and retrieves types within the specified namespace and assemblies. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClassHasCustomAttribute (System.Type type, bool inherit) |
Scans and retrieves types that have the specified custom attribute. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClassHasCustomAttribute (System.Type type, bool inherit, System.Collections.Generic.IEnumerable< Assembly > assemblies) |
Scans and retrieves types that have the specified custom attribute within the specified assemblies. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClassFromAssignable (System.Type type) |
Scans and retrieves types that are assignable to the specified type. | |
System.Collections.Generic.IEnumerable< System.Type > | ScanClassFromAssignable (System.Type type, System.Collections.Generic.IEnumerable< Assembly > assemblies) |
Scans and retrieves types that are assignable to the specified type within the specified assemblies. | |
![]() | |
![]() | |
![]() |
Implements the IBeanContext interface to manage singleton instances, handle auto-binding of dependencies, and scan classes in assemblies.
void XmobiTea.Bean.BeanContext.AutoBind | ( | object | singletonObj | ) |
Automatically binds dependencies to the specified singleton object.
singletonObj | The singleton object to bind. |
Implements XmobiTea.Bean.IAutoBindingContext.
object XmobiTea.Bean.BeanContext.CreateSingleton | ( | System.Type | type, |
params object[] | args ) |
Creates a singleton instance of the specified type.
type | The type of the singleton to create. |
args | The arguments for the constructor. |
Implements XmobiTea.Bean.ISingletonContext.
T XmobiTea.Bean.BeanContext.CreateSingleton< T > | ( | params object[] | args | ) |
Creates a singleton instance of the specified type.
T | The type of the singleton to create. |
args | The arguments for the constructor. |
Implements XmobiTea.Bean.ISingletonContext.
object XmobiTea.Bean.BeanContext.GetSingleton | ( | System.Type | type | ) |
Gets a singleton instance of the specified type.
type | The type of the singleton. |
Implements XmobiTea.Bean.ISingletonContext.
T XmobiTea.Bean.BeanContext.GetSingleton< T > | ( | ) |
Gets a singleton instance of the specified type.
T | The type of the singleton. |
Implements XmobiTea.Bean.ISingletonContext.
System.Collections.Generic.IEnumerable< object > XmobiTea.Bean.BeanContext.GetSingletons | ( | ) |
Gets all singleton instances in the context.
Implements XmobiTea.Bean.ISingletonContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClass | ( | string | prefixNamespace | ) |
Scans and retrieves types within the specified namespace.
prefixNamespace | The namespace to scan. |
Implements XmobiTea.Bean.IClassScannerContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClass | ( | string | prefixNamespace, |
System.Collections.Generic.IEnumerable< Assembly > | assemblies ) |
Scans and retrieves types within the specified namespace and assemblies.
prefixNamespace | The namespace to scan. |
assemblies | The assemblies to scan. |
Implements XmobiTea.Bean.IClassScannerContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClassFromAssignable | ( | System.Type | type | ) |
Scans and retrieves types that are assignable to the specified type.
type | The type to scan for assignable types. |
Implements XmobiTea.Bean.IClassScannerContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClassFromAssignable | ( | System.Type | type, |
System.Collections.Generic.IEnumerable< Assembly > | assemblies ) |
Scans and retrieves types that are assignable to the specified type within the specified assemblies.
type | The type to scan for assignable types. |
assemblies | The assemblies to scan. |
Implements XmobiTea.Bean.IClassScannerContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClassHasCustomAttribute | ( | System.Type | type, |
bool | inherit ) |
Scans and retrieves types that have the specified custom attribute.
type | The custom attribute type to scan for. |
inherit | Whether to scan for inherited attributes. |
Implements XmobiTea.Bean.IClassScannerContext.
System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClassHasCustomAttribute | ( | System.Type | type, |
bool | inherit, | ||
System.Collections.Generic.IEnumerable< Assembly > | assemblies ) |
Scans and retrieves types that have the specified custom attribute within the specified assemblies.
type | The custom attribute type to scan for. |
inherit | Whether to scan for inherited attributes. |
assemblies | The assemblies to scan. |
Implements XmobiTea.Bean.IClassScannerContext.
void XmobiTea.Bean.BeanContext.SetSingleton | ( | object | singletonObj, |
System.Type | type ) |
Sets a singleton instance for the specified type.
singletonObj | The singleton instance. |
type | The type to associate with the singleton. |
Implements XmobiTea.Bean.ISingletonContext.
void XmobiTea.Bean.BeanContext.SetSingleton< T > | ( | T | singletonObj | ) |
Sets a singleton instance for the specified type.
T | The type to associate with the singleton. |
singletonObj | The singleton instance. |
Implements XmobiTea.Bean.ISingletonContext.