• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class IocUtil

Inheritance
System.Object
IocUtil
Namespace: Dnn.PersonaBar.Library.Common
Assembly: Dnn.PersonaBar.Library.dll
Syntax
public class IocUtil : object

Methods

| Improve this Doc View Source

GetInstance<TContract>(String)

Declaration
public static TContract GetInstance<TContract>(string name = null)
    where TContract : class
Parameters
Type Name Description
System.String name
Returns
Type Description
TContract
Type Parameters
Name Description
TContract
| Improve this Doc View Source

GetInstanceContracts<TContract>()

Retrieves a concrete implementation of the given interface/contract.

Declaration
public static IEnumerable<TContract> GetInstanceContracts<TContract>()
    where TContract : class
Returns
Type Description
IEnumerable<TContract>

A concrete implementation of the given interface (or null if none is registered).

Type Parameters
Name Description
TContract

Contract interface for the component to get a concrete implementation of.

| Improve this Doc View Source

RegisterComponent<TContract, TConcrete>(String)

Register a component into the IOC container for later instantiation.

Declaration
public static bool RegisterComponent<TContract, TConcrete>(string name = null)
    where TContract : class where TConcrete : class, new()
Parameters
Type Name Description
System.String name

Optional name for the contract. Useful when more than once class implements the same contract.

Returns
Type Description
System.Boolean

True if the component was created; false if it was already created in the system.

Type Parameters
Name Description
TContract

Contract interface for the component to registr with the IOC container.

TConcrete

Concrete implementation class (must have apublic default constructor).

Remarks

This helper creates a singleton instance for the contract.

| Improve this Doc View Source

RegisterComponentInstance<TContract>(String, Object)

Register a specific instance into the IOC container for later use.

Declaration
public static bool RegisterComponentInstance<TContract>(string name, object instance)
    where TContract : class
Parameters
Type Name Description
System.String name

Name for the contract. Useful when more than once class implements the same contract. Pass as null when unused.

System.Object instance

Concrete implementation class (must have apublic default constructor).

Returns
Type Description
System.Boolean

True if the component was created; false if it was already created in the system.

Type Parameters
Name Description
TContract

Contract interface for the component to registr with the IOC container.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS