ModelDataExtensionsCreateMappingTSource, TTarget Method (TSource, ReadOnlyDictionaryString, ActionTSource, TTarget, FuncTSource, TTarget) |
Creates a mapping object. This is an object that can create an object of given type and copy
all public properties from an existing object over the new one. This mapping object can be
extended with custom mapping rules.
Namespace:
Dundas.BI.WebApi.Models
Assembly:
Dundas.BI.WebApiCore (in Dundas.BI.WebApiCore.dll) Version: 2.0.0.0 (24.1.0.1001)
Syntax public static ModelMapping<TSource, TTarget> CreateMapping<TSource, TTarget>(
this TSource source,
ReadOnlyDictionary<string, Action<TSource, TTarget>> mappingRules,
Func<TSource, TTarget> targetObjectFactory
)
<ExtensionAttribute>
Public Shared Function CreateMapping(Of TSource, TTarget) (
source As TSource,
mappingRules As ReadOnlyDictionary(Of String, Action(Of TSource, TTarget)),
targetObjectFactory As Func(Of TSource, TTarget)
) As ModelMapping(Of TSource, TTarget)
public:
[ExtensionAttribute]
generic<typename TSource, typename TTarget>
static ModelMapping<TSource, TTarget>^ CreateMapping(
TSource source,
ReadOnlyDictionary<String^, Action<TSource, TTarget>^>^ mappingRules,
Func<TSource, TTarget>^ targetObjectFactory
)
[<ExtensionAttribute>]
static member CreateMapping :
source : 'TSource *
mappingRules : ReadOnlyDictionary<string, Action<'TSource, 'TTarget>> *
targetObjectFactory : Func<'TSource, 'TTarget> -> ModelMapping<'TSource, 'TTarget>
Parameters
- source
- Type: TSource
The source object - object which properties will be copied over the
target. - mappingRules
- Type: System.Collections.ObjectModelReadOnlyDictionaryString, ActionTSource, TTarget
The mapping rules. - targetObjectFactory
- Type: SystemFuncTSource, TTarget
A delegate to a method that has to create a new object of the target type.
if factory method is not provided the target type must declare a parameterless constructor.
Type Parameters
- TSource
- The type of the source.
- TTarget
- The type of the target.
Return Value
Type:
ModelMappingTSource,
TTarget
Newly created and initialized object of the target type.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also