Skip to content

Commit

Permalink
run analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
chaowlert committed Apr 9, 2020
1 parent ee77747 commit 5db1368
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Mapster/Adapters/BaseClassAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected Expression CreateInstantiationExpression(Expression source, ClassMappi
arguments.Add(getter);
}

return Expression.New(classConverter.ConstructorInfo, arguments);
return Expression.New(classConverter.ConstructorInfo!, arguments);
}

protected virtual ClassModel GetConstructorModel(ConstructorInfo ctor, bool breakOnUnmatched)
Expand Down
6 changes: 1 addition & 5 deletions src/Mapster/Adapters/ObjectType.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Mapster.Adapters
namespace Mapster.Adapters
{
public enum ObjectType
{
Expand Down
1 change: 1 addition & 0 deletions src/Mapster/Interfaces/IMapper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Mapster;

// ReSharper disable once CheckNamespace
namespace MapsterMapper
{
public interface IMapper
Expand Down
1 change: 1 addition & 0 deletions src/Mapster/Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using Mapster;

// ReSharper disable once CheckNamespace
namespace MapsterMapper
{
public class Mapper : IMapper
Expand Down
1 change: 1 addition & 0 deletions src/Mapster/Mapster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Version>5.2.0</Version>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>1701;1702;8618</NoWarn>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="Microsoft.CSharp" />
Expand Down
2 changes: 1 addition & 1 deletion src/Mapster/Models/ClassMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Mapster.Models
{
internal class ClassMapping
{
public ConstructorInfo ConstructorInfo { get; set; }
public ConstructorInfo? ConstructorInfo { get; set; }
public List<MemberMapping> Members { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Mapster/Models/ClassModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Mapster.Models
internal class ClassModel
{
public bool BreakOnUnmatched { get; set; }
public ConstructorInfo ConstructorInfo { get; set; }
public ConstructorInfo? ConstructorInfo { get; set; }
public IEnumerable<IMemberModelEx> Members { get; set; }
}
}
8 changes: 4 additions & 4 deletions src/Mapster/TypeAdapterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public TypeAdapterBuilder<TSource> AddParameters(string name, object value)
return this;
}

private MapContextScope createMapContextScope()
private MapContextScope CreateMapContextScope()
{
var scope = new MapContextScope();
var parameters = scope.Context.Parameters;
Expand All @@ -56,14 +56,14 @@ private MapContextScope createMapContextScope()
return scope;
}

MapContextScope IAdapterBuilder.CreateMapContextScope() => createMapContextScope();
MapContextScope IAdapterBuilder.CreateMapContextScope() => CreateMapContextScope();

public TDestination AdaptToType<TDestination>()
{
if (_parameters == null)
return Map<TDestination>();

using (this.createMapContextScope())
using (this.CreateMapContextScope())
{
return Map<TDestination>();
}
Expand All @@ -80,7 +80,7 @@ public TDestination AdaptTo<TDestination>(TDestination destination)
if (_parameters == null)
return MapToTarget(destination);

using (this.createMapContextScope())
using (this.CreateMapContextScope())
{
return MapToTarget(destination);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Mapster/TypeAdapterConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ internal MethodCallExpression GetProjectionCallExpression(Type sourceType, Type
return del;
}

private Dictionary<TypeTuple, Delegate> _dynamicMapDict;
private Dictionary<TypeTuple, Delegate>? _dynamicMapDict;
internal Func<object, TDestination> GetDynamicMapFunction<TDestination>(Type sourceType)
{
if (_dynamicMapDict == null)
Expand Down Expand Up @@ -593,7 +593,7 @@ private void Remove(TypeTuple key)
_dynamicMapDict?.Remove(key);
}

private static TypeAdapterConfig _cloneConfig;
private static TypeAdapterConfig? _cloneConfig;
public TypeAdapterConfig Clone()
{
if (_cloneConfig == null)
Expand All @@ -607,7 +607,7 @@ public TypeAdapterConfig Clone()
return fn(this);
}

private Dictionary<string, TypeAdapterConfig> _inlineConfigs;
private Dictionary<string, TypeAdapterConfig>? _inlineConfigs;
public TypeAdapterConfig Fork(Action<TypeAdapterConfig> action,
#if !NET40
[CallerFilePath]
Expand Down
2 changes: 1 addition & 1 deletion src/Mapster/Utils/DynamicTypeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private static void CreateProperty(Type interfaceType, TypeBuilder builder, Prop
{
// Define the "set" accessor method for property.
string setMethodName = "set_" + prop.Name;
MethodBuilder propSet = builder.DefineMethod(setMethodName, classPropMethodAttrs, null, new Type[] { prop.PropertyType });
MethodBuilder propSet = builder.DefineMethod(setMethodName, classPropMethodAttrs, null, new[] { prop.PropertyType });
ILGenerator propSetIL = propSet.GetILGenerator();
propSetIL.Emit(OpCodes.Ldarg_0);
propSetIL.Emit(OpCodes.Ldarg_1);
Expand Down

0 comments on commit 5db1368

Please sign in to comment.