PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.FlexiConstructor Class Reference

Provides a static method to construct other entities with a more flexible parameter ordering: More...

Static Public Member Functions

static T Construct< T > (params object[] args)
 Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary.
static T Construct< T > (ConstructFlags flags, params object[] args)
 Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary.
static T Construct< T > (Func< Type, object > fallbackFactory, params object[] args)
 Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary. The provided fallbackFactory is used for missing dependencies instead of simply providing the default value.
static T Construct< T > (Func< Type, object > fallbackFactory, ConstructFlags flags, params object[] args)
 Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary. The provided fallbackFactory is used for missing dependencies instead of simply providing the default value.

Detailed Description

Provides a static method to construct other entities with a more flexible parameter ordering:

  • parameters are fed in the order of "first with matching type"
  • missing parameters are fed in as the default value for the type

Member Function Documentation

◆ Construct< T >() [1/4]

T PeanutButter.Utils.FlexiConstructor.Construct< T > ( ConstructFlags flags,
params object[] args )
static

Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary.

Parameters
flags
args
Template Parameters
T
Returns

◆ Construct< T >() [2/4]

T PeanutButter.Utils.FlexiConstructor.Construct< T > ( Func< Type, object > fallbackFactory,
ConstructFlags flags,
params object[] args )
static

Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary. The provided fallbackFactory is used for missing dependencies instead of simply providing the default value.

Parameters
fallbackFactory
flags
args
Template Parameters
T
Returns

◆ Construct< T >() [3/4]

T PeanutButter.Utils.FlexiConstructor.Construct< T > ( Func< Type, object > fallbackFactory,
params object[] args )
static

Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary. The provided fallbackFactory is used for missing dependencies instead of simply providing the default value.

Parameters
fallbackFactory
args
Template Parameters
T
Returns

◆ Construct< T >() [4/4]

T PeanutButter.Utils.FlexiConstructor.Construct< T > ( params object[] args)
static

Attempts to construct the type T with the provided constructor parameters, re-ordering as necessary.

  • will provide default values for missing parameters
  • will attempt basic type changes to satisfy the constructor
Parameters
args
Template Parameters
T
Returns

The documentation for this class was generated from the following file:
  • source/Utils/PeanutButter.Utils/FlexiConstructor.cs