Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
667a3d5
use Enum.Parse<TEnum>
lbargaoanu Jul 30, 2022
77086e8
less allocations
lbargaoanu Jul 31, 2022
e3aecd3
reuse the execution plan between user Map calls and internal Map calls
lbargaoanu Aug 1, 2022
6581906
remove IObjectMapperInfo
lbargaoanu Aug 2, 2022
5f0cebd
use the more efficient Expression.Invoke instead of ConvertReplacePar…
lbargaoanu Aug 3, 2022
9fc7cdf
less allocations
lbargaoanu Aug 3, 2022
7fdf915
less null checks
lbargaoanu Aug 4, 2022
4b507ee
unreachable, As maps are sealed by default
lbargaoanu Aug 6, 2022
84e3fff
less allocations
lbargaoanu Aug 6, 2022
b5cc0a6
don't try to match ignored members
lbargaoanu Aug 7, 2022
df48e72
more efficient
lbargaoanu Aug 7, 2022
12eaef9
drop RegEx
lbargaoanu Aug 8, 2022
06b0713
docs
lbargaoanu Aug 8, 2022
dc7e58f
cosmetic
lbargaoanu Aug 8, 2022
9356388
less allocations
lbargaoanu Aug 8, 2022
39fccd9
cosmetic
lbargaoanu Aug 9, 2022
a3ae964
less allocations
lbargaoanu Aug 9, 2022
00d29ee
we don't need to create As type maps
lbargaoanu Aug 11, 2022
c9bceef
remove ITypeMapConfiguration
lbargaoanu Aug 11, 2022
a0988d7
cosmetic
lbargaoanu Aug 11, 2022
0b9cf8c
try to show a better error message when mapping records through const…
lbargaoanu Aug 11, 2022
b9699dd
less allocations
lbargaoanu Aug 13, 2022
ed9097f
special case the defaults for naming conventions
lbargaoanu Aug 13, 2022
93576ef
make TypeMapPlanBuilder a struct
lbargaoanu Aug 15, 2022
3adb02f
use readonly record struct
lbargaoanu Aug 15, 2022
7720ac8
assume that a protected constructor with CompilerGeneratedAttribute m…
lbargaoanu Aug 15, 2022
4e1117f
less allocations
lbargaoanu Aug 15, 2022
dac3062
rename configurationProvider to the shorter configuration in most places
lbargaoanu Aug 17, 2022
b24560f
less allocations
lbargaoanu Aug 17, 2022
953d66d
converters with no source should throw
lbargaoanu Aug 17, 2022
ebd2c43
less allocations
lbargaoanu Aug 18, 2022
c5d7c36
cosmetic
lbargaoanu Aug 18, 2022
12676dd
less allocations
lbargaoanu Aug 19, 2022
85ff705
make MapFrom name more like the built-in mapping
lbargaoanu Aug 19, 2022
c71f168
less allocations
lbargaoanu Aug 20, 2022
3de255f
cosmetic
lbargaoanu Aug 21, 2022
6925737
use profiles in the benchmark
lbargaoanu Aug 21, 2022
08ec72a
simplify conventions
lbargaoanu Aug 21, 2022
e9287a2
merge the profile member configuration with the global one
lbargaoanu Aug 21, 2022
0d2aa50
cosmetic
lbargaoanu Aug 22, 2022
ec0a832
test reusing the execution plan
lbargaoanu Aug 22, 2022
593ad53
refactor test base classes
lbargaoanu Aug 22, 2022
806e73f
cosmetic
lbargaoanu Aug 23, 2022
d0e0e24
avoid changing the resolver configuration objects because they're reu…
lbargaoanu Aug 31, 2022
77e0015
cosmetic
lbargaoanu Aug 31, 2022
20c283a
less allocations
lbargaoanu Sep 3, 2022
66f0020
cosmetic
lbargaoanu Sep 3, 2022
f1655e1
file scoped namespaces
lbargaoanu Sep 3, 2022
288c4ad
global usings
lbargaoanu Sep 3, 2022
e6f2ca3
cosmetic
lbargaoanu Sep 4, 2022
daacd80
less allocations
lbargaoanu Sep 10, 2022
c608787
NullMappingOrderComesFirst
lbargaoanu Sep 10, 2022
434703c
less allocations
lbargaoanu Sep 10, 2022
4ba0e5f
we could include a different constructor
lbargaoanu Sep 10, 2022
b98273e
less allocations
lbargaoanu Sep 10, 2022
7eeaf59
cosmetic
lbargaoanu Sep 11, 2022
efd1df9
allocate _runtimeTypeDetails lazily
lbargaoanu Sep 12, 2022
3a491a3
create the projection builder lazily
lbargaoanu Sep 12, 2022
7da36f6
cosmetic
lbargaoanu Sep 12, 2022
970ab2d
an adhoc fix for including open generic config
lbargaoanu Sep 14, 2022
e7ba023
cosmetic
lbargaoanu Sep 18, 2022
2b99e96
MapFrom should override ignore
lbargaoanu Sep 18, 2022
3f8448a
UseDestinationValueNullable
lbargaoanu Sep 19, 2022
8b83aa7
cosmetic
lbargaoanu Sep 21, 2022
5e0066e
avoid LINQ
lbargaoanu Sep 23, 2022
7d65b78
the destination type name is already in the error message
lbargaoanu Sep 24, 2022
3c2d8cd
cosmetic
lbargaoanu Sep 24, 2022
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
  •  
  •  
  •  
Prev Previous commit
Next Next commit
global usings
  • Loading branch information
lbargaoanu committed Sep 4, 2022
commit 288c4adbbe71e3b83038a1d49bd056efe91f6fd2
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ dotnet_style_prefer_auto_properties = true:silent
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
Expand All @@ -80,6 +79,7 @@ csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
dotnet_style_object_initializer = true:suggestion
csharp_style_namespace_declarations = file_scoped:suggestion
dotnet_style_namespace_match_folder = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
Expand Down
9 changes: 9 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<NoWarn>$(NoWarn);CS1701;CS1702;CS1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Features>strict</Features>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<Using Include="System.Reflection"/>
<Using Include="System.Diagnostics"/>
<Using Include="System.ComponentModel"/>
<Using Include="System.Linq.Expressions"/>
<Using Include="AutoMapper.QueryableExtensions" />
<Using Include="AutoMapper.Internal" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions src/AutoMapper/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Resources;
using System.Resources;
using System.Runtime.InteropServices;

[assembly: CLSCompliant(true)]
Expand Down
9 changes: 7 additions & 2 deletions src/AutoMapper/AutoMapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(ProjectDir)ApiCompat\PreBuild.ps1&quot; -version $(Version)" />
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command="&quot;$(ProjectDir)ApiCompat/PreBuild.sh&quot; $(Version)" />
</Target>

</Project>
<ItemGroup>
<Using Include="System.Linq.Expressions.Expression" Static="true" />
<Using Include="AutoMapper.Execution.ExpressionBuilder" Static="true" />
<Using Include="AutoMapper.Execution" />
<Using Include="AutoMapper.Configuration" />
</ItemGroup>
</Project>
3 changes: 0 additions & 3 deletions src/AutoMapper/AutoMapperMappingException.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Text;
using System.Linq;
using AutoMapper.Internal;

namespace AutoMapper;

Expand Down
4 changes: 1 addition & 3 deletions src/AutoMapper/Configuration/Annotations/AutoMapAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper;
namespace AutoMapper;

/// <summary>
/// Auto map to this destination type from the specified source type.
Expand Down
4 changes: 1 addition & 3 deletions src/AutoMapper/Configuration/Annotations/IgnoreAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Ignore this member for configuration validation and skip during mapping.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Do not precompute the execution plan for this member, just map it at runtime.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Supply a custom mapping order instead of what the .NET runtime returns
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Substitute a custom value when the source member resolves as null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using AutoMapper.Internal;
using System;
using System.Reflection;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Specify the source member to map from. Can only reference a member on the <see cref="AutoMapAttribute.SourceType" /> type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Use the destination value instead of mapping from the source value or creating a new instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Reflection;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Specify a value converter type to convert from the matching source member to the destination member
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Reflection;

namespace AutoMapper.Configuration.Annotations;
namespace AutoMapper.Configuration.Annotations;

/// <summary>
/// Map destination member using a custom value resolver.
Expand Down
5 changes: 0 additions & 5 deletions src/AutoMapper/Configuration/ConfigurationValidator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using AutoMapper.Internal;
using AutoMapper.Internal.Mappers;
namespace AutoMapper.Configuration;

Expand Down
6 changes: 0 additions & 6 deletions src/AutoMapper/Configuration/Conventions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace AutoMapper.Configuration.Conventions;

public interface ISourceToDestinationNameMapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using AutoMapper.Execution;
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
namespace AutoMapper.Configuration;

public interface ICtorParamConfigurationExpression
Expand Down
5 changes: 0 additions & 5 deletions src/AutoMapper/Configuration/IMappingExpression.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using AutoMapper.Configuration;
using System;
using System.Linq.Expressions;

namespace AutoMapper;

/// <summary>
/// Mapping configuration options for non-generic maps
/// </summary>
Expand Down
4 changes: 0 additions & 4 deletions src/AutoMapper/Configuration/IMappingExpressionBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using AutoMapper.Configuration;
using AutoMapper.Features;

namespace AutoMapper;
Expand Down
5 changes: 1 addition & 4 deletions src/AutoMapper/Configuration/IMappingOperationOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;

namespace AutoMapper;
namespace AutoMapper;

using StringDictionary = Dictionary<string, object>;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Linq.Expressions;
using System.Reflection;

namespace AutoMapper;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/AutoMapper/Configuration/INamingConvention.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
namespace AutoMapper;

/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions src/AutoMapper/Configuration/IProfileExpression.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Reflection;
namespace AutoMapper;

/// <summary>
Expand Down
10 changes: 0 additions & 10 deletions src/AutoMapper/Configuration/MapperConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace AutoMapper;
using Configuration;
using Execution;
using Features;
using Internal;
using Internal.Mappers;
using QueryableExtensions.Impl;
using static Expression;
using static Execution.ExpressionBuilder;
public interface IConfigurationProvider
{
/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions src/AutoMapper/Configuration/MapperConfigurationExpression.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AutoMapper.Configuration;
using AutoMapper.Features;
using AutoMapper.Internal;
using AutoMapper.Internal.Mappers;
using AutoMapper.QueryableExtensions.Impl;
namespace AutoMapper;
Expand Down
7 changes: 0 additions & 7 deletions src/AutoMapper/Configuration/MappingExpression.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using AutoMapper.Internal;
namespace AutoMapper.Configuration;

using Execution;
public class MappingExpression : MappingExpressionBase<object, object, IMappingExpression>, IMappingExpression
{
public MappingExpression(TypePair types, MemberList memberList) : base(memberList, types){}
Expand Down
9 changes: 0 additions & 9 deletions src/AutoMapper/Configuration/MemberConfigurationExpression.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace AutoMapper.Configuration;

using Execution;
using static AutoMapper.Execution.ExpressionBuilder;
public interface IPropertyMapConfiguration
{
void Configure(TypeMap typeMap);
Expand Down
9 changes: 1 addition & 8 deletions src/AutoMapper/Configuration/PathConfigurationExpression.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using AutoMapper.Internal;
namespace AutoMapper.Configuration;

using Execution;
namespace AutoMapper.Configuration;
/// <summary>
/// Member configuration options
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions src/AutoMapper/Configuration/Profile.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using AutoMapper.Configuration;
using AutoMapper.Configuration.Conventions;
using AutoMapper.Internal;
namespace AutoMapper;

using static Execution.ExpressionBuilder;
public interface IProfileConfiguration
{
bool? FieldMappingEnabled { get; }
Expand Down
4 changes: 0 additions & 4 deletions src/AutoMapper/Configuration/SourceMappingExpression.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Reflection;

namespace AutoMapper.Configuration;

public interface ISourceMemberConfiguration
Expand Down
12 changes: 1 addition & 11 deletions src/AutoMapper/Configuration/TypeMapConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using AutoMapper.Features;
using AutoMapper.Internal;
namespace AutoMapper.Configuration;

using static Expression;
using Execution;
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class TypeMapConfiguration
{
Expand Down Expand Up @@ -346,7 +336,7 @@ public void ConvertUsing(Type typeConverterType)
}
public void ConvertUsing(Func<TSource, TDestination, TDestination> mappingFunction) => ConvertUsingCore((src, dest, ctxt) => mappingFunction(src, dest));
private void ConvertUsingCore(Expression<Func<TSource, TDestination, ResolutionContext, TDestination>> expr) => SetTypeConverter(new LambdaTypeConverter(expr));
private void SetTypeConverter(TypeConverter typeConverter)
private void SetTypeConverter(Execution.TypeConverter typeConverter)
{
HasTypeConverter = true;
TypeMapActions.Add(tm => tm.TypeConverter = typeConverter);
Expand Down
11 changes: 1 addition & 10 deletions src/AutoMapper/ConstructorMap.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace AutoMapper;

using Execution;
namespace AutoMapper;
[EditorBrowsable(EditorBrowsableState.Never)]
public class ConstructorMap
{
Expand Down
9 changes: 0 additions & 9 deletions src/AutoMapper/Execution/ExpressionBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Collections.ObjectModel;
namespace AutoMapper.Execution;

using Internal;
using static Expression;
using static Internal.ReflectionHelper;
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ExpressionBuilder
Expand Down
9 changes: 0 additions & 9 deletions src/AutoMapper/Execution/ObjectFactory.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using AutoMapper.Internal;
namespace AutoMapper.Execution;

using static Expression;
using static ExpressionBuilder;
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ObjectFactory
{
Expand Down
7 changes: 0 additions & 7 deletions src/AutoMapper/Execution/ProxyGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
using AutoMapper.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;

namespace AutoMapper.Execution;
Expand Down
Loading