Skip to content

Commit cee2031

Browse files
authored
Releases/1.1.0 (#117)
* Fixing hardcoded int in runtime-typed mapping data construbtion lambda creator, fixes issue #110 * Updating to v1.1-preview, with first 1.1-preview NuGet package * Updating preview package nuspec * Adding null entries to object dictionaries if source entry is null * Correctly incementing loop counter when source elements are null * Copying null source entries to target dictionaries * Updating to ReadableExpressions v2.1 * Fixing runtime-typed ObjectMappingData parameter cast check, re: #110 * Updating to v1.1-preview2 * Features/simple type to target config 111 (#112) * Start of support for using .ToTarget() to configure simple type mappings Tidying * Support for ToTarget() configuration for simple type members * Support for nested simple type ToTarget configuration * Tidying * Applying simple type ToTarget configurations inside complex type enumerables * Avoiding creation of nested blocks when making population expressions Array-handling performance tweaks * Updating to v1.1 preview 3 * Adding v1.1-preview3 NuGet package * Using operators where available (#116) * Adding generic operator value converter * Erroring if a target factory is specified for a primitive type * Using target-type operators to convert source values to target types * Updating to v1.1-preview4 * Only using MapRepeated for mapping with recursive object graphs - fixes issue #115 * Clarifying what constitutes a recursive member Reorganising assembly-scanning tests * Updating to v1.1-preview5 and NuGet package * Support for configured complex-to-simple Type enumerable projection sources, re: #113 Mapping enumerables with unconvertible element Types to empty collections Erroring if unconvertible enumerable element Types are configured * Improved null handling in object collection to object collection mapping More efficient mapping of simple-type entries in object Dictionary-to-object Dictionary mapping Consolidating block expressions in enumerable mappings * Updating docs, re: Type conversion and operators
1 parent f0b56af commit cee2031

File tree

84 files changed

+1358
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1358
-397
lines changed

AgileMapper.PerformanceTester.Net45/AgileMapper.PerformanceTester.Net45.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
<Reference Include="AgileObjects.NetStandardPolyfills, Version=1.4.0.0, Culture=neutral, PublicKeyToken=06131ac1c008ad4e, processorArchitecture=MSIL">
3838
<HintPath>..\packages\AgileObjects.NetStandardPolyfills.1.4.0\lib\net40\AgileObjects.NetStandardPolyfills.dll</HintPath>
3939
</Reference>
40-
<Reference Include="AgileObjects.ReadableExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
41-
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.0.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
40+
<Reference Include="AgileObjects.ReadableExpressions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
41+
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.1.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
4242
</Reference>
4343
<Reference Include="AutoMapper, Version=7.0.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
4444
<HintPath>..\packages\AutoMapper.7.0.1\lib\net45\AutoMapper.dll</HintPath>

AgileMapper.PerformanceTester.Net45/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="AgileObjects.NetStandardPolyfills" version="1.4.0" targetFramework="net452" />
4-
<package id="AgileObjects.ReadableExpressions" version="2.0.0" targetFramework="net452" />
4+
<package id="AgileObjects.ReadableExpressions" version="2.1.0" targetFramework="net452" />
55
<package id="AutoMapper" version="7.0.1" targetFramework="net452" />
66
<package id="Expressmapper" version="1.9.1" targetFramework="net452" />
77
<package id="Mapster" version="3.2.0" targetFramework="net452" />

AgileMapper.UnitTests.Common/ShouldExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ public static IDictionary<TKey, TValue> ShouldContainKeyAndValue<TKey, TValue>(
400400
Asplode("Dictionary with key " + expectedKey, "No contained key");
401401
}
402402

403-
value.ShouldBeSameAs(expectedValue);
403+
value.ShouldBe(expectedValue);
404404

405405
return dictionary;
406406
}

AgileMapper.UnitTests.Net35/AgileMapper.UnitTests.Net35.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
<Reference Include="AgileObjects.NetStandardPolyfills, Version=1.4.0.0, Culture=neutral, PublicKeyToken=06131ac1c008ad4e, processorArchitecture=MSIL">
3838
<HintPath>..\packages\AgileObjects.NetStandardPolyfills.1.4.0\lib\net35\AgileObjects.NetStandardPolyfills.dll</HintPath>
3939
</Reference>
40-
<Reference Include="AgileObjects.ReadableExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
41-
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.0.0\lib\net35\AgileObjects.ReadableExpressions.dll</HintPath>
40+
<Reference Include="AgileObjects.ReadableExpressions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
41+
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.1.0\lib\net35\AgileObjects.ReadableExpressions.dll</HintPath>
4242
</Reference>
4343
<Reference Include="Microsoft.Dynamic, Version=1.1.2.22, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
4444
<HintPath>..\packages\DynamicLanguageRuntime.1.1.2\lib\Net35\Microsoft.Dynamic.dll</HintPath>

AgileMapper.UnitTests.Net35/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="AgileObjects.NetStandardPolyfills" version="1.4.0" targetFramework="net35" />
4-
<package id="AgileObjects.ReadableExpressions" version="2.0.0" targetFramework="net35" />
4+
<package id="AgileObjects.ReadableExpressions" version="2.1.0" targetFramework="net35" />
55
<package id="DynamicLanguageRuntime" version="1.1.2" targetFramework="net35" />
66
<package id="NUnit" version="3.6.1" targetFramework="net35" />
77
<package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net35" />

AgileMapper.UnitTests.NonParallel/AgileMapper.UnitTests.NonParallel.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
<Reference Include="AgileObjects.NetStandardPolyfills, Version=1.4.0.0, Culture=neutral, PublicKeyToken=06131ac1c008ad4e, processorArchitecture=MSIL">
4343
<HintPath>..\packages\AgileObjects.NetStandardPolyfills.1.4.0\lib\net40\AgileObjects.NetStandardPolyfills.dll</HintPath>
4444
</Reference>
45-
<Reference Include="AgileObjects.ReadableExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
46-
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.0.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
45+
<Reference Include="AgileObjects.ReadableExpressions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
46+
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.1.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
4747
</Reference>
4848
<Reference Include="System" />
4949
<Reference Include="System.Core" />
@@ -75,6 +75,7 @@
7575
<Link>VersionInfo.cs</Link>
7676
</Compile>
7777
<Compile Include="Configuration\Inline\WhenConfiguringDataSourcesInline.cs" />
78+
<Compile Include="Configuration\Inline\WhenConfiguringDerivedTypesInline.cs" />
7879
<Compile Include="Configuration\WhenApplyingMapperConfigurations.cs" />
7980
<Compile Include="Configuration\WhenApplyingMapperConfigurationsIncorrectly.cs" />
8081
<Compile Include="Configuration\WhenConfiguringDataSources.cs" />
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
namespace AgileObjects.AgileMapper.UnitTests.NonParallel.Configuration.Inline
2+
{
3+
using Common;
4+
using MoreTestClasses;
5+
using NetStandardPolyfills;
6+
using TestClasses;
7+
using Xunit;
8+
9+
public class WhenConfiguringDerivedTypesInline : NonParallelTestsBase
10+
{
11+
[Fact]
12+
public void ShouldScanConfiguredAssembliesInline()
13+
{
14+
TestThenReset(() =>
15+
{
16+
var result = Mapper
17+
.Map(new { NumberOfLegs = 100, SlitherNoise = "ththtth" })
18+
.Over(new Earthworm() as AnimalBase, cgf => cgf
19+
.LookForDerivedTypesIn(typeof(Dog).GetAssembly(), typeof(Earthworm).GetAssembly()));
20+
21+
result.NumberOfLegs.ShouldBe(100);
22+
((Earthworm)result).SlitherNoise.ShouldBe("ththtth");
23+
});
24+
}
25+
}
26+
}

AgileMapper.UnitTests.NonParallel/Configuration/WhenConfiguringDerivedTypes.cs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
{
33
using Common;
44
using MoreTestClasses;
5+
using NetStandardPolyfills;
56
using TestClasses;
67
using Xunit;
78

89
public class WhenConfiguringDerivedTypes : NonParallelTestsBase
910
{
1011
[Fact]
11-
public void ShouldScanConfiguredAssemblies()
12+
public void ShouldScanConfiguredAssembliesViaTheStaticApi()
1213
{
1314
TestThenReset(() =>
1415
{
@@ -30,5 +31,57 @@ public void ShouldScanConfiguredAssemblies()
3031
((Earthworm)wormResult).SlitherNoise.ShouldBe("sssSSS");
3132
});
3233
}
34+
35+
[Fact]
36+
public void ShouldScanConfiguredAssembliesViaTheInstanceApi()
37+
{
38+
TestThenReset(() =>
39+
{
40+
using (var mapper = Mapper.CreateNew())
41+
{
42+
mapper.WhenMapping
43+
.LookForDerivedTypesIn(typeof(Dog).GetAssembly(), typeof(Earthworm).GetAssembly());
44+
45+
var result = mapper
46+
.Map(new { NumberOfLegs = 1000, SlitherNoise = "thththtth" })
47+
.Over(new Earthworm() as AnimalBase);
48+
49+
result.NumberOfLegs.ShouldBe(1000);
50+
((Earthworm)result).SlitherNoise.ShouldBe("thththtth");
51+
}
52+
});
53+
}
54+
55+
[Fact]
56+
public void ShouldSetAssembliesToScanGlobally()
57+
{
58+
TestThenReset(() =>
59+
{
60+
using (var mapper1 = Mapper.CreateNew())
61+
using (var mapper2 = Mapper.CreateNew())
62+
{
63+
// Set assembly scanning on mapper1...
64+
mapper1.WhenMapping
65+
.LookForDerivedTypesIn(typeof(Dog).GetAssembly(), typeof(Earthworm).GetAssembly());
66+
67+
// ...use mapper2 to cache the assembly scan results...
68+
var result1 = mapper2
69+
.Map(new { NumberOfLegs = 4, WoofSound = "AWESOME" })
70+
.OnTo(new Dog() as AnimalBase);
71+
72+
result1.NumberOfLegs.ShouldBe(4);
73+
((Dog)result1).WoofSound.ShouldBe("AWESOME");
74+
75+
// ...use mapper1 with a type outside the base type's assembly;
76+
// assemblies are cached globally, so the scan settings should be too:
77+
var result2 = mapper1
78+
.Map(new { NumberOfLegs = 100, SlitherNoise = "SLITHERRR" })
79+
.OnTo(new Earthworm() as AnimalBase);
80+
81+
result2.NumberOfLegs.ShouldBe(100);
82+
((Earthworm)result2).SlitherNoise.ShouldBe("SLITHERRR");
83+
}
84+
});
85+
}
3386
}
3487
}

AgileMapper.UnitTests.NonParallel/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="AgileObjects.NetStandardPolyfills" version="1.4.0" targetFramework="net461" />
4-
<package id="AgileObjects.ReadableExpressions" version="2.0.0" targetFramework="net461" />
4+
<package id="AgileObjects.ReadableExpressions" version="2.1.0" targetFramework="net461" />
55
<package id="xunit" version="2.4.1" targetFramework="net461" />
66
<package id="xunit.abstractions" version="2.0.3" targetFramework="net461" />
77
<package id="xunit.analyzers" version="0.10.0" targetFramework="net461" />

AgileMapper.UnitTests/AgileMapper.UnitTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<Reference Include="AgileObjects.NetStandardPolyfills, Version=1.4.0.0, Culture=neutral, PublicKeyToken=06131ac1c008ad4e, processorArchitecture=MSIL">
4545
<HintPath>..\packages\AgileObjects.NetStandardPolyfills.1.4.0\lib\net40\AgileObjects.NetStandardPolyfills.dll</HintPath>
4646
</Reference>
47-
<Reference Include="AgileObjects.ReadableExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
48-
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.0.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
47+
<Reference Include="AgileObjects.ReadableExpressions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9f54ad81db69da8e, processorArchitecture=MSIL">
48+
<HintPath>..\packages\AgileObjects.ReadableExpressions.2.1.0\lib\net40\AgileObjects.ReadableExpressions.dll</HintPath>
4949
</Reference>
5050
<Reference Include="Microsoft.Extensions.Primitives, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
5151
<HintPath>..\packages\Microsoft.Extensions.Primitives.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>

0 commit comments

Comments
 (0)