ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
Loading...
Searching...
No Matches
XmobiTea.Bean.BeanContext Class Reference

Implements the IBeanContext interface to manage singleton instances, handle auto-binding of dependencies, and scan classes in assemblies. More...

Inheritance diagram for XmobiTea.Bean.BeanContext:
XmobiTea.Bean.IBeanContext XmobiTea.Bean.ISingletonContext XmobiTea.Bean.IAutoBindingContext XmobiTea.Bean.IClassScannerContext

Public Member Functions

 BeanContext ()
 Initializes a new instance of the BeanContext class.
 
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.
 
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.
 
- Public Member Functions inherited from XmobiTea.Bean.ISingletonContext
- Public Member Functions inherited from XmobiTea.Bean.IAutoBindingContext
- Public Member Functions inherited from XmobiTea.Bean.IClassScannerContext

Detailed Description

Implements the IBeanContext interface to manage singleton instances, handle auto-binding of dependencies, and scan classes in assemblies.

Member Function Documentation

◆ AutoBind()

void XmobiTea.Bean.BeanContext.AutoBind ( object singletonObj)

Automatically binds dependencies to the specified singleton object.

Parameters
singletonObjThe singleton object to bind.

Implements XmobiTea.Bean.IAutoBindingContext.

◆ CreateSingleton()

object XmobiTea.Bean.BeanContext.CreateSingleton ( System.Type type,
params object[] args )

Creates a singleton instance of the specified type.

Parameters
typeThe type of the singleton to create.
argsThe arguments for the constructor.
Returns
The created singleton instance.

Implements XmobiTea.Bean.ISingletonContext.

◆ CreateSingleton< T >()

T XmobiTea.Bean.BeanContext.CreateSingleton< T > ( params object[] args)

Creates a singleton instance of the specified type.

Template Parameters
TThe type of the singleton to create.
Parameters
argsThe arguments for the constructor.
Returns
The created singleton instance.

Implements XmobiTea.Bean.ISingletonContext.

◆ GetSingleton()

object XmobiTea.Bean.BeanContext.GetSingleton ( System.Type type)

Gets a singleton instance of the specified type.

Parameters
typeThe type of the singleton.
Returns
The singleton instance.

Implements XmobiTea.Bean.ISingletonContext.

◆ GetSingleton< T >()

Gets a singleton instance of the specified type.

Template Parameters
TThe type of the singleton.
Returns
The singleton instance.

Implements XmobiTea.Bean.ISingletonContext.

◆ GetSingletons()

System.Collections.Generic.IEnumerable< object > XmobiTea.Bean.BeanContext.GetSingletons ( )

Gets all singleton instances in the context.

Returns
An enumeration of all singleton instances.

Implements XmobiTea.Bean.ISingletonContext.

◆ ScanClass() [1/2]

System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClass ( string prefixNamespace)

Scans and retrieves types within the specified namespace.

Parameters
prefixNamespaceThe namespace to scan.
Returns
An enumeration of types within the specified namespace.

Implements XmobiTea.Bean.IClassScannerContext.

◆ ScanClass() [2/2]

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.

Parameters
prefixNamespaceThe namespace to scan.
assembliesThe assemblies to scan.
Returns
An enumeration of types within the specified namespace and assemblies.

Implements XmobiTea.Bean.IClassScannerContext.

◆ ScanClassFromAssignable() [1/2]

System.Collections.Generic.IEnumerable< System.Type > XmobiTea.Bean.BeanContext.ScanClassFromAssignable ( System.Type type)

Scans and retrieves types that are assignable to the specified type.

Parameters
typeThe type to scan for assignable types.
Returns
An enumeration of types that are assignable to the specified type.

Implements XmobiTea.Bean.IClassScannerContext.

◆ ScanClassFromAssignable() [2/2]

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.

Parameters
typeThe type to scan for assignable types.
assembliesThe assemblies to scan.
Returns
An enumeration of types that are assignable to the specified type within the specified assemblies.

Implements XmobiTea.Bean.IClassScannerContext.

◆ ScanClassHasCustomAttribute() [1/2]

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.

Parameters
typeThe custom attribute type to scan for.
inheritWhether to scan for inherited attributes.
Returns
An enumeration of types that have the specified custom attribute.

Implements XmobiTea.Bean.IClassScannerContext.

◆ ScanClassHasCustomAttribute() [2/2]

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.

Parameters
typeThe custom attribute type to scan for.
inheritWhether to scan for inherited attributes.
assembliesThe assemblies to scan.
Returns
An enumeration of types that have the specified custom attribute within the specified assemblies.

Implements XmobiTea.Bean.IClassScannerContext.

◆ SetSingleton()

void XmobiTea.Bean.BeanContext.SetSingleton ( object singletonObj,
System.Type type )

Sets a singleton instance for the specified type.

Parameters
singletonObjThe singleton instance.
typeThe type to associate with the singleton.

Implements XmobiTea.Bean.ISingletonContext.

◆ SetSingleton< T >()

void XmobiTea.Bean.BeanContext.SetSingleton< T > ( T singletonObj)

Sets a singleton instance for the specified type.

Template Parameters
TThe type to associate with the singleton.
Parameters
singletonObjThe singleton instance.

Implements XmobiTea.Bean.ISingletonContext.


The documentation for this class was generated from the following file: