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

Class Reflection

Library responsible for reflection.

Inheritance
System.Object
Reflection
Namespace: DotNetNuke.Framework
Assembly: DotNetNuke.dll
Syntax
public class Reflection : object

Methods

| Improve this Doc View Source

CreateInstance(Type, Object[])

Dynamically call a constructor for a type.

Declaration
public static object CreateInstance(Type type, object[] args)
Parameters
Type Name Description
Type type

The type of object to create.

System.Object[] args

The constructor arguments.

Returns
Type Description
System.Object

An instance of the object, or null if type is null.

| Improve this Doc View Source

CreateInstance(Type)

Dynamically call the empty constructor for a type.

Declaration
public static object CreateInstance(Type type)
Parameters
Type Name Description
Type type

The type of object to create.

Returns
Type Description
System.Object

An instance of the object, or null if type is null.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, bool useCache)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string typeName, string cacheKey, bool useCache)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String typeName

The fully qualified TypeName.

System.String cacheKey

The Cache Key.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, string objectNamespace, string objectAssemblyName, bool useCache)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, String, String, Boolean, Boolean)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName, bool useCache, bool fixAssemblyName)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

System.Boolean fixAssemblyName

Whether append provider name as part of the assembly name.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace, AssemblyName and ProviderName.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName, bool useCache)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, String, String)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String, String)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType, string objectNamespace, string objectAssemblyName)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String, String)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string typeName, string cacheKey)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String typeName

The fully qualified TypeName.

System.String cacheKey

The Cache Key.

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, String)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, string objectProviderType)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

System.String objectProviderType

The type of Object to create (data/navigation).

Returns
Type Description
System.Object

The created Object.

| Improve this Doc View Source

CreateObject(IServiceProvider, Type)

Creates an object.

Declaration
public static object CreateObject(IServiceProvider serviceProvider, Type type)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

Type type

The type of object to create.

Returns
Type Description
System.Object

The created object.

| Improve this Doc View Source

CreateObject(String, Boolean)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, bool useCache)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider configured in web.config.

| Improve this Doc View Source

CreateObject(String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(string typeName, string cacheKey, bool useCache)
Parameters
Type Name Description
System.String typeName

The fully qualified TypeName.

System.String cacheKey

The Cache Key.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload that takes a fully-qualified typename and a Cache Key.

| Improve this Doc View Source

CreateObject(String, String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, string objectNamespace, string objectAssemblyName, bool useCache)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace and AssemblyName ( this allows derived providers to share the same config ).

| Improve this Doc View Source

CreateObject(String, String, String, String, Boolean, Boolean)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName, bool useCache, bool fixAssemblyName)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

System.Boolean fixAssemblyName

Whether append provider name as part of the assembly name.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace, AssemblyName and ProviderName.

| Improve this Doc View Source

CreateObject(String, String, String, String, Boolean)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName, bool useCache)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

System.Boolean useCache

Caching switch.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace, AssemblyName and ProviderName.

| Improve this Doc View Source

CreateObject(String, String, String, String)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, string objectProviderName, string objectNamespace, string objectAssemblyName)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectProviderName

The name of the Provider.

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace, AssemblyName and ProviderName.

| Improve this Doc View Source

CreateObject(String, String, String)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType, string objectNamespace, string objectAssemblyName)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

System.String objectNamespace

The namespace of the object to create.

System.String objectAssemblyName

The assembly of the object to create.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider including NameSpace and AssemblyName ( this allows derived providers to share the same config ).

| Improve this Doc View Source

CreateObject(String, String)

Creates an object.

Declaration
public static object CreateObject(string typeName, string cacheKey)
Parameters
Type Name Description
System.String typeName

The fully qualified TypeName.

System.String cacheKey

The Cache Key.

Returns
Type Description
System.Object

The created Object.

Remarks

Overload that takes a fully-qualified typename and a Cache Key.

| Improve this Doc View Source

CreateObject(String)

Creates an object.

Declaration
public static object CreateObject(string objectProviderType)
Parameters
Type Name Description
System.String objectProviderType

The type of Object to create (data/navigation).

Returns
Type Description
System.Object

The created Object.

Remarks

Overload for creating an object from a Provider configured in web.config.

| Improve this Doc View Source

CreateObject(Type)

Creates an object.

Declaration
public static object CreateObject(Type type)
Parameters
Type Name Description
Type type

The type of object to create.

Returns
Type Description
System.Object

The created object.

| Improve this Doc View Source

CreateObject<T>()

Creates an object.

Declaration
public static T CreateObject<T>()
Returns
Type Description
T

The created object.

Type Parameters
Name Description
T

The type of object to create.

Remarks

Generic version.

| Improve this Doc View Source

CreateObject<T>(IServiceProvider)

Creates an object.

Declaration
public static T CreateObject<T>(IServiceProvider serviceProvider)
Parameters
Type Name Description
IServiceProvider serviceProvider

The DI container.

Returns
Type Description
T

The created object.

Type Parameters
Name Description
T

The type of object to create.

| Improve this Doc View Source

CreateType(String, Boolean)

Creates a type. Caches type creation for performance.

Declaration
public static Type CreateType(string typeName, bool ignoreErrors)
Parameters
Type Name Description
System.String typeName

The name of the type to create.

System.Boolean ignoreErrors

Whether to log exceptions.

Returns
Type Description
Type

The instance or null.

| Improve this Doc View Source

CreateType(String, String, Boolean, Boolean)

Creates a type.

Declaration
public static Type CreateType(string typeName, string cacheKey, bool useCache, bool ignoreErrors)
Parameters
Type Name Description
System.String typeName

The name of the type to create.

System.String cacheKey

A custom cache key; otherwise typeName is used as the key.

System.Boolean useCache

Whether to store the type in the cache or bypass the cache.

System.Boolean ignoreErrors

Whether to log exceptions.

Returns
Type Description
Type

The instance or null.

| Improve this Doc View Source

CreateType(String, String, Boolean)

Creates a type. Errors creating the type are logged.

Declaration
public static Type CreateType(string typeName, string cacheKey, bool useCache)
Parameters
Type Name Description
System.String typeName

The name of the type to create.

System.String cacheKey

A custom cache key; otherwise typeName is used as the key.

System.Boolean useCache

Whether to store the type in the cache or bypass the cache.

Returns
Type Description
Type

The instance or null.

| Improve this Doc View Source

CreateType(String)

Creates a type. Caches type creation for performance. Errors creating the type are logged.

Declaration
public static Type CreateType(string typeName)
Parameters
Type Name Description
System.String typeName

The name of the type to create.

Returns
Type Description
Type

The instance or null.

| Improve this Doc View Source

GetProperty(Type, String, Object)

Dynamically get the value of a property.

Declaration
public static object GetProperty(Type type, string propertyName, object target)
Parameters
Type Name Description
Type type

The type of target.

System.String propertyName

The name of the property to get.

System.Object target

The object from which to read the property.

Returns
Type Description
System.Object

The property's value, or null if type is null.

| Improve this Doc View Source

InvokeMethod(Type, String, Object, Object[])

Dynamically invoke a method on an object.

Declaration
public static void InvokeMethod(Type type, string propertyName, object target, object[] args)
Parameters
Type Name Description
Type type

The type of target.

System.String propertyName

The name of the method to invoke.

System.Object target

The object on which to invoke the method.

System.Object[] args

The input to the method.

| Improve this Doc View Source

SetProperty(Type, String, Object, Object[])

Dynamically set the value of a property.

Declaration
public static void SetProperty(Type type, string propertyName, object target, object[] args)
Parameters
Type Name Description
Type type

The type of target.

System.String propertyName

The name of the property to set.

System.Object target

The object on which to set the property.

System.Object[] args

The input to the property.

Extension Methods

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