Skip to content

Commit 1b2c759

Browse files
authored
Merge pull request #2658 from AutoMapper/break-out-expression-mapper
Break out expression mapper
2 parents 5502546 + 7bbdd0e commit 1b2c759

File tree

92 files changed

+51
-8476
lines changed

Some content is hidden

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

92 files changed

+51
-8476
lines changed

AutoMapper.sln

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
77
appveyor.yml = appveyor.yml
88
CONTRIBUTING.md = CONTRIBUTING.md
99
default.ps1 = default.ps1
10+
Directory.Build.props = Directory.Build.props
1011
ISSUE_TEMPLATE.md = ISSUE_TEMPLATE.md
1112
README.md = README.md
1213
EndProjectSection
@@ -15,18 +16,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{C1930F52-C
1516
EndProject
1617
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{1BCC7A00-6382-4891-936A-F164614D26A4}"
1718
EndProject
18-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}"
19-
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapperSamples", "src\AutoMapperSamples\AutoMapperSamples.csproj", "{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}"
21-
EndProject
22-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}"
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}"
2320
EndProject
2421
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper", "src\AutoMapper\AutoMapper.csproj", "{35888286-1428-4BF3-BB0C-D8BC092D0A5D}"
2522
EndProject
26-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapperSamples.EF", "src\AutoMapperSamples.EF\AutoMapperSamples.EF.csproj", "{D497FA09-E931-4B4E-870A-55EC8E3E35E2}"
27-
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapperSamples.OData", "src\AutoMapperSamples.OData\AutoMapperSamples.OData.csproj", "{E87F3347-5604-42DD-915B-173BDE2AAAF3}"
29-
EndProject
3023
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.UnitTests", "src\UnitTests\AutoMapper.UnitTests.csproj", "{4F96C184-FF4B-4256-B8BC-C51D1167C489}"
3124
EndProject
3225
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.IntegrationTests", "src\IntegrationTests\AutoMapper.IntegrationTests.csproj", "{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}"
@@ -43,16 +36,6 @@ Global
4336
Release|x86 = Release|x86
4437
EndGlobalSection
4538
GlobalSection(ProjectConfigurationPlatforms) = postSolution
46-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
48-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|ARM.ActiveCfg = Debug|Any CPU
49-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|x64.ActiveCfg = Debug|Any CPU
50-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Debug|x86.ActiveCfg = Debug|Any CPU
51-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
52-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|Any CPU.Build.0 = Release|Any CPU
53-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|ARM.ActiveCfg = Release|Any CPU
54-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|x64.ActiveCfg = Release|Any CPU
55-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7}.Release|x86.ActiveCfg = Release|Any CPU
5639
{B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5740
{B8051389-CB47-46FB-B234-9D49506704AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
5841
{B8051389-CB47-46FB-B234-9D49506704AA}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -79,38 +62,6 @@ Global
7962
{35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x64.Build.0 = Release|Any CPU
8063
{35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.ActiveCfg = Release|Any CPU
8164
{35888286-1428-4BF3-BB0C-D8BC092D0A5D}.Release|x86.Build.0 = Release|Any CPU
82-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
84-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|ARM.ActiveCfg = Debug|Any CPU
85-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|ARM.Build.0 = Debug|Any CPU
86-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|x64.ActiveCfg = Debug|Any CPU
87-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|x64.Build.0 = Debug|Any CPU
88-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|x86.ActiveCfg = Debug|Any CPU
89-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Debug|x86.Build.0 = Debug|Any CPU
90-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
91-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|Any CPU.Build.0 = Release|Any CPU
92-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|ARM.ActiveCfg = Release|Any CPU
93-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|ARM.Build.0 = Release|Any CPU
94-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|x64.ActiveCfg = Release|Any CPU
95-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|x64.Build.0 = Release|Any CPU
96-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|x86.ActiveCfg = Release|Any CPU
97-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2}.Release|x86.Build.0 = Release|Any CPU
98-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
100-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|ARM.ActiveCfg = Debug|Any CPU
101-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|ARM.Build.0 = Debug|Any CPU
102-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|x64.ActiveCfg = Debug|Any CPU
103-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|x64.Build.0 = Debug|Any CPU
104-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|x86.ActiveCfg = Debug|Any CPU
105-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Debug|x86.Build.0 = Debug|Any CPU
106-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
107-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|Any CPU.Build.0 = Release|Any CPU
108-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|ARM.ActiveCfg = Release|Any CPU
109-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|ARM.Build.0 = Release|Any CPU
110-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|x64.ActiveCfg = Release|Any CPU
111-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|x64.Build.0 = Release|Any CPU
112-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|x86.ActiveCfg = Release|Any CPU
113-
{E87F3347-5604-42DD-915B-173BDE2AAAF3}.Release|x86.Build.0 = Release|Any CPU
11465
{4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
11566
{4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|Any CPU.Build.0 = Debug|Any CPU
11667
{4F96C184-FF4B-4256-B8BC-C51D1167C489}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -148,11 +99,8 @@ Global
14899
HideSolutionNode = FALSE
149100
EndGlobalSection
150101
GlobalSection(NestedProjects) = preSolution
151-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}
152102
{B8051389-CB47-46FB-B234-9D49506704AA} = {1BCC7A00-6382-4891-936A-F164614D26A4}
153103
{35888286-1428-4BF3-BB0C-D8BC092D0A5D} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
154-
{D497FA09-E931-4B4E-870A-55EC8E3E35E2} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}
155-
{E87F3347-5604-42DD-915B-173BDE2AAAF3} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}
156104
{4F96C184-FF4B-4256-B8BC-C51D1167C489} = {1BCC7A00-6382-4891-936A-F164614D26A4}
157105
{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E} = {1BCC7A00-6382-4891-936A-F164614D26A4}
158106
EndGlobalSection

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>7.0.0-alpha-0001</VersionPrefix>
4+
<VersionPrefix>7.0.0</VersionPrefix>
55
<Authors>Jimmy Bogard</Authors>
66
<LangVersion>latest</LangVersion>
77
<WarningsAsErrors>true</WarningsAsErrors>

appveyor.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ branches:
55
only:
66
- master
77
image: Visual Studio 2017
8+
## temporary until 2.1 sdk is installed
9+
install:
10+
- ps: $urlCurrent = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300/dotnet-sdk-2.1.300-win-x64.zip"
11+
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
12+
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
13+
- ps: $tempFileCurrent = [System.IO.Path]::GetTempFileName()
14+
- ps: (New-Object System.Net.WebClient).DownloadFile($urlCurrent, $tempFileCurrent)
15+
- ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFileCurrent, $env:DOTNET_INSTALL_DIR)
16+
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
817
nuget:
918
disable_publish_on_pr: true
1019
build_script:

default.ps1

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ task compile -depends clean {
3232
echo "build: Tag is $tag"
3333
echo "build: Package version suffix is $suffix"
3434
echo "build: Build version suffix is $buildSuffix"
35-
35+
3636
exec { dotnet --version }
3737
exec { dotnet --info }
3838

39-
exec { .\nuget.exe restore $base_dir\AutoMapper.sln }
40-
4139
exec { dotnet build -c $config --version-suffix=$buildSuffix }
4240

4341
exec { dotnet pack $source_dir\AutoMapper\AutoMapper.csproj -c $config --include-symbols --no-build $versionSuffix }
@@ -47,20 +45,20 @@ task benchmark {
4745
exec { & $source_dir\Benchmark\bin\$config\net452\Benchmark.exe }
4846
}
4947

50-
task test {
48+
task test {
5149
Push-Location -Path $source_dir\UnitTests
52-
50+
5351
try {
54-
exec { & dotnet xunit -configuration Release }
52+
exec { & dotnet test -c Release --no-build --no-restore }
5553
} finally {
56-
Pop-Location
54+
Pop-Location
5755
}
5856

5957
Push-Location -Path $source_dir\IntegrationTests
60-
58+
6159
try {
62-
exec { & dotnet xunit -configuration Release }
60+
exec { & dotnet test -c Release --no-build --no-restore }
6361
} finally {
64-
Pop-Location
62+
Pop-Location
6563
}
6664
}

src/AutoMapper/AutoMapper.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
21-
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
21+
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
2222
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
2323
</ItemGroup>
2424

2525
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
2626
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
2727
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
28-
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
28+
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
2929
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.0" />
3030
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
3131
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />

src/AutoMapper/LockingConcurrentDictionary.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
44

5-
namespace AutoMapper
5+
namespace AutoMapper
66
{
7-
internal struct LockingConcurrentDictionary<TKey, TValue>
8-
{
9-
private readonly ConcurrentDictionary<TKey, Lazy<TValue>> _dictionary;
10-
private readonly Func<TKey, Lazy<TValue>> _valueFactory;
11-
12-
public LockingConcurrentDictionary(Func<TKey, TValue> valueFactory)
13-
{
14-
_dictionary = new ConcurrentDictionary<TKey, Lazy<TValue>>();
15-
_valueFactory = key => new Lazy<TValue>(() => valueFactory(key));
16-
}
17-
18-
public TValue GetOrAdd(TKey key) => _dictionary.GetOrAdd(key, _valueFactory).Value;
19-
public TValue GetOrAdd(TKey key, Func<TKey, Lazy<TValue>> valueFactory) => _dictionary.GetOrAdd(key, valueFactory).Value;
20-
7+
internal struct LockingConcurrentDictionary<TKey, TValue>
8+
{
9+
private readonly ConcurrentDictionary<TKey, Lazy<TValue>> _dictionary;
10+
private readonly Func<TKey, Lazy<TValue>> _valueFactory;
11+
12+
public LockingConcurrentDictionary(Func<TKey, TValue> valueFactory)
13+
{
14+
_dictionary = new ConcurrentDictionary<TKey, Lazy<TValue>>();
15+
_valueFactory = key => new Lazy<TValue>(() => valueFactory(key));
16+
}
17+
18+
public TValue GetOrAdd(TKey key) => _dictionary.GetOrAdd(key, _valueFactory).Value;
19+
public TValue GetOrAdd(TKey key, Func<TKey, Lazy<TValue>> valueFactory) => _dictionary.GetOrAdd(key, valueFactory).Value;
20+
2121
public TValue this[TKey key]
2222
{
2323
get => _dictionary[key].Value;
2424
set => _dictionary[key] = new Lazy<TValue>(() => value);
25-
}
26-
25+
}
26+
2727
public bool TryGetValue(TKey key, out TValue value)
2828
{
2929
if (_dictionary.TryGetValue(key, out Lazy<TValue> lazy))
@@ -38,5 +38,5 @@ public bool TryGetValue(TKey key, out TValue value)
3838
public bool ContainsKey(TKey key) => _dictionary.ContainsKey(key);
3939

4040
public ICollection<TKey> Keys => _dictionary.Keys;
41-
}
41+
}
4242
}

0 commit comments

Comments
 (0)