Class CreateInstanceOptions<T>
Class representing the options for the create instance feature.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public class CreateInstanceOptions<T> : ICreateInstanceOptionsComplete<T>, IIncludeExcludeOptions<T>, IFactoryOptionsConstistent<T>, IFactoryOptionsInconsistent<T>, ICreateInstanceOptions<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The type of the instance to create. |
Properties
| Improve this Doc View SourceAnonymousItemName
Gets the name to use for anonymous items.
Declaration
public string AnonymousItemName { get; }
Property Value
Type | Description |
---|---|
System.String | The name to use for anonymous items. |
Implements
| Improve this Doc View SourceFactories
Gets all factories.
Declaration
public List<IInstanceFactory> Factories { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><IInstanceFactory> | All factories. |
Implements
| Improve this Doc View SourceMemberChildrenSelectionRules
Gets all member-children selection rules.
Declaration
public List<IMemberSelectionRule> MemberChildrenSelectionRules { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><IMemberSelectionRule> | All member-children selection rules. |
Implements
| Improve this Doc View SourceMemberSelectionRules
Gets all member selection rules.
Declaration
public List<IMemberSelectionRule> MemberSelectionRules { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<T><IMemberSelectionRule> | All member selection rules. |
Implements
| Improve this Doc View SourcePopulateCollections
Gets a value determining whether collection members should be populated or not.
Declaration
public bool ? PopulateCollections { get; }
Property Value
Type | Description |
---|---|
System.Nullable<T><System.Boolean> | A value determining whether collection members should be populated or not. |
Implements
| Improve this Doc View SourcePopulateCollectionsMaxCount
Gets the maximum number of items to create.
Declaration
public int ? PopulateCollectionsMaxCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<T><System.Int32> | The maximum number of items to create. |
Implements
| Improve this Doc View SourcePopulateCollectionsMinCount
Gets the minimum number of items to create.
Declaration
public int ? PopulateCollectionsMinCount { get; }
Property Value
Type | Description |
---|---|
System.Nullable<T><System.Int32> | The minimum number of items to create. |
Implements
Methods
| Improve this Doc View SourceAllMembers()
Matches all members.
Declaration
public IIncludeExcludeOptions<T> AllMembers()
Returns
Type | Description |
---|---|
IIncludeExcludeOptions<T><T> | Returns the modified options. |
Implements
| Improve this Doc View SourceByPath(Expression<Func<T, Object>>)
Matches for members which have a matching path.
Declaration
public IIncludeExcludeOptions<T> ByPath(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><T, System.Object>> | expression | Expression representing the member path. |
Returns
Type | Description |
---|---|
IIncludeExcludeOptions<T><T> | Returns the modified options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | expression can no the null. |
ByPath(String)
Matches for members which have a matching path.
Declaration
public IIncludeExcludeOptions<T> ByPath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The member path. |
Returns
Type | Description |
---|---|
IIncludeExcludeOptions<T><T> | Returns the modified options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | path can no the null. |
Complete()
Ends the configuration and returns the configuration result.
Declaration
public ICreateInstanceOptionsComplete<T> Complete()
Returns
Type | Description |
---|---|
ICreateInstanceOptionsComplete<T><T> | Returns the completely configured create instance options. |
Implements
| Improve this Doc View SourceExcluding(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Excludes all members matching the specified options.
Declaration
public ICreateInstanceOptions<T> Excluding(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
Excluding(Func<IMemberInformation, Boolean>)
Excludes all members matching the given predicate.
Declaration
public ICreateInstanceOptions<T> Excluding(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members to exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
ExcludingChildrenOf(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Excludes the children of all members matching the specified options. The members themselves will still get created.
Declaration
public ICreateInstanceOptions<T> ExcludingChildrenOf(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
ExcludingChildrenOf(Func<IMemberInformation, Boolean>)
Excludes the children of all members matching the given predicate. The members themselves will still get created.
Declaration
public ICreateInstanceOptions<T> ExcludingChildrenOf(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members to exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
For(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Factory will be used to create values for members matching the specified options.
Declaration
public IFactoryOptionsConstistent<T> For(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the factory. |
Returns
Type | Description |
---|---|
IFactoryOptionsConstistent<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
For(Func<IMemberInformation, Boolean>)
Factory will be used to create values for members matching the given predicate.
Declaration
public IFactoryOptionsConstistent<T> For(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members which should get created by the factory. |
Returns
Type | Description |
---|---|
IFactoryOptionsConstistent<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
Including(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Includes all members matching the specified options.
Declaration
public ICreateInstanceOptions<T> Including(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
Including(Func<IMemberInformation, Boolean>)
Includes all members matching the given predicate.
Declaration
public ICreateInstanceOptions<T> Including(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members to include. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
IncludingChildrenOf(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Includes the children of all members matching the specified options.
Declaration
public ICreateInstanceOptions<T> IncludingChildrenOf(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the exclude. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
IncludingChildrenOf(Func<IMemberInformation, Boolean>)
Includes the children of all members matching the given predicate.
Declaration
public ICreateInstanceOptions<T> IncludingChildrenOf(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members to include. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
IsNotTypeOf<TTarget>()
Adds a type based member selection rule.
Declaration
public IIncludeExcludeOptions<T> IsNotTypeOf<TTarget>()
Returns
Type | Description |
---|---|
IIncludeExcludeOptions<T><T> | Returns the modified options. |
Type Parameters
Name | Description |
---|---|
TTarget | The type to match. |
Implements
| Improve this Doc View SourceIsTypeOf<TTarget>()
Adds a type based member selection rule.
Declaration
public IIncludeExcludeOptions<T> IsTypeOf<TTarget>()
Returns
Type | Description |
---|---|
IIncludeExcludeOptions<T><T> | Returns the modified options. |
Type Parameters
Name | Description |
---|---|
TTarget | The type to match. |
Implements
| Improve this Doc View SourceNotFor(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>>)
Factory will NOT be used to create values for members matching the specified options.
Declaration
public IFactoryOptionsConstistent<T> NotFor(Func<IIncludeExcludeOptions<T>, IIncludeExcludeOptions<T>> configurationFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IIncludeExcludeOptions<T><T>, IIncludeExcludeOptions<T><T>> | configurationFunc | Function used to configure the factory. |
Returns
Type | Description |
---|---|
IFactoryOptionsConstistent<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | configurationFunc can not be null. |
NotFor(Func<IMemberInformation, Boolean>)
Factory will NOT be used to create values for members matching the given predicate.
Declaration
public IFactoryOptionsConstistent<T> NotFor(Func<IMemberInformation, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Boolean> | predicate | The predicate used to find the members which should NOT get created by the factory. |
Returns
Type | Description |
---|---|
IFactoryOptionsConstistent<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | predicate can not be null. |
PopulateCollectionItemCount(Nullable<Int32>, Nullable<Int32>)
Configures the number of items to create for collection members.
Declaration
public ICreateInstanceOptions<T> PopulateCollectionItemCount(int ? min, int ? max)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<T><System.Int32> | min | The minimum number of items to create. |
System.Nullable<T><System.Int32> | max | The maximum number of items to create. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Maximum is not greater than minimum. |
PopulateCollectionMembers(Nullable<Boolean>)
Configures the creation of collection items.
Declaration
public ICreateInstanceOptions<T> PopulateCollectionMembers(bool ? populateCollections)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<T><System.Boolean> | populateCollections | A value determining whether items for collection types should be created or not. Null means use default configuration. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
| Improve this Doc View SourceSetAnonymousItemName(String)
Configures the name of anonymous items.
Declaration
public ICreateInstanceOptions<T> SetAnonymousItemName(string anonymousItemName)
Parameters
Type | Name | Description |
---|---|---|
System.String | anonymousItemName | The name used for anonymous items, or null to use global configuration. |
Returns
Type | Description |
---|---|
ICreateInstanceOptions<T><T> | Returns the modified create instance options. |
Implements
| Improve this Doc View SourceWithFactory(Func<IMemberInformation, Object>)
Adds the given factory to the value providers.
Declaration
public IFactoryOptionsInconsistent<T> WithFactory(Func<IMemberInformation, object> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, TResult><IMemberInformation, System.Object> | factory | The factory to add. |
Returns
Type | Description |
---|---|
IFactoryOptionsInconsistent<T><T> | Returns the modified create instance options. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | factory can not be null. |