Class TypeFactoryVmExtensions
Includes a set of extensions for the TypeFactory class.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.ViewModelFactory.dll
Syntax
public static class TypeFactoryVmExtensions
Methods
| Edit this page View SourceAddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type)
Adds a public property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type, MethodInfo?)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type, MethodInfo? npcInvocator)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MethodInfo | npcInvocator | Method that invokes the event handler for types built
that directly implement INotifyPropertyChanged.
If omitted or set to null
( |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type, MemberAccess)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type, MemberAccess access)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MemberAccess | access | Access level of the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type, MemberAccess, bool)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type, MemberAccess access, bool @virtual)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MemberAccess | access | Access level of the new property. |
bool | virtual | If set to true, the property will be defined as virtual, allowing it to be overridden in a derived class. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type, MemberAccess, bool, MethodInfo?)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type, MemberAccess access, bool @virtual, MethodInfo? npcInvocator)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MemberAccess | access | Access level of the new property. |
bool | virtual | If set to true, the property will be defined as virtual, allowing it to be overridden in a derived class. |
MethodInfo | npcInvocator | Method that invokes the event handler for types built
that directly implement INotifyPropertyChanged.
If omitted or set to null
( |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<INotifyPropertyChanged>, string, Type, MemberAccess, MethodInfo?)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<INotifyPropertyChanged> tb, string name, Type type, MemberAccess access, MethodInfo? npcInvocator)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MemberAccess | access | Access level of the new property. |
MethodInfo | npcInvocator | Method that invokes the event handler for types built
that directly implement INotifyPropertyChanged.
If omitted or set to null
( |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty(ITypeBuilder<NotifyPropertyChangeBase>, string, Type)
Adds a new public property with change notification support to the type.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<NotifyPropertyChangeBase> tb, string name, Type type)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<NotifyPropertyChangeBase> | tb | Type builder onto which to create the new property. |
string | name | Name of the new property. |
Type | type | Type of value stored/exposed by the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A new PropertyBuildInfo that includes information on the newly created property. |
Remarks
The properties generated by this method will include a public getter and setter.
AddNpcProperty(ITypeBuilder<NotifyPropertyChangeBase>, string, Type, MemberAccess)
Adds a new public property with change notification support to the type.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<NotifyPropertyChangeBase> tb, string name, Type type, MemberAccess access)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<NotifyPropertyChangeBase> | tb | Type builder onto which to create the new property. |
string | name | Name of the new property. |
Type | type | Type of value stored/exposed by the new property. |
MemberAccess | access | Level of access for the getter and setter of the property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A new PropertyBuildInfo that includes information on the newly created property. |
Remarks
The properties generated by this method will include a public getter and setter.
AddNpcProperty(ITypeBuilder<NotifyPropertyChangeBase>, string, Type, MemberAccess, bool)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty(this ITypeBuilder<NotifyPropertyChangeBase> tb, string name, Type type, MemberAccess access, bool @virtual)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<NotifyPropertyChangeBase> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Type | type | Type of the new property. |
MemberAccess | access | Access level of the new property. |
bool | virtual | If set to true, the property will be defined as virtual, allowing it to be overridden in a derived class. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
AddNpcProperty<T>(ITypeBuilder<INotifyPropertyChanged>, string)
Adds a public property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty<T>(this ITypeBuilder<INotifyPropertyChanged> tb, string name)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
Type Parameters
Name | Description |
---|---|
T | Type of the new property. |
AddNpcProperty<T>(ITypeBuilder<INotifyPropertyChanged>, string, MethodInfo?)
Adds a property with support for change notification of value.
Declaration
public static PropertyBuildInfo AddNpcProperty<T>(this ITypeBuilder<INotifyPropertyChanged> tb, string name, MethodInfo? npcInvocator)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<INotifyPropertyChanged> | tb | The type builder in which to create the new property with support for change notification of value. |
string | name | Name of the new property. |
MethodInfo | npcInvocator | Method that invokes the event handler for types built
that directly implement INotifyPropertyChanged.
If omitted or set to null
( |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A PropertyBuildInfo that contains information about the property that has been built. |
Type Parameters
Name | Description |
---|---|
T |
AddNpcProperty<T>(ITypeBuilder<NotifyPropertyChangeBase>, string)
Adds a new public property with change notification support to the type.
Declaration
public static PropertyBuildInfo AddNpcProperty<T>(this ITypeBuilder<NotifyPropertyChangeBase> tb, string name)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<NotifyPropertyChangeBase> | tb | Type builder onto which to create the new property. |
string | name | Name of the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A new PropertyBuildInfo that includes information on the newly created property. |
Type Parameters
Name | Description |
---|---|
T | Type of value stored/exposed by the new property. |
Remarks
The properties generated by this method will include a public getter and setter.
AddNpcProperty<T>(ITypeBuilder<NotifyPropertyChanged>, string)
Adds a new public property with change notification support to the type.
Declaration
public static PropertyBuildInfo AddNpcProperty<T>(this ITypeBuilder<NotifyPropertyChanged> tb, string name)
Parameters
Type | Name | Description |
---|---|---|
ITypeBuilder<NotifyPropertyChanged> | tb | Type builder onto which to create the new property. |
string | name | Name of the new property. |
Returns
Type | Description |
---|---|
PropertyBuildInfo | A new PropertyBuildInfo that includes information on the newly created property. |
Type Parameters
Name | Description |
---|---|
T | Type of value stored/exposed by the new property. |
Remarks
The properties generated by this method will include a public getter and setter.
CreateEntityViewModelClass<TModel>(TypeFactory)
Generates a new EntityViewModel<T> implementation
defining the entity property type as TModel
.
Declaration
public static ITypeBuilder<EntityViewModel<TModel>> CreateEntityViewModelClass<TModel>(this TypeFactory factory) where TModel : notnull, new()
Parameters
Type | Name | Description |
---|---|---|
TypeFactory | factory | Type factory to use when creating the new type. |
Returns
Type | Description |
---|---|
ITypeBuilder<EntityViewModel<TModel>> | A new ITypeBuilder<T> that can be used to define any additional members of the newly created type. |
Type Parameters
Name | Description |
---|---|
TModel | Type of the Entity property. |
Remarks
The exposed properties will write back their values to the entity directly, and then trigger the PropertyChanged event with the appropriate event args.
CreateEntityViewModelClass<TModel>(TypeFactory, IEnumerable<Type>?)
Generates a new EntityViewModel<T> implementation
defining the entity property type as TModel
.
Declaration
public static ITypeBuilder<EntityViewModel<TModel>> CreateEntityViewModelClass<TModel>(this TypeFactory factory, IEnumerable<Type>? interfaces) where TModel : notnull, new()
Parameters
Type | Name | Description |
---|---|---|
TypeFactory | factory | Type factory to use when creating the new type. |
IEnumerable<Type> | interfaces | Collection of additional interfaces to be implemented by the new type. Can be set to null or an empty collection to denote that the new type does not require to implement any additional interfaces. |
Returns
Type | Description |
---|---|
ITypeBuilder<EntityViewModel<TModel>> | A new ITypeBuilder<T> that can be used to define any additional members of the newly created type. |
Type Parameters
Name | Description |
---|---|
TModel | Type of the Entity property. |
Remarks
The exposed properties will write back their values to the entity directly, and then trigger the PropertyChanged event with the appropriate event args.
CreateNpcClass<TModel>(TypeFactory)
Generates a new public class that implements the ViewModel pattern
through the NotifyPropertyChanged base class, and
includes all public properties from the specified
TModel
type as properties with change
notification support.
Declaration
public static ITypeBuilder<INotifyPropertyChanged> CreateNpcClass<TModel>(this TypeFactory factory) where TModel : notnull, new()
Parameters
Type | Name | Description |
---|---|---|
TypeFactory | factory | Type factory to use when creating the new type. |
Returns
Type | Description |
---|---|
ITypeBuilder<INotifyPropertyChanged> | A new TypeBuilder that can be used to define any additional members of the newly created type. |
Type Parameters
Name | Description |
---|---|
TModel | Model template type to create a ViewModel for. |
CreateNpcClass<TModel>(TypeFactory, IEnumerable<Type>?)
Generates a new public class that implements the ViewModel pattern
through the NotifyPropertyChanged base class, and
includes all public properties from the specified
TModel
type as properties with change
notification support.
Declaration
public static ITypeBuilder<INotifyPropertyChanged> CreateNpcClass<TModel>(this TypeFactory factory, IEnumerable<Type>? interfaces) where TModel : notnull, new()
Parameters
Type | Name | Description |
---|---|---|
TypeFactory | factory | Type factory to use when creating the new type. |
IEnumerable<Type> | interfaces | Collection of additional interfaces to be implemented by the new type. Can be set to null or an empty collection to denote that the new type does not require to implement any additional interfaces. |
Returns
Type | Description |
---|---|
ITypeBuilder<INotifyPropertyChanged> | A new TypeBuilder that can be used to define any additional members of the newly created type. |
Type Parameters
Name | Description |
---|---|
TModel | Model template type to create a ViewModel for. |