Show / Hide Table of Contents

Class FactoryUtils

Provides helper methods for dynamic object creation and configuration

Inheritance
System.Object
FactoryUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.Environment
Assembly: NFX.dll
Syntax
public static class FactoryUtils

Fields

CONFIG_TYPE_ATTR

Declaration
public const string CONFIG_TYPE_ATTR = "type"
Field Value
Type Description
System.String

Methods

Make<T>(IConfigSectionNode, Type, Object[])

Creates an instance of appropriate configurable object as specified in supplied config node. This function does not configure the instance

Declaration
public static T Make<T>(IConfigSectionNode node, Type defaultType = null, object[] args = null)
Parameters
Type Name Description
IConfigSectionNode node
System.Type defaultType
System.Object[] args
Returns
Type Description
T
Type Parameters
Name Description
T

MakeAndConfigure(IConfigSectionNode, Type, Object[])

Creates and configures an instance of appropriate configurable object as specified in supplied config node. Applies configured behaviours

Declaration
public static IConfigurable MakeAndConfigure(IConfigSectionNode node, Type defaultType = null, object[] args = null)
Parameters
Type Name Description
IConfigSectionNode node
System.Type defaultType
System.Object[] args
Returns
Type Description
IConfigurable

MakeAndConfigure<T>(IConfigSectionNode, Type, Object[])

Creates and configures an instance of appropriate configurable object as specified in supplied config node. Applies configured behaviours

Declaration
public static T MakeAndConfigure<T>(IConfigSectionNode node, Type defaultType = null, object[] args = null)where T : IConfigurable
Parameters
Type Name Description
IConfigSectionNode node
System.Type defaultType
System.Object[] args
Returns
Type Description
T
Type Parameters
Name Description
T

MakeUsingCtor<T>(IConfigSectionNode, String)

Invokes a constructor for type feeding it the specified args: node{type="NS.Type, Assembly" arg0=1 arg1=true....} If the typePattern is passed, then the '*' in pattern is replaced with 'type' attr content. This is needed for security, as this method allows to inject any type with any ctor params when typePattern is null

Declaration
public static T MakeUsingCtor<T>(IConfigSectionNode node, string typePattern = null)
Parameters
Type Name Description
IConfigSectionNode node
System.String typePattern
Returns
Type Description
T
Type Parameters
Name Description
T
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX