Skip to content

Commit e61813a

Browse files
committed
Merge branch 'develop'
2 parents 85fcd02 + af890ba commit e61813a

File tree

68 files changed

+3390
-784
lines changed

Some content is hidden

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

68 files changed

+3390
-784
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="http://automapper.org/img/white_logo.png" alt="AutoMapper" width="498" height="51">
1+
<img src="https://s3.amazonaws.com/automapper/logo.png" alt="AutoMapper">
22
================================
33

44
What is AutoMapper?

default.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ task dist {
5454
copy_files "$source_dir\AutoMapper\bin\Net4\$config" "$dist_dir\net40"
5555
copy_files "$source_dir\AutoMapper\bin\sl5\$config" "$dist_dir\sl5"
5656
copy_files "$source_dir\AutoMapper\bin\wp8\$config" "$dist_dir\wp8"
57+
copy_files "$source_dir\AutoMapper\bin\wpa81\$config" "$dist_dir\wpa81"
5758
copy_files "$source_dir\AutoMapper\bin\WinRT\$config" "$dist_dir\windows8"
5859
copy_files "$source_dir\AutoMapper\bin\Android\$config" "$dist_dir\MonoAndroid"
5960
copy_files "$source_dir\AutoMapper\bin\iPhone\$config" "$dist_dir\MonoTouch"
@@ -141,9 +142,9 @@ function global:create-nuspec($version, $fileName)
141142
<description>A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.</description>
142143
</metadata>
143144
<files>
144-
<file src=""$dist_dir\net40\AutoMapper.dll"" target=""lib\portable-windows8+net40+wp8+sl5+MonoAndroid+MonoTouch"" />
145-
<file src=""$dist_dir\net40\AutoMapper.pdb"" target=""lib\portable-windows8+net40+wp8+sl5+MonoAndroid+MonoTouch"" />
146-
<file src=""$dist_dir\net40\AutoMapper.xml"" target=""lib\portable-windows8+net40+wp8+sl5+MonoAndroid+MonoTouch"" />
145+
<file src=""$dist_dir\net40\AutoMapper.dll"" target=""lib\portable-windows8+net40+wp8+wpa81+sl5+MonoAndroid+MonoTouch"" />
146+
<file src=""$dist_dir\net40\AutoMapper.pdb"" target=""lib\portable-windows8+net40+wp8+wpa81+sl5+MonoAndroid+MonoTouch"" />
147+
<file src=""$dist_dir\net40\AutoMapper.xml"" target=""lib\portable-windows8+net40+wp8+wpa81+sl5+MonoAndroid+MonoTouch"" />
147148
<file src=""$dist_dir\net40\AutoMapper.dll"" target=""lib\net40"" />
148149
<file src=""$dist_dir\net40\AutoMapper.pdb"" target=""lib\net40"" />
149150
<file src=""$dist_dir\net40\AutoMapper.xml"" target=""lib\net40"" />
@@ -165,6 +166,13 @@ function global:create-nuspec($version, $fileName)
165166
<file src=""$dist_dir\wp8\AutoMapper.WP8.pdb"" target=""lib\wp8"" />
166167
<file src=""$source_dir\install.ps1"" target=""tools\wp8"" />
167168
<file src=""$source_dir\uninstall.ps1"" target=""tools\wp8"" />
169+
<file src=""$dist_dir\wpa81\AutoMapper.dll"" target=""lib\wpa81"" />
170+
<file src=""$dist_dir\wpa81\AutoMapper.pdb"" target=""lib\wpa81"" />
171+
<file src=""$dist_dir\wpa81\AutoMapper.xml"" target=""lib\wpa81"" />
172+
<file src=""$dist_dir\wpa81\AutoMapper.WPA81.dll"" target=""lib\wpa81"" />
173+
<file src=""$dist_dir\wpa81\AutoMapper.WPA81.pdb"" target=""lib\wpa81"" />
174+
<file src=""$source_dir\install.ps1"" target=""tools\wpa81"" />
175+
<file src=""$source_dir\uninstall.ps1"" target=""tools\wpa81"" />
168176
<file src=""$dist_dir\net40\AutoMapper.dll"" target=""lib\windows8"" />
169177
<file src=""$dist_dir\net40\AutoMapper.pdb"" target=""lib\windows8"" />
170178
<file src=""$dist_dir\net40\AutoMapper.xml"" target=""lib\windows8"" />
@@ -186,6 +194,7 @@ function global:create-nuspec($version, $fileName)
186194
<file src=""$dist_dir\MonoTouch\AutoMapper.iOS.pdb"" target=""lib\MonoTouch"" />
187195
<file src=""$source_dir\install.ps1"" target=""tools\MonoTouch"" />
188196
<file src=""$source_dir\uninstall.ps1"" target=""tools\MonoTouch"" />
197+
<file src=""$source_dir\AutoMapper.targets"" target=""tools"" />
189198
<file src=""**\*.cs"" target=""src"" />
190199
</files>
191200
</package>" | out-file $build_dir\$fileName -encoding "ASCII"

src/.nuget/NuGet.exe

833 KB
Binary file not shown.

src/AutoMapper.sln

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 2012
2+
# Visual Studio 2013
3+
VisualStudioVersion = 12.0.30324.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
35
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0691ABF2-B3C7-43BF-9862-2D8D1299CE58}"
46
ProjectSection(SolutionItems) = preProject
7+
AutoMapper.targets = AutoMapper.targets
58
..\default.ps1 = ..\default.ps1
69
Install.ps1 = Install.ps1
710
..\psake.bat = ..\psake.bat
@@ -50,6 +53,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper.Android", "AutoM
5053
EndProject
5154
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper.iOS", "AutoMapper\AutoMapper.iOS.csproj", "{693983C2-F4DE-44CB-A1D3-2AB00DF159DE}"
5255
EndProject
56+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoMapper.WPA81", "AutoMapper\AutoMapper.WPA81.csproj", "{F0D56AA4-806C-4D76-9227-5078CC44A68C}"
57+
EndProject
5358
Global
5459
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5560
Debug|Any CPU = Debug|Any CPU
@@ -218,24 +223,39 @@ Global
218223
{693983C2-F4DE-44CB-A1D3-2AB00DF159DE}.Release|ARM.ActiveCfg = Release|Any CPU
219224
{693983C2-F4DE-44CB-A1D3-2AB00DF159DE}.Release|x64.ActiveCfg = Release|Any CPU
220225
{693983C2-F4DE-44CB-A1D3-2AB00DF159DE}.Release|x86.ActiveCfg = Release|Any CPU
226+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
227+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|Any CPU.Build.0 = Debug|Any CPU
228+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|ARM.ActiveCfg = Debug|ARM
229+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|ARM.Build.0 = Debug|ARM
230+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|x64.ActiveCfg = Debug|Any CPU
231+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|x86.ActiveCfg = Debug|x86
232+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Debug|x86.Build.0 = Debug|x86
233+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|Any CPU.ActiveCfg = Release|Any CPU
234+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|Any CPU.Build.0 = Release|Any CPU
235+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|ARM.ActiveCfg = Release|ARM
236+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|ARM.Build.0 = Release|ARM
237+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|x64.ActiveCfg = Release|Any CPU
238+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|x86.ActiveCfg = Release|x86
239+
{F0D56AA4-806C-4D76-9227-5078CC44A68C}.Release|x86.Build.0 = Release|x86
221240
EndGlobalSection
222241
GlobalSection(SolutionProperties) = preSolution
223242
HideSolutionNode = FALSE
224243
EndGlobalSection
225244
GlobalSection(NestedProjects) = preSolution
226-
{B8051389-CB47-46FB-B234-9D49506704AA} = {1BCC7A00-6382-4891-936A-F164614D26A4}
227245
{002075C5-6517-4794-BC99-9B17B9E884E7} = {1BCC7A00-6382-4891-936A-F164614D26A4}
228-
{BACACF2C-237F-4A48-A891-32B258207095} = {1BCC7A00-6382-4891-936A-F164614D26A4}
229-
{19CF22A3-AA57-458B-9D72-1D8AD069F428} = {1BCC7A00-6382-4891-936A-F164614D26A4}
230-
{70D99BDC-6B9E-49AD-96FD-AEC193D27B55} = {1BCC7A00-6382-4891-936A-F164614D26A4}
231-
{906F2125-2AEC-44A3-A95F-CB79C0A745BB} = {1BCC7A00-6382-4891-936A-F164614D26A4}
232246
{DDF551F9-B27D-4283-BFA0-E7068E05967D} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
247+
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}
248+
{B8051389-CB47-46FB-B234-9D49506704AA} = {1BCC7A00-6382-4891-936A-F164614D26A4}
233249
{8C955148-FA96-4F0D-880D-ABB6770F54E9} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
234250
{A46863C7-1DEC-4037-9FC2-C353021F2490} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
235251
{B80D950D-CC8D-4287-96B1-EEA037825E90} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
236252
{B95F2EB2-519E-4BAB-B6B3-6DBBEA7879A6} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
253+
{BACACF2C-237F-4A48-A891-32B258207095} = {1BCC7A00-6382-4891-936A-F164614D26A4}
254+
{19CF22A3-AA57-458B-9D72-1D8AD069F428} = {1BCC7A00-6382-4891-936A-F164614D26A4}
255+
{70D99BDC-6B9E-49AD-96FD-AEC193D27B55} = {1BCC7A00-6382-4891-936A-F164614D26A4}
256+
{906F2125-2AEC-44A3-A95F-CB79C0A745BB} = {1BCC7A00-6382-4891-936A-F164614D26A4}
237257
{DFE156BE-4D3D-4A6A-9E23-747DFD46920D} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
238258
{693983C2-F4DE-44CB-A1D3-2AB00DF159DE} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
239-
{277C689D-B1C1-43EA-B20D-C1155C4B2EA7} = {B84E9CD3-2DDB-47FA-84BE-732EBF2F46CD}
259+
{F0D56AA4-806C-4D76-9227-5078CC44A68C} = {C1930F52-C66E-4E56-B7DB-FD42E497FFF0}
240260
EndGlobalSection
241261
EndGlobal

src/AutoMapper.targets

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!-- Build sequence modification -->
5+
<Target Name="CopyAutoMapperAssembly"
6+
AfterTargets="ResolveAssemblyReferences">
7+
<CreateItem Include="%(ReferencePath.FullPath)"
8+
Condition="$([System.String]::new('%(ReferencePath.Filename)').StartsWith('AutoMapper.'))">
9+
<Output TaskParameter="Include"
10+
ItemName="_AutoMapperReference"/>
11+
</CreateItem>
12+
13+
<Message Importance="low" Text="AutoMapper Platform Extension Assembly: %(_AutoMapperReference.FullPath)"/>
14+
15+
<ItemGroup>
16+
<Content Include="$([MSBuild]::MakeRelative($(MSBuildProjectDirectory), %(_AutoMapperReference.FullPath)))" Condition="'%(_AutoMapperReference.FullPath)' != ''">
17+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
18+
</Content>
19+
</ItemGroup>
20+
</Target>
21+
</Project>
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProductVersion>8.0.30703</ProductVersion>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{F0D56AA4-806C-4D76-9227-5078CC44A68C}</ProjectGuid>
10+
<OutputType>Library</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<RootNamespace>AutoMapper</RootNamespace>
13+
<AssemblyName>AutoMapper.WPA81</AssemblyName>
14+
<DefaultLanguage>en-US</DefaultLanguage>
15+
<TargetPlatformVersion>8.1</TargetPlatformVersion>
16+
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
17+
<FileAlignment>512</FileAlignment>
18+
<ProjectTypeGuids>{76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>Bin\WPA81\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
<DocumentationFile>Bin\WPA81\Debug\AutoMapper.WPA81.XML</DocumentationFile>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>Bin\WPA81\Release\</OutputPath>
34+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
<DocumentationFile>Bin\WPA81\Release\AutoMapper.WPA81.XML</DocumentationFile>
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
40+
<DebugSymbols>true</DebugSymbols>
41+
<OutputPath>bin\ARM\Debug\</OutputPath>
42+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
43+
<NoWarn>;2008</NoWarn>
44+
<DebugType>full</DebugType>
45+
<PlatformTarget>ARM</PlatformTarget>
46+
<UseVSHostingProcess>false</UseVSHostingProcess>
47+
<ErrorReport>prompt</ErrorReport>
48+
<Prefer32Bit>true</Prefer32Bit>
49+
</PropertyGroup>
50+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
51+
<OutputPath>bin\ARM\Release\</OutputPath>
52+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
53+
<Optimize>true</Optimize>
54+
<NoWarn>;2008</NoWarn>
55+
<DebugType>pdbonly</DebugType>
56+
<PlatformTarget>ARM</PlatformTarget>
57+
<UseVSHostingProcess>false</UseVSHostingProcess>
58+
<ErrorReport>prompt</ErrorReport>
59+
<Prefer32Bit>true</Prefer32Bit>
60+
</PropertyGroup>
61+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
62+
<DebugSymbols>true</DebugSymbols>
63+
<OutputPath>bin\x86\Debug\</OutputPath>
64+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
65+
<NoWarn>;2008</NoWarn>
66+
<DebugType>full</DebugType>
67+
<PlatformTarget>x86</PlatformTarget>
68+
<UseVSHostingProcess>false</UseVSHostingProcess>
69+
<ErrorReport>prompt</ErrorReport>
70+
<Prefer32Bit>true</Prefer32Bit>
71+
</PropertyGroup>
72+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
73+
<OutputPath>bin\x86\Release\</OutputPath>
74+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
75+
<Optimize>true</Optimize>
76+
<NoWarn>;2008</NoWarn>
77+
<DebugType>pdbonly</DebugType>
78+
<PlatformTarget>x86</PlatformTarget>
79+
<UseVSHostingProcess>false</UseVSHostingProcess>
80+
<ErrorReport>prompt</ErrorReport>
81+
<Prefer32Bit>true</Prefer32Bit>
82+
</PropertyGroup>
83+
<ItemGroup>
84+
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
85+
<ProjectReference Include="AutoMapper.csproj">
86+
<Project>{ddf551f9-b27d-4283-bfa0-e7068e05967d}</Project>
87+
<Name>AutoMapper</Name>
88+
</ProjectReference>
89+
</ItemGroup>
90+
<ItemGroup>
91+
<Compile Include="..\CommonAssemblyInfo.cs">
92+
<Link>CommonAssemblyInfo.cs</Link>
93+
</Compile>
94+
<Compile Include="Internal\ConcurrentDictionaryFactory.cs" />
95+
<Compile Include="Internal\EnumNameValueMapperFactory.cs" />
96+
<Compile Include="Internal\ExpressionOnlyDelegateFactory.cs" />
97+
<Compile Include="Internal\RealReaderWriterLockSlimFactory.cs" />
98+
<Compile Include="Mappers\HashSetMapper.cs" />
99+
<Compile Include="Mappers\PlatformSpecificMapperRegistryOverride.cs" />
100+
<Compile Include="Properties\AssemblyInfo.cs" />
101+
</ItemGroup>
102+
<ItemGroup>
103+
<None Include="..\AutoMapper.snk">
104+
<Link>AutoMapper.snk</Link>
105+
</None>
106+
</ItemGroup>
107+
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
108+
<VisualStudioVersion>12.0</VisualStudioVersion>
109+
</PropertyGroup>
110+
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == '' ">
111+
<TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier>
112+
</PropertyGroup>
113+
<PropertyGroup>
114+
<SignAssembly>true</SignAssembly>
115+
</PropertyGroup>
116+
<PropertyGroup>
117+
<AssemblyOriginatorKeyFile>..\AutoMapper.snk</AssemblyOriginatorKeyFile>
118+
</PropertyGroup>
119+
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
120+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
121+
Other similar extension points exist, see Microsoft.Common.targets.
122+
<Target Name="BeforeBuild">
123+
</Target>
124+
<Target Name="AfterBuild">
125+
</Target>
126+
-->
127+
</Project>

src/AutoMapper/AutoMapper.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -33,7 +33,7 @@
3333
<IsWebBootstrapper>false</IsWebBootstrapper>
3434
<UseApplicationTrust>false</UseApplicationTrust>
3535
<BootstrapperEnabled>true</BootstrapperEnabled>
36-
<TargetFrameworkProfile>Profile136</TargetFrameworkProfile>
36+
<TargetFrameworkProfile>Profile328</TargetFrameworkProfile>
3737
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
3838
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
3939
</PropertyGroup>

src/AutoMapper/ConfigurationStore.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ private void IncludeBaseMappings(Type source, Type destination, TypeMap typeMap)
276276
m.DestinationProperty.Name == inheritedMappedProperty.DestinationProperty.Name);
277277

278278
if (conventionPropertyMap != null && inheritedMappedProperty.HasCustomValueResolver)
279-
conventionPropertyMap.AssignCustomValueResolver(inheritedMappedProperty.GetSourceValueResolvers().First());
279+
{
280+
conventionPropertyMap.AssignCustomValueResolver(inheritedMappedProperty.GetSourceValueResolvers().First());
281+
conventionPropertyMap.AssignCustomExpression(inheritedMappedProperty.CustomExpression);
282+
}
280283
else if (conventionPropertyMap == null)
281284
{
282285
var propertyMap = new PropertyMap(inheritedMappedProperty);
@@ -453,6 +456,12 @@ public void AssertConfigurationIsValid(string profileName)
453456
AssertConfigurationIsValid(_typeMaps.Where(typeMap => typeMap.Profile == profileName));
454457
}
455458

459+
public void AssertConfigurationIsValid<TProfile>()
460+
where TProfile : Profile, new()
461+
{
462+
AssertConfigurationIsValid(new TProfile().ProfileName);
463+
}
464+
456465
public void AssertConfigurationIsValid()
457466
{
458467
AssertConfigurationIsValid(_typeMaps);
@@ -466,9 +475,12 @@ public IObjectMapper[] GetMappers()
466475
private IMappingExpression<TSource, TDestination> CreateMappingExpression<TSource, TDestination>(TypeMap typeMap)
467476
{
468477
IMappingExpression<TSource, TDestination> mappingExp =
469-
new MappingExpression<TSource, TDestination>(typeMap, _serviceCtor, this);
470-
// Custom Hack
471-
var destInfo = new TypeInfo(typeof(TDestination));
478+
new MappingExpression<TSource, TDestination>(typeMap, _serviceCtor, this);
479+
480+
TypeInfo destInfo = typeMap.ConfiguredMemberList == MemberList.Destination
481+
? new TypeInfo(typeof(TDestination))
482+
: new TypeInfo(typeof(TSource));
483+
472484
foreach (var destProperty in destInfo.GetPublicWriteAccessors())
473485
{
474486
object[] attrs = destProperty.GetCustomAttributes(true);
@@ -517,7 +529,7 @@ where unmappedPropertyNames.Length > 0
517529

518530
foreach (var typeMap in _typeMaps)
519531
{
520-
DryRunTypeMap(typeMapsChecked, new ResolutionContext(typeMap, null, typeMap.SourceType, typeMap.DestinationType, new MappingOperationOptions()));
532+
DryRunTypeMap(typeMapsChecked, new ResolutionContext(typeMap, null, typeMap.SourceType, typeMap.DestinationType, new MappingOperationOptions(), Mapper.Engine));
521533
}
522534
}
523535

src/AutoMapper/ConstructorMap.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@ public object ResolveValue(ResolutionContext context, IMappingEngineRunner mappi
3737

3838
var newContext = context.CreateTypeContext(typeMap, result.Value, null, targetSourceType, destinationType);
3939

40-
var value = mappingEngine.Map(newContext);
41-
42-
ctorArgs.Add(value);
40+
if (typeMap == null && map.Parameter.IsOptional)
41+
{
42+
object value = map.Parameter.DefaultValue;
43+
ctorArgs.Add(value);
44+
}
45+
else
46+
{
47+
var value = mappingEngine.Map(newContext);
48+
ctorArgs.Add(value);
49+
}
4350
}
4451

4552
return _runtimeCtor(ctorArgs.ToArray());

0 commit comments

Comments
 (0)