Skip to content

Commit

Permalink
Merge branch 'master' into codegen
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Mapster/Mapster.csproj
  • Loading branch information
chaowlert committed Mar 11, 2019
2 parents 6a00f56 + 4d370e7 commit fa1d54f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Mapster/Mapster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<RootNamespace>Mapster</RootNamespace>
<Version Condition=" '$(OS)' != 'Windows_NT' ">0</Version>
<Version Condition=" '$(OS)' == 'Windows_NT' ">3.3.1</Version>
<AssemblyVersion Condition=" '$(OS)' == 'Windows_NT' ">3.3.1.0</AssemblyVersion>
<Version Condition=" '$(OS)' == 'Windows_NT' ">3.3.2</Version>
<AssemblyVersion Condition=" '$(OS)' == 'Windows_NT' ">3.3.2.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<Reference Include="Microsoft.CSharp" />
Expand Down
6 changes: 2 additions & 4 deletions src/Mapster/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,9 @@ public static bool IsPrimitiveKind(this Type type)

public static Expression CreateDefault(this Type type)
{
return type.GetTypeInfo().IsPrimitive
? Expression.Constant(Activator.CreateInstance(type), type)
: type.CanBeNull()
return type.CanBeNull()
? Expression.Constant(null, type)
: (Expression)Expression.Default(type);
: Expression.Constant(Activator.CreateInstance(type), type);
}

/// <summary>
Expand Down

0 comments on commit fa1d54f

Please sign in to comment.