HigLabo.Mapper is an object mapper. Faster than AutoMapper, Mapster, ExpressMapper, AgileMapper, etc. You can use without configuration, so it saves your time. And you can customize mapping rule in a very intuitive way.
Introduction
Currently, the latest version of HigLabo.Mapper
support .NET8. You can use it from Nuget.
Four years ago (2015), I created the initial version of object mapper with IL code. Just a few weeks ago, I decided to reimplement HigLabo.Mapper
with Expression Tree and achieve huge performance improvement. It scored fastest in the world currently. GitHub repository is https://github.com/higty/higlabo.
You can see my 10 days commit log at https://github.com/higty/higlabo.netstandard/tree/master/HigLabo.Mapper
Currently, I just released HigLabo.Mapper
on .NET6. The latest version of HigLabo.Mapper
is here.
You can use from Nuget that support DateOnly
, TimeOnly
type.
You can download from Nuget.
HigLabo.Mapper
(version 6.1.x.x)
Background
Nowadays, whether you are a developer of Web, Desktop, Mobile, you may use some of POCO, DTO object. And you must transfer property value from object to object. Object mapper is useful for this situation. This time, the goal of my reimplementation is as listed below:
- Fastest in the world
- Zero configuration for productivity
- Full customization for various usecase
- Multiple mapping rule for an application
How to Use?
You can get HigLabo.Mapper
(version 6.1.0.0 or later) from Nuget package.
Add using
directive in your application:
using HigLabo.Core;
Now you can use Map
extension method like this:
var a1 = new Address();
var a2 = a1.Map(new Address());
HigLabo.Mapper
supports Dictionary
to Object
mapping.
var d = new Dictionary<String, String>();
d["Name"] = "Bill";
var person = d.Map(new Person());
Object
to Dictionary
also supported.
var p = new Person();
p.Name = "Bill";
var d = p.Map(new Dictionary<String, String>);
I design HigLabo.Mapper
easy to use.
Comparison to Other Mappers
In this chapter, I will explain the difference to other mapper libraries. This is a summary of comparison.
- Performance
- Initial Configuration
- Customization
- Multiple Settings
Performance!!!
It is important for mapper library because it has a tendency to be used in deeper place like inside loop. The summary of performance test is here.
- 3x-4x faster than AutoMapper (for POCO that does not have collection property)
- 10%-20% faster than Mapster (for POCO that does not have collection property)
- 7x-10x faster than AgileMapper, FastMapper, TinyMapper (for POCO that does not have collection property)
- 3x faster than AutoMapper (for POCO that has collection property)
- 10x faster than Mapster (for POCO that has collection property)
- 10x-20x faster than AgileMapper, FastMapper, TinyMapper (for POCO that has collection property)
Here is a performance test result with BenchmarkDotNet. HigLaboObjectMapper_XXXX
is the result of new HigLabo.Mapper
.
Here is a class that is used for performance test.
public class Address
{
public int Id { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string Country { get; set; }
public AddressType AddressType { get; set; }
}
public class AddressDTO
{
public int Id { get; set; }
public string City { get; set; }
public string Country { get; set; }
public AddressType AddressType { get; set; } = AddressType.House;
}
public struct GpsPosition
{
public double Latitude { get; private set; }
public double Longitude { get; private set; }
public GpsPosition(double latitude, double longitude)
{
this.Latitude = latitude;
this.Longitude = longitude;
}
}
public class Customer
{
public Int32? Id { get; set; }
public String Name { get; set; }
public Address Address { get; set; }
public Address HomeAddress { get; set; }
public Address[] AddressList { get; set; }
public IEnumerable<Address> WorkAddressList { get; set; }
}
public class CustomerDTO
{
public Int32? Id { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
public AddressDTO HomeAddress { get; set; }
public AddressDTO[] AddressList { get; set; }
public List<AddressDTO> WorkAddressList { get; set; }
public String AddressCity { get; set; }
}
I tested four types of mapping like this:
1. POCO class without collection property to same class.
XXX.Map(new Address(), new Address())
2. POCO class without collection property to other class.
XXX.Map(new Address(), new AddressDTO())
3. POCO class that has collection property map to same class.
XXX.Map(new Customer(), new Customer())
4. POCO class that has collection property map to other class.
XXX.Map(new Customer(), new CustomerDTO());
As you can see, all four cases HigLabo.Mapper
is fastest.
You can see the entire test code at this link.
Initial Configuration
Some Mapper
s require initial configuration like this:
var configuration = new AutoMapper.MapperConfiguration(config => {
config.CreateMap<Building, Building>();
config.CreateMap<TreeNode, TreeNode>();
});
This is AutoMapper
configuration code. If you have thousands of classes to map with, it is quite boring to create this mapping configuration code. TinyMapper
also requires configuration.
TinyMapper.Bind<Park, Park>();
TinyMapper.Bind<Customer, CustomerDTO>();
TinyMapper.Bind<Dictionary<String, String>, Building>();
HigLabo.Mapper
does not require any configuration. You can use it out of the box.
Customization
Sometimes, you want to customize the mapping rule against your POCO object. AutoMapper
is so complicated to customize mapping rule. I compare AutoMapper
and HigLabo.Mapper
with an example of this page.
class Source {
public int Id {get;set;}
public int UseThisInt {get;set;}
public InnerType Inner {get;set;}
}
class InnerType {
public int Id {get;set;}
public int Height {get;set;}
}
class Destination {
public int Id {get;set;}
public int UseThisInt {get;set;}
public int Height {get;set;}
}
Mapper.Initialize(cfg => {
cfg.CreateMap<source, destination="">();
cfg.CreateMap<innertype, destination="">();
});
var dest = Mapper.Map<destination>(src);
Mapper.Map(src.Inner, dest);
Mapper.Initialize(cfg => {
cfg.CreateMap<source, destination="">()AfterMap
((src, dest) => Mapper.Map(src.Inner, dest));
cfg.CreateMap<innertype, destination="">();
});
var dest = Mapper.Map<destination>(src);
If you use AutoMapper
, you must know about the AutoMapper
library like Mapper.Initialize
, ForMember
, CreateMap
, AfterMap
, etc.
HigLabo.Mapper
can customize like this:
c.AddPostAction<Source, Destination>((s, d) =>
{
d.Id = s.Inner.Id;
s.Inner.Map(d);
});
HigLabo.Mapper
simply calls this lambda after mapping completed when you call Map
method. So, you can overwrite default mapping rule.
You can completely replace mapping rule with ReplaceMap
method like this:
c.ReplaceMap<Source, Destination>((s, d) =>
{
d.Id = s.Inner.Id;
s.Inner.Map(d);
});
var source = new Source();
var destination = new Destination();
source.Map(distination);
It is simple and no additional knowledge is required. You can only know about C# lambda that you already use.
You can easily add convert logic.
c.AddPostAction<Person, PersonVM>((s, d) =>
{
d.BMI = CalculateBMI(s.Height, s.Weight);
});
You can also use conditional property map.
c.AddPostAction<Employee, EmployeeVM>((s, d) =>
{
if (s.EmployeeType == EmployeeType.Contract)
{
d.Property1 = someValue1;
}
else
{
d.Property1 = someValue2;
}
});
Another advantage of this design is that you can easily debug to your code. You can set break point on lambda inside AddPostAction
, ReplaceMap
method.
You can also customize property mapping rule like this:
class Person
{
public string Name { get; set; }
public string Position_Name { get; set; }
}
class PersonModel
{
public string Name { get; set; }
public string PositionName { get; set; }
}
var mapper = HigLabo.Core.ObjectMapper.Default;
mapper.CompilerConfig.PropertyMatchRule =
(sourceType, sourceProperty, targetType, targetProperty)
{
if (sourceType == typeof(Person) && targetType == typeof(PersonModel))
{
return sourceProperty.Name.Replace("_", "") == targetProperty.Name;
}
return false;
};
Multiple Settings
You can create multiple instances of ObjectMapper
class.
var om1 = new ObjectMapper();
om1.AddPostAction<Address, Address>((s, d) =>
{
});
var om2 = new ObjectMapper();
om2.AddPostAction<Address, Address>((s, d) =>
{
});
var a = new Address();
var a1 = om1.Map(a, new Address());
var a2 = om1.Map(a, new Address());
Map extension method is declared ObjectMapperExtensions
class. This method simply calls the method of ObjectMapper.Default
instance.
using System;
namespace HigLabo.Core
{
public static class ObjectMapperExtensions
{
public static TTarget Map<TSource, TTarget>(this TSource source, TTarget target)
{
return ObjectMapper.Default.Map(source, target);
}
public static TTarget MapOrNull<TSource, TTarget>
(this TSource source, Func<TTarget> targetConstructor)
where TTarget : class
{
return ObjectMapper.Default.MapOrNull(source, targetConstructor);
}
public static TTarget MapOrNull<TSource, TTarget>
(this TSource source, TTarget target)
where TTarget : class
{
return ObjectMapper.Default.MapOrNull(source, target);
}
public static TTarget MapFrom<TTarget, TSource>
(this TTarget target, TSource source)
{
return ObjectMapper.Default.Map(source, target);
}
}
}
So, you can create a new instance and add new rule and use it.
You can encapsulate the initialization code like this:
public static class ObjectMapperExtensions
{
public static void Initialize(this ObjectMapper mapper)
{
mapper.AddPostAction<Address, Address>((s, d) =>
{
});
mapper.AddPostAction<Address, Address>((s, d) =>
{
});
}
}
ObjectMapper.Default.Initialize();
Test Cases for Mapping
I created all test cases here:
I tested all cases that the previous version supported except 1 case for Dictionary
custom mapping.
But I think that some of the rare cases that case exception may be included because this is the initial release. If you encountered an exception, please feel free to ask me on CodeProject or GitHub issue.
Deep Dive Into Generated Expression Tree
The test case is here.
ObjectMapper_Map_ValueType_ValueType
test case will generate the below code with expression tree.
.Lambda #Lambda1<System.Func`3[System.Object,System.Object,HigLabo.Mapper.Test.Vector2]>(
System.Object $sourceParameter,
System.Object $targetParameter) {
.Block(
HigLabo.Mapper.Test.Vector2 $source,
HigLabo.Mapper.Test.Vector2 $target) {
$source = .Unbox($sourceParameter);
$target = .Unbox($targetParameter);
.Call $target.set_X($source.X);
.Call $target.set_Y($source.Y);
$target
}
}
Address to AddressDTO
will generate this expression tree as MapAction Func
.
.Lambda #Lambda1<System.Func`3[System.Object,System.Object,
HigLabo.Mapper.PerformanceTest.AddressDTO]>(
System.Object $sourceParameter,
System.Object $targetParameter) {
.Block(
HigLabo.Mapper.PerformanceTest.Address $source,
HigLabo.Mapper.PerformanceTest.AddressDTO $target) {
$source = $sourceParameter .As HigLabo.Mapper.PerformanceTest.Address;
$target = $targetParameter .As HigLabo.Mapper.PerformanceTest.AddressDTO;
.Call $target.set_Id($source.Id);
.Call $target.set_City($source.City);
.Call $target.set_Country($source.Country);
.Call $target.set_AddressType($source.AddressType);
$target
}
}
ObjectMapper_Map_CollectionElementCreateMode_CollectionElementCreateMode_NewObject
will generate the below code:
.Lambda #Lambda1<System.Func`3[System.Object,System.Object,HigLabo.Mapper.Test.User]>(
System.Object $sourceParameter,
System.Object $targetParameter) {
.Block(
HigLabo.Mapper.Test.User $source,
HigLabo.Mapper.Test.User $target) {
$source = $sourceParameter .As HigLabo.Mapper.Test.User;
$target = $targetParameter .As HigLabo.Mapper.Test.User;
.Call $target.set_Value($source.Value);
.Call $target.set_Name($source.Name);
.Call $target.set_Int32($source.Int32);
.Call $target.set_Int32Nullable($source.Int32Nullable);
.Call $target.set_Int32_Nullable($source.Int32_Nullable);
.Call $target.set_Int32NullableToInt32($source.Int32NullableToInt32);
.Call $target.set_DateTime($source.DateTime);
.Call $target.set_DateTimeNullable($source.DateTimeNullable);
.Call $target.set_Decimal($source.Decimal);
.Call $target.set_DecimalNullable($source.DecimalNullable);
.Call $target.set_DayOfWeek($source.DayOfWeek);
.Call $target.set_DayOfWeekNullable($source.DayOfWeekNullable);
.Call $target.set_Guid($source.Guid);
.Call $target.set_GuidNullable($source.GuidNullable);
.If ($source.MapPoint == null) {
.Call $target.set_MapPoint(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ($target.MapPoint == null) {
$target.MapPoint = .New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call ($target.MapPoint).set_Longitude(($source.MapPoint).Longitude);
.Call ($target.MapPoint).set_Latitude(($source.MapPoint).Latitude)
}
};
.Call $target.set_VectorToNullable($source.VectorToNullable);
.Call $target.set_Vector2($source.Vector2);
.If ($source.ParentUser == null) {
.Call $target.set_ParentUser(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ($target.ParentUser == null) {
$target.ParentUser = .New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call ($target.ParentUser)
.set_Value(($source.ParentUser).Value);
.Call ($target.ParentUser)
.set_Name(($source.ParentUser).Name);
.Call ($target.ParentUser)
.set_Int32(($source.ParentUser).Int32);
.Call ($target.ParentUser).set_Int32Nullable
(($source.ParentUser).Int32Nullable);
.Call ($target.ParentUser).set_Int32_Nullable
(($source.ParentUser).Int32_Nullable);
.Call ($target.ParentUser).set_Int32NullableToInt32
(($source.ParentUser).Int32NullableToInt32);
.Call ($target.ParentUser)
.set_DateTime(($source.ParentUser).DateTime);
.Call ($target.ParentUser).set_DateTimeNullable
(($source.ParentUser).DateTimeNullable);
.Call ($target.ParentUser)
.set_Decimal(($source.ParentUser).Decimal);
.Call ($target.ParentUser).set_DecimalNullable
(($source.ParentUser).DecimalNullable);
.Call ($target.ParentUser).set_DayOfWeek
(($source.ParentUser).DayOfWeek);
.Call ($target.ParentUser).set_DayOfWeekNullable
(($source.ParentUser).DayOfWeekNullable);
.Call ($target.ParentUser)
.set_Guid(($source.ParentUser).Guid);
.Call ($target.ParentUser).set_GuidNullable
(($source.ParentUser).GuidNullable);
.If (($source.ParentUser).MapPoint == null) {
.Call ($target.ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If (($target.ParentUser).MapPoint == null) {
($target.ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call (($target.ParentUser).MapPoint).set_Longitude
((($source.ParentUser).MapPoint).Longitude);
.Call (($target.ParentUser).MapPoint).set_Latitude
((($source.ParentUser).MapPoint).Latitude)
}
};
.Call ($target.ParentUser).set_VectorToNullable
(($source.ParentUser).VectorToNullable);
.Call ($target.ParentUser)
.set_Vector2(($source.ParentUser).Vector2);
.If (($source.ParentUser).ParentUser == null) {
.Call ($target.ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If (($target.ParentUser).ParentUser == null) {
($target.ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call (($target.ParentUser).ParentUser).set_Value
((($source.ParentUser).ParentUser).Value);
.Call (($target.ParentUser).ParentUser).set_Name
((($source.ParentUser).ParentUser).Name);
.Call (($target.ParentUser).ParentUser).set_Int32
((($source.ParentUser).ParentUser).Int32);
.Call (($target.ParentUser).ParentUser).set_Int32Nullable
((($source.ParentUser).ParentUser).Int32Nullable);
.Call (($target.ParentUser).ParentUser).set_Int32_Nullable
((($source.ParentUser).ParentUser).Int32_Nullable);
.Call (($target.ParentUser)
.ParentUser).set_Int32NullableToInt32
((($source.ParentUser)
.ParentUser).Int32NullableToInt32);
.Call (($target.ParentUser).ParentUser).set_DateTime
((($source.ParentUser).ParentUser).DateTime);
.Call (($target.ParentUser).ParentUser).set_DateTimeNullable
((($source.ParentUser).ParentUser).DateTimeNullable);
.Call (($target.ParentUser).ParentUser).set_Decimal
((($source.ParentUser).ParentUser).Decimal);
.Call (($target.ParentUser).ParentUser).set_DecimalNullable
((($source.ParentUser).ParentUser).DecimalNullable);
.Call (($target.ParentUser).ParentUser).set_DayOfWeek
((($source.ParentUser).ParentUser).DayOfWeek);
.Call (($target.ParentUser).ParentUser).set_DayOfWeekNullable
((($source.ParentUser).ParentUser).DayOfWeekNullable);
.Call (($target.ParentUser).ParentUser).set_Guid
((($source.ParentUser).ParentUser).Guid);
.Call (($target.ParentUser).ParentUser).set_GuidNullable
((($source.ParentUser).ParentUser).GuidNullable);
.If ((($source.ParentUser).ParentUser).MapPoint == null) {
.Call (($target.ParentUser).ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ((($target.ParentUser)
.ParentUser).MapPoint == null) {
(($target.ParentUser).ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call ((($target.ParentUser).ParentUser).MapPoint)
.set_Longitude
(((($source.ParentUser).ParentUser).MapPoint)
.Longitude);
.Call ((($target.ParentUser).ParentUser).MapPoint)
.set_Latitude
(((($source.ParentUser).ParentUser).MapPoint)
.Latitude)
}
};
.Call (($target.ParentUser).ParentUser).set_VectorToNullable
((($source.ParentUser).ParentUser).VectorToNullable);
.Call (($target.ParentUser).ParentUser).set_Vector2
((($source.ParentUser).ParentUser).Vector2);
.If ((($source.ParentUser).ParentUser).ParentUser == null) {
.Call (($target.ParentUser).ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ((($target.ParentUser)
.ParentUser).ParentUser == null) {
(($target.ParentUser).ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Value
(((($source.ParentUser).ParentUser)
.ParentUser).Value);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Name
(((($source.ParentUser).ParentUser)
.ParentUser).Name);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Int32
(((($source.ParentUser).ParentUser)
.ParentUser).Int32);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Int32Nullable
(((($source.ParentUser).ParentUser)
.ParentUser).Int32Nullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Int32_Nullable
(((($source.ParentUser).ParentUser)
.ParentUser).Int32_Nullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Int32NullableToInt32
(((($source.ParentUser).ParentUser)
.ParentUser).Int32NullableToInt32);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_DateTime
(((($source.ParentUser).ParentUser)
.ParentUser).DateTime);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_DateTimeNullable
(((($source.ParentUser).ParentUser)
.ParentUser).DateTimeNullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Decimal
(((($source.ParentUser).ParentUser)
.ParentUser).Decimal);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_DecimalNullable
(((($source.ParentUser).ParentUser)
.ParentUser).DecimalNullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_DayOfWeek
(((($source.ParentUser).ParentUser)
.ParentUser).DayOfWeek);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_DayOfWeekNullable
(((($source.ParentUser).ParentUser)
.ParentUser).DayOfWeekNullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Guid
(((($source.ParentUser).ParentUser)
.ParentUser).Guid);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_GuidNullable
(((($source.ParentUser).ParentUser)
.ParentUser).GuidNullable);
.If (((($source.ParentUser).ParentUser)
.ParentUser).MapPoint == null) {
.Call ((($target.ParentUser)
.ParentUser).ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If (((($target.ParentUser).ParentUser)
.ParentUser).MapPoint == null) {
((($target.ParentUser).ParentUser)
.ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call (((($target.ParentUser).ParentUser)
.ParentUser).MapPoint).set_Longitude
((((($source.ParentUser).ParentUser)
.ParentUser).MapPoint).Longitude)
;
.Call (((($target.ParentUser).ParentUser)
.ParentUser).MapPoint).set_Latitude
((((($source.ParentUser).ParentUser)
.ParentUser).MapPoint).Latitude)
}
};
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_VectorToNullable
(((($source.ParentUser).ParentUser)
.ParentUser).VectorToNullable);
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Vector2
(((($source.ParentUser).ParentUser)
.ParentUser).Vector2);
.If (((($source.ParentUser).ParentUser)
.ParentUser).ParentUser == null) {
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser == null) {
((($target.ParentUser).ParentUser)
.ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Value
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Value);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Name
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Name);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Int32
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Int32);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Int32Nullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Int32Nullable);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Int32_Nullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Int32_Nullable);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Int32NullableToInt32
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser)
.Int32NullableToInt32);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_DateTime
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).DateTime);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_DateTimeNullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).DateTimeNullable);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Decimal
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Decimal);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_DecimalNullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).DecimalNullable);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_DayOfWeek
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).DayOfWeek);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_DayOfWeekNullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).DayOfWeekNullable);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Guid
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Guid);
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_GuidNullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).GuidNullable);
.If ((((($source.ParentUser)
.ParentUser).ParentUser)
.ParentUser).MapPoint == null) {
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ((((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).MapPoint == null) {
(((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
}
}
};
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_VectorToNullable
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).VectorToNullable)
;
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Vector2
((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Vector2)
;
.If ((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).ParentUser == null) {
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ((((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).ParentUser == null) {
(((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
}
}
};
.If ((((($source.ParentUser).ParentUser)
.ParentUser).ParentUser).Dictionary == null) {
.Call (((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Dictionary
(.Default(System.Collections.Generic
.Dictionary`2[System.String,System.String]))
} .Else {
.Block() {
.If ((((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).Dictionary == null) {
(((($target.ParentUser).ParentUser)
.ParentUser).ParentUser).Dictionary =
.New System.Collections.Generic
.Dictionary`2[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If (((($source.ParentUser).ParentUser)
.ParentUser).Dictionary == null) {
.Call ((($target.ParentUser).ParentUser)
.ParentUser).set_Dictionary
(.Default(System.Collections.Generic.
Dictionary`2[System.String,System.String]))
} .Else {
.Block() {
.If (((($target.ParentUser).ParentUser)
.ParentUser).Dictionary == null) {
((($target.ParentUser).ParentUser)
.ParentUser).Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If ((($source.ParentUser).ParentUser).Dictionary == null) {
.Call (($target.ParentUser).ParentUser).set_Dictionary
(.Default(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If ((($target.ParentUser).ParentUser).Dictionary == null) {
(($target.ParentUser).ParentUser).Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If (($source.ParentUser).Dictionary == null) {
.Call ($target.ParentUser).set_Dictionary
(.Default(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If (($target.ParentUser).Dictionary == null) {
($target.ParentUser).Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If ($source.Dictionary == null) {
.Call $target.set_Dictionary(.Default
(System.Collections.Generic.Dictionary`2[System.String,System.String]))
} .Else {
.Block() {
.If ($target.Dictionary == null) {
$target.Dictionary = .New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
};
.If ($target.Users == null) {
.Call $target.set_Users(.New System.Collections.Generic.List`1
[HigLabo.Mapper.Test.User]())
} .Else {
.Default(System.Void)
};
.Block(
HigLabo.Mapper.Test.User $sourceElement,
HigLabo.Mapper.Test.User $targetElement,
System.Int32 $i) {
$i;
.If ($source.Users == null) {
.Return end { }
} .Else {
.Default(System.Void)
};
$i = 0;
.Loop {
.Block() {
.If (($source.Users).Count <= $i) {
.Break endLoop { }
} .Else {
.Default(System.Void)
};
$sourceElement = ($source.Users).Item[$i];
$targetElement = .New HigLabo.Mapper.Test.User();
.Call $targetElement.set_Value($sourceElement.Value);
.Call $targetElement.set_Name($sourceElement.Name);
.Call $targetElement.set_Int32($sourceElement.Int32);
.Call $targetElement.set_Int32Nullable($sourceElement.Int32Nullable);
.Call $targetElement.set_Int32_Nullable($sourceElement.Int32_Nullable);
.Call $targetElement.set_Int32NullableToInt32
($sourceElement.Int32NullableToInt32);
.Call $targetElement.set_DateTime($sourceElement.DateTime);
.Call $targetElement.set_DateTimeNullable
($sourceElement.DateTimeNullable);
.Call $targetElement.set_Decimal($sourceElement.Decimal);
.Call $targetElement.set_DecimalNullable
($sourceElement.DecimalNullable);
.Call $targetElement.set_DayOfWeek($sourceElement.DayOfWeek);
.Call $targetElement.set_DayOfWeekNullable
($sourceElement.DayOfWeekNullable);
.Call $targetElement.set_Guid($sourceElement.Guid);
.Call $targetElement.set_GuidNullable($sourceElement.GuidNullable);
.If ($sourceElement.MapPoint == null) {
.Call $targetElement.set_MapPoint(.Default
(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ($targetElement.MapPoint == null) {
$targetElement.MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call ($targetElement.MapPoint).set_Longitude
(($sourceElement.MapPoint).Longitude);
.Call ($targetElement.MapPoint).set_Latitude
(($sourceElement.MapPoint).Latitude)
}
};
.Call $targetElement.set_VectorToNullabl
e($sourceElement.VectorToNullable);
.Call $targetElement.set_Vector2($sourceElement.Vector2);
.If ($sourceElement.ParentUser == null) {
.Call $targetElement.set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ($targetElement.ParentUser == null) {
$targetElement.ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call ($targetElement.ParentUser).set_Value
(($sourceElement.ParentUser).Value);
.Call ($targetElement.ParentUser).set_Name
(($sourceElement.ParentUser).Name);
.Call ($targetElement.ParentUser).set_Int32
(($sourceElement.ParentUser).Int32);
.Call ($targetElement.ParentUser).set_Int32Nullable
(($sourceElement.ParentUser).Int32Nullable);
.Call ($targetElement.ParentUser).set_Int32_Nullable
(($sourceElement.ParentUser).Int32_Nullable);
.Call ($targetElement.ParentUser).set_Int32NullableToInt32
(($sourceElement.ParentUser).Int32NullableToInt32);
.Call ($targetElement.ParentUser).set_DateTime
(($sourceElement.ParentUser).DateTime);
.Call ($targetElement.ParentUser).set_DateTimeNullable
(($sourceElement.ParentUser).DateTimeNullable);
.Call ($targetElement.ParentUser).set_Decimal
(($sourceElement.ParentUser).Decimal);
.Call ($targetElement.ParentUser).set_DecimalNullable
(($sourceElement.ParentUser).DecimalNullable);
.Call ($targetElement.ParentUser).set_DayOfWeek
(($sourceElement.ParentUser).DayOfWeek);
.Call ($targetElement.ParentUser).set_DayOfWeekNullable
(($sourceElement.ParentUser).DayOfWeekNullable);
.Call ($targetElement.ParentUser).set_Guid
(($sourceElement.ParentUser).Guid);
.Call ($targetElement.ParentUser).set_GuidNullable
(($sourceElement.ParentUser).GuidNullable);
.If (($sourceElement.ParentUser).MapPoint == null) {
.Call ($targetElement.ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If (($targetElement.ParentUser).MapPoint == null) {
($targetElement.ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call (($targetElement.ParentUser).MapPoint).set_Longitude
((($sourceElement.ParentUser).MapPoint).Longitude);
.Call (($targetElement.ParentUser).MapPoint).set_Latitude
((($sourceElement.ParentUser).MapPoint).Latitude)
}
};
.Call ($targetElement.ParentUser).set_VectorToNullable
(($sourceElement.ParentUser).VectorToNullable);
.Call ($targetElement.ParentUser).set_Vector2
(($sourceElement.ParentUser).Vector2);
.If (($sourceElement.ParentUser).ParentUser == null) {
.Call ($targetElement.ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If (($targetElement.ParentUser).ParentUser == null) {
($targetElement.ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call (($targetElement.ParentUser)
.ParentUser).set_Value
((($sourceElement.ParentUser)
.ParentUser).Value);
.Call (($targetElement.ParentUser)
.ParentUser).set_Name
((($sourceElement.ParentUser)
.ParentUser).Name);
.Call (($targetElement.ParentUser)
.ParentUser).set_Int32
((($sourceElement.ParentUser)
.ParentUser).Int32);
.Call (($targetElement.ParentUser)
.ParentUser).set_Int32Nullable
((($sourceElement.ParentUser)
.ParentUser).Int32Nullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_Int32_Nullable
((($sourceElement.ParentUser)
.ParentUser).Int32_Nullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_Int32NullableToInt32
((($sourceElement.ParentUser)
.ParentUser).Int32NullableToInt32);
.Call (($targetElement.ParentUser)
.ParentUser).set_DateTime
((($sourceElement.ParentUser)
.ParentUser).DateTime);
.Call (($targetElement.ParentUser)
.ParentUser).set_DateTimeNullable
((($sourceElement.ParentUser)
.ParentUser).DateTimeNullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_Decimal
((($sourceElement.ParentUser)
.ParentUser).Decimal);
.Call (($targetElement.ParentUser)
.ParentUser).set_DecimalNullable
((($sourceElement.ParentUser)
.ParentUser).DecimalNullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_DayOfWeek
((($sourceElement.ParentUser)
.ParentUser).DayOfWeek);
.Call (($targetElement.ParentUser)
.ParentUser).set_DayOfWeekNullable
((($sourceElement.ParentUser)
.ParentUser).DayOfWeekNullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_Guid
((($sourceElement.ParentUser)
.ParentUser).Guid);
.Call (($targetElement.ParentUser)
.ParentUser).set_GuidNullable
((($sourceElement.ParentUser)
.ParentUser).GuidNullable);
.If ((($sourceElement.ParentUser)
.ParentUser).MapPoint == null) {
.Call (($targetElement.ParentUser)
.ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ((($targetElement.ParentUser)
.ParentUser).MapPoint == null) {
(($targetElement.ParentUser)
.ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call ((($targetElement.ParentUser)
.ParentUser).MapPoint).set_Longitude
(((($sourceElement.ParentUser)
.ParentUser).MapPoint).Longitude);
.Call ((($targetElement.ParentUser)
.ParentUser).MapPoint).set_Latitude
(((($sourceElement.ParentUser)
.ParentUser).MapPoint).Latitude)
}
};
.Call (($targetElement.ParentUser)
.ParentUser).set_VectorToNullable
((($sourceElement.ParentUser)
.ParentUser).VectorToNullable);
.Call (($targetElement.ParentUser)
.ParentUser).set_Vector2
((($sourceElement.ParentUser)
.ParentUser).Vector2);
.If ((($sourceElement.ParentUser)
.ParentUser).ParentUser == null) {
.Call (($targetElement.ParentUser).ParentUser)
.set_ParentUser(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ((($targetElement.ParentUser).ParentUser)
.ParentUser == null) {
(($targetElement.ParentUser).ParentUser)
.ParentUser = .New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Value
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Value);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Name
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Name);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Int32
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Int32);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Int32Nullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Int32Nullable);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Int32_Nullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Int32_Nullable);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser)
.set_Int32NullableToInt32
(((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.Int32NullableToInt32);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_DateTime
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).DateTime);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_DateTimeNullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.DateTimeNullable);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Decimal
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Decimal);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_DecimalNullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.DecimalNullable);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_DayOfWeek
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).DayOfWeek);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_DayOfWeekNullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.DayOfWeekNullable);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_Guid
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).Guid);
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_GuidNullable
(((($sourceElement.ParentUser)
.ParentUser).ParentUser).GuidNullable);
.If (((($sourceElement.ParentUser)
.ParentUser).ParentUser).MapPoint == null) {
.Call ((($targetElement.ParentUser)
.ParentUser).ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If (((($targetElement.ParentUser)
.ParentUser).ParentUser).MapPoint == null) {
((($targetElement.ParentUser)
.ParentUser).ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
};
.Call (((($targetElement.ParentUser)
.ParentUser).ParentUser)
.MapPoint).set_Longitude
((((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.MapPoint).Longitude);
.Call (((($targetElement.ParentUser)
.ParentUser).ParentUser)
.MapPoint).set_Latitude
((((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.MapPoint).Latitude)
}
};
.Call ((($targetElement.ParentUser).ParentUser)
.ParentUser).set_VectorToNullable
(((($sourceElement.ParentUser).ParentUser)
.ParentUser).VectorToNullable);
.Call ((($targetElement.ParentUser).ParentUser)
.ParentUser).set_Vector2
(((($sourceElement.ParentUser).ParentUser)
.ParentUser).Vector2);
.If (((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser == null) {
.Call ((($targetElement.ParentUser).ParentUser)
.ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If (((($targetElement.ParentUser)
.ParentUser).ParentUser).ParentUser == null) {
((($targetElement.ParentUser)
.ParentUser).ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
};
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Value
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Value);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Name
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Name);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Int32
((((($sourceElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).Int32);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Int32Nullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Int32Nullable);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Int32_Nullable
((((($sourceElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).Int32_Nullable);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser)
.set_Int32NullableToInt32
((((($sourceElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser)
.Int32NullableToInt32);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_DateTime
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).DateTime);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_DateTimeNullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).DateTimeNullable);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Decimal
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Decimal);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_DecimalNullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).DecimalNullable);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_DayOfWeek
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).DayOfWeek);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_DayOfWeekNullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).DayOfWeekNullable);
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Guid
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Guid);
.Call (((($targetElement.ParentUser).ParentUser)
.ParentUser).ParentUser).set_GuidNullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).GuidNullable);
.If ((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).MapPoint == null) {
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_MapPoint
(.Default(HigLabo.Mapper.Test.MapPoint))
} .Else {
.Block() {
.If ((((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).MapPoint == null) {
(((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).MapPoint =
.New HigLabo.Mapper.Test.MapPoint()
} .Else {
.Default(System.Void)
}
}
};
.Call (((($targetElement.ParentUser).ParentUser)
.ParentUser).ParentUser).set_VectorToNullable
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).VectorToNullable);
.Call (((($targetElement.ParentUser).ParentUser)
.ParentUser).ParentUser).set_Vector2
((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).Vector2);
.If ((((($sourceElement.ParentUser).ParentUser)
.ParentUser).ParentUser).ParentUser == null) {
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_ParentUser
(.Default(HigLabo.Mapper.Test.User))
} .Else {
.Block() {
.If ((((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).ParentUser == null) {
(((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).ParentUser =
.New HigLabo.Mapper.Test.User()
} .Else {
.Default(System.Void)
}
}
};
.If ((((($sourceElement.ParentUser)
.ParentUser).ParentUser)
.ParentUser).Dictionary == null) {
.Call (((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).set_Dictionary
(.Default(System.Collections
.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If ((((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).Dictionary == null) {
(((($targetElement.ParentUser)
.ParentUser)
.ParentUser).ParentUser).Dictionary =
.New System.Collections
.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If (((($sourceElement.ParentUser).ParentUser)
.ParentUser).Dictionary == null) {
.Call ((($targetElement.ParentUser).ParentUser)
.ParentUser).set_Dictionary(.Default
(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If (((($targetElement.ParentUser)
.ParentUser).ParentUser)
.Dictionary == null) {
((($targetElement.ParentUser).ParentUser)
.ParentUser).Dictionary =
.New System.Collections.Generic
.Dictionary`2[System.String,
System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If ((($sourceElement.ParentUser).ParentUser)
.Dictionary == null) {
.Call (($targetElement.ParentUser).ParentUser)
.set_Dictionary(.Default
(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If ((($targetElement.ParentUser).ParentUser)
.Dictionary == null) {
(($targetElement.ParentUser).ParentUser)
.Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If (($sourceElement.ParentUser).Dictionary == null) {
.Call ($targetElement.ParentUser).set_Dictionary
(.Default(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If (($targetElement.ParentUser).Dictionary == null) {
($targetElement.ParentUser).Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
}
}
};
.If ($sourceElement.Dictionary == null) {
.Call $targetElement.set_Dictionary(.Default
(System.Collections.Generic.Dictionary`2
[System.String,System.String]))
} .Else {
.Block() {
.If ($targetElement.Dictionary == null) {
$targetElement.Dictionary =
.New System.Collections.Generic.Dictionary`2
[System.String,System.String]()
} .Else {
.Default(System.Void)
}
}
};
.Call ($target.Users).Add($targetElement);
$i += 1
}
}
.LabelTarget endLoop:;
.Label
.LabelTarget end:
};
.Block(
System.Guid $sourceElement,
System.Guid $targetElement,
System.Int32 $i) {
$i;
.If ($source.GuidList == null) {
.Return end { }
} .Else {
.Default(System.Void)
};
$i = 0;
.Loop {
.Block() {
.If (($source.GuidList).Count <= $i) {
.Break endLoop { }
} .Else {
.Default(System.Void)
};
$sourceElement = ($source.GuidList).Item[$i];
$targetElement = (System.Guid)$sourceElement;
.Call ($target.GuidList).Add($targetElement);
$i += 1
}
}
.LabelTarget endLoop:;
.Label
.LabelTarget end:
};
.If ($source.Tags != null) {
.Block(
System.String $sourceElement,
System.String $targetElement,
System.Int32 $i,
System.String[] $arrayMember) {
$i;
$i = 0;
$arrayMember;
$arrayMember = .NewArray System.String[($source.Tags).Length];
.Loop {
.Block() {
.If (($source.Tags).Length <= $i) {
.Break endLoop { }
} .Else {
.Default(System.Void)
};
$sourceElement = ($source.Tags)[$i];
$targetElement = $sourceElement;
$arrayMember[$i] = $targetElement;
$i += 1
}
}
.LabelTarget endLoop:;
$target.Tags = $arrayMember
}
} .Else {
.Default(System.Void)
};
.If ($source.Timestamp != null) {
.Block(
System.Byte $sourceElement,
System.Byte $targetElement,
System.Int32 $i,
System.Byte[] $arrayMember) {
$i;
$i = 0;
$arrayMember;
$arrayMember = .NewArray System.Byte[($source.Timestamp).Length];
.Loop {
.Block() {
.If (($source.Timestamp).Length <= $i) {
.Break endLoop { }
} .Else {
.Default(System.Void)
};
$sourceElement = ($source.Timestamp)[$i];
$targetElement = $sourceElement;
$arrayMember[$i] = $targetElement;
$i += 1
}
}
.LabelTarget endLoop:;
$target.Timestamp = $arrayMember
}
} .Else {
.Default(System.Void)
};
$target
}
}
These blocks will be compiled to lambda func of Func<Object, Object, TTarget>
.
And saved private _MapActionList
field. Of course, this compile process is only once when first time and reuse Func
that saved _MapActionList
. AddPostAction
will combine this Func
and your Lambda, ReplaceMap
will replace this Func
.
Summary
I hope this library helps someone's work and makes it easy to focus on your product.
History
- 1st August, 2020: Initial post
- 18th August, 2020:
HigLabo.Mapper
(ver3.0.0.7) released - 29th December, 2021:
HigLabo.Mapper
(ver6.1.0.0) released