Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/v2 #217

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2bd6c6e
Start of AgileMapper.Buildable project
SteveWilkes Sep 3, 2020
9939b6f
Start of buildable mapper work / Moving test classes to UnitTests.Common
SteveWilkes Sep 4, 2020
d181579
Continued
SteveWilkes Sep 15, 2020
6d3ffcc
Removing EnumerableIndex / Surfacing mapping Expressions as LambdaExp…
SteveWilkes Oct 9, 2020
a30cd89
Tidying
SteveWilkes Oct 12, 2020
8513122
Building mapper source code continued
SteveWilkes Oct 12, 2020
955b0c9
Merging from v1.8
SteveWilkes Apr 29, 2021
208c411
Working towards buildable mappers
SteveWilkes May 3, 2021
24f4996
Basic buildable CreateNew static mapper API working
SteveWilkes May 4, 2021
5bc7ea8
Extending test coverage
SteveWilkes May 5, 2021
38e5358
Fixing dynamic tests / Uncoupling built mappers from MappingExecutor
SteveWilkes May 8, 2021
36fddb9
Handling circular references in built mapper source code
SteveWilkes May 11, 2021
dfa2b98
Support for built circular reference mappers
SteveWilkes May 11, 2021
6e02732
Moving reflection objects to constants class
SteveWilkes May 12, 2021
e97dce0
Organising buildable test classes
SteveWilkes May 12, 2021
75499a9
Moving more test classes to Common / Skipping object resolution and d…
SteveWilkes May 12, 2021
cec9940
Extending test coverage
SteveWilkes May 12, 2021
655e3a3
Using Array.Empty() where framework-supported
SteveWilkes May 12, 2021
0577c74
Moving qualified member naming methods into extension methods / Suppo…
SteveWilkes May 12, 2021
6589b89
Test coverage for building a simple create new enumerable mapper
SteveWilkes May 12, 2021
55a9d01
Support for single-target create new mapping to arrays
SteveWilkes May 12, 2021
45df504
Test coverage for complex type enumerable ToANew mapping
SteveWilkes May 13, 2021
be8a6f7
Test coverage for building a create new dictionary mapper
SteveWilkes May 13, 2021
6599700
Removing unused usings
SteveWilkes May 13, 2021
e1cc38b
Support for building root enum mappers
SteveWilkes May 13, 2021
8b9b965
Improving buildable test API
SteveWilkes May 14, 2021
854e25b
Test coverage for built overwrite mappers
SteveWilkes May 14, 2021
a1b45c5
Using switch statements for non-projection numeric-, char- and string…
SteveWilkes May 16, 2021
dfd396d
Optimising merge and overwrite mappings
SteveWilkes May 17, 2021
79d7140
Extending test coverage
SteveWilkes May 17, 2021
48fcc0d
Surfacing default eager MappingPlanSettings
SteveWilkes May 17, 2021
9759950
Fixing build
SteveWilkes Jun 3, 2021
5cc4ab7
Generating mapper source code files and a static Mapper class
SteveWilkes Jun 15, 2021
c685cd9
Adding GeneratedCodeAttributes to generated Mapper classes
SteveWilkes Jun 15, 2021
192bafb
Adding generated code header to generated mapper source code files
SteveWilkes Jun 15, 2021
f7e8078
Test coverage for generated single-source, multi-target mapper
SteveWilkes Jun 15, 2021
1121624
Differentiating single and multi-source complex type create new mappe…
SteveWilkes Jun 16, 2021
b39e84c
Test coverage for a generated overwrite mapper
SteveWilkes Jun 16, 2021
abe3699
Test coverage for a generated merge mapper
SteveWilkes Jun 16, 2021
6ec486d
Test coverage for generated enumerable create new mappers
SteveWilkes Jun 16, 2021
7345fa8
Test coverage for generated-mapper enumerable overwrite mapping
SteveWilkes Jun 16, 2021
746b39d
Test coverage for generated-mapper merge mappings
SteveWilkes Jun 16, 2021
d19f2ba
Test coverage for generated derived type mapper
SteveWilkes Jun 16, 2021
b0c6959
Test coverage for generated recursive mapper
SteveWilkes Jun 16, 2021
540e498
Removing unused class
SteveWilkes Jun 16, 2021
d9e3c46
Using type argument as return type in generated mappers with derived …
SteveWilkes Jun 17, 2021
1a16e3b
Removing unused local variables in more cases / Removing variable nam…
SteveWilkes Jun 17, 2021
e96c914
Removing more unused local variable conditions
SteveWilkes Jun 17, 2021
bca0acd
Tidying
SteveWilkes Jun 18, 2021
0c3458a
Test coverage for generated ToTarget data source mappers
SteveWilkes Jun 19, 2021
386b976
Support for separating mapper generator and output project / Coverage…
SteveWilkes Jun 19, 2021
0915756
Surfacing MappingDataFactory / Adding CopyLocalLockFileAssemblies to …
SteveWilkes Jun 23, 2021
4775646
Using shared AO documentation styling
SteveWilkes Jun 29, 2021
3949697
Reusing shared AO dox script
SteveWilkes Jun 29, 2021
9d3260d
Updating release notes
SteveWilkes Jun 29, 2021
844c325
Tidying project files
SteveWilkes Aug 6, 2021
3d30c7c
Fixing local variable removal in derived type query projection
SteveWilkes Aug 6, 2021
25de9b5
Updating packages
SteveWilkes Aug 7, 2021
a285181
Generating mapping extension methods
SteveWilkes Aug 7, 2021
2ab8fe5
Removing dictionary key-to-itself assigning / Support for generating …
SteveWilkes Aug 7, 2021
66b311c
Passing a regex pattern instead of a regex to dictionary MatchesKey()…
SteveWilkes Aug 7, 2021
73e75c1
Adding DeepClone methods to generated mappers where appropriate
SteveWilkes Aug 7, 2021
3b02496
Updating README
SteveWilkes Aug 7, 2021
1d6cabb
Adding documentation
SteveWilkes Aug 10, 2021
802c71b
Dox
SteveWilkes Aug 10, 2021
6cd119c
Dox
SteveWilkes Aug 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>AgileObjects.AgileMapper.Buildable.UnitTests.NetCore3</AssemblyName>
<RootNamespace>AgileObjects.AgileMapper.Buildable.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors></WarningsAsErrors>
<NoWarn>0649;1701;1702</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<XprGeneratorDebug>true</XprGeneratorDebug>
<MappersOutputProject>..\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers.csproj</MappersOutputProject>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\AgileMapper.Buildable.UnitTests\**\*.cs" Exclude="..\AgileMapper.Buildable.UnitTests\obj\**\*.cs;..\AgileMapper.Buildable.UnitTests\Mapper*\**\*.cs">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>AgileObjects.AgileMapper.Buildable.UnitTests.NetStandard2.Generator</AssemblyName>
<RootNamespace>AgileObjects.AgileMapper.Buildable.UnitTests.Generator</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<XprGeneratorDebug>false</XprGeneratorDebug>
<MappersOutputProject>..\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers\AgileMapper.Buildable.UnitTests.NetStandard2.Mappers.csproj</MappersOutputProject>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\AgileMapper.Buildable.UnitTests\MapperConfiguration\*.cs">
<Link>MapperConfiguration\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
<Compile Include="..\AgileMapper.Buildable.UnitTests\MapperConfiguration\*\**\*.cs">
<Link>MapperConfiguration\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<PackageReference Include="AgileObjects.AgileMapper.Buildable" Version="0.1.0-preview1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AgileMapper.UnitTests.Common\AgileMapper.UnitTests.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>AgileObjects.AgileMapper.Buildable.UnitTests.NetStandard2.Mappers</AssemblyName>
<RootNamespace>AgileObjects.AgileMapper.Buildable.UnitTests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AgileMapper.UnitTests.Common\AgileMapper.UnitTests.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AgileObjects.AgileMapper.Buildable.
// Runtime Version: 0.1.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using System;
using System.CodeDom.Compiler;
using AgileObjects.AgileMapper;
using AgileObjects.AgileMapper.ObjectPopulation;
using AgileObjects.AgileMapper.UnitTests.Common.TestClasses;

namespace AgileObjects.AgileMapper.Buildable.UnitTests.Mappers
{
[GeneratedCode("AgileObjects.AgileMapper.Buildable", "0.1.0.0")]
public class AddressAddressPublicTwoFieldsMapper : MappingExecutionContextBase<PublicTwoFields<Address, Address>>
{
public AddressAddressPublicTwoFieldsMapper
(
PublicTwoFields<Address, Address> source
)
: base(source)
{
}

public PublicTwoFields<Address, Address> ToANew<TTarget>()
where TTarget : PublicTwoFields<Address, Address>
{
return AddressAddressPublicTwoFieldsMapper.CreateNew(this.CreateRootMappingData(default(PublicTwoFields<Address, Address>)));
}

private static PublicTwoFields<Address, Address> CreateNew
(
IObjectMappingData<PublicTwoFields<Address, Address>, PublicTwoFields<Address, Address>> aaptfToAaptfData
)
{
PublicTwoFields<Address, Address> sourceAddressAddressPublicTwoFields;
try
{
sourceAddressAddressPublicTwoFields = aaptfToAaptfData.Source;

var addressAddressPublicTwoFields = new PublicTwoFields<Address, Address>();

if (sourceAddressAddressPublicTwoFields.Value1 != null)
{
addressAddressPublicTwoFields.Value1 = AddressAddressPublicTwoFieldsMapper.GetAddress1(addressAddressPublicTwoFields, sourceAddressAddressPublicTwoFields);
}

if (sourceAddressAddressPublicTwoFields.Value2 != null)
{
addressAddressPublicTwoFields.Value2 = AddressAddressPublicTwoFieldsMapper.GetAddress2(addressAddressPublicTwoFields, sourceAddressAddressPublicTwoFields);
}

return addressAddressPublicTwoFields;
}
catch (Exception ex)
{
throw MappingException.For(
"CreateNew",
"PublicTwoFields<Address, Address>",
"PublicTwoFields<Address, Address>",
ex);
}
}

private static Address GetAddress1
(
PublicTwoFields<Address, Address> addressAddressPublicTwoFields,
PublicTwoFields<Address, Address> sourceAddressAddressPublicTwoFields
)
{
try
{
var address = addressAddressPublicTwoFields.Value1 ?? new Address();
address.Line1 = sourceAddressAddressPublicTwoFields.Value1.Line1;
address.Line2 = sourceAddressAddressPublicTwoFields.Value1.Line2;

return address;
}
catch (Exception ex)
{
throw MappingException.For(
"CreateNew",
"PublicTwoFields<Address, Address>.Value1",
"PublicTwoFields<Address, Address>.Value1",
ex);
}
}

private static Address GetAddress2
(
PublicTwoFields<Address, Address> addressAddressPublicTwoFields,
PublicTwoFields<Address, Address> sourceAddressAddressPublicTwoFields
)
{
try
{
var address = addressAddressPublicTwoFields.Value2 ?? new Address();
address.Line1 = sourceAddressAddressPublicTwoFields.Value2.Line1;
address.Line2 = sourceAddressAddressPublicTwoFields.Value2.Line2;

return address;
}
catch (Exception ex)
{
throw MappingException.For(
"CreateNew",
"PublicTwoFields<Address, Address>.Value2",
"PublicTwoFields<Address, Address>.Value2",
ex);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AgileObjects.AgileMapper.Buildable.
// Runtime Version: 0.1.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using System;
using System.CodeDom.Compiler;
using AgileObjects.AgileMapper;
using AgileObjects.AgileMapper.ObjectPopulation;
using AgileObjects.AgileMapper.UnitTests.Common.TestClasses;

namespace AgileObjects.AgileMapper.Buildable.UnitTests.Mappers
{
[GeneratedCode("AgileObjects.AgileMapper.Buildable", "0.1.0.0")]
public class AddressMapper : MappingExecutionContextBase<Address>
{
public AddressMapper
(
Address source
)
: base(source)
{
}

public Address OnTo
(
Address target
)
{
return AddressMapper.Merge(this.CreateRootMappingData(target));
}

public Address Over
(
Address target
)
{
return AddressMapper.Overwrite(this.CreateRootMappingData(target));
}

private static Address Merge
(
IObjectMappingData<Address, Address> aToAData
)
{
try
{
if (aToAData.Target.Line1 == null)
{
aToAData.Target.Line1 = aToAData.Source.Line1;
}

if (aToAData.Target.Line2 == null)
{
aToAData.Target.Line2 = aToAData.Source.Line2;
}

return aToAData.Target;
}
catch (Exception ex)
{
throw MappingException.For(
"Merge",
"Address",
"Address",
ex);
}
}

private static Address Overwrite
(
IObjectMappingData<Address, Address> aToAData
)
{
try
{
aToAData.Target.Line1 = aToAData.Source.Line1;
aToAData.Target.Line2 = aToAData.Source.Line2;

return aToAData.Target;
}
catch (Exception ex)
{
throw MappingException.For(
"Overwrite",
"Address",
"Address",
ex);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by AgileObjects.AgileMapper.Buildable.
// Runtime Version: 0.1.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using System;
using System.CodeDom.Compiler;
using System.Linq;
using AgileObjects.AgileMapper;
using AgileObjects.AgileMapper.Extensions;
using AgileObjects.AgileMapper.ObjectPopulation;

namespace AgileObjects.AgileMapper.Buildable.UnitTests.Mappers
{
[GeneratedCode("AgileObjects.AgileMapper.Buildable", "0.1.0.0")]
public class CharArrayMapper : MappingExecutionContextBase<char[]>
{
public CharArrayMapper
(
char[] source
)
: base(source)
{
}

public int[] Over
(
int[] target
)
{
return CharArrayMapper.Overwrite(this.CreateRootMappingData(target));
}

private static int[] Overwrite
(
IObjectMappingData<char[], int[]> caToIaData
)
{
try
{
return caToIaData.Source.Project(c => CharArrayMapper.GetInt(c)).ToArray();
}
catch (Exception ex)
{
throw MappingException.For(
"Overwrite",
"char[]",
"int[]",
ex);
}
}

private static int GetInt
(
char c
)
{
int intValue;
return int.TryParse(c.ToString(), out intValue) ? intValue : default(int);
}
}
}
Loading