Skip to content

Commit

Permalink
Merge pull request MapsterMapper#3 from chaowlert/custom-primitives
Browse files Browse the repository at this point in the history
support custom primitive types
  • Loading branch information
eswann committed Feb 24, 2015
2 parents b1766f4 + 664d6a9 commit d3a8a50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Fpr/TypeAdapterGlobalSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

using System;
using System.Collections.Generic;

namespace Fpr
{
public class TypeAdapterGlobalSettings
Expand All @@ -11,5 +14,6 @@ public class TypeAdapterGlobalSettings

public bool AllowImplicitDestinationInheritance;

public readonly HashSet<Type> PrimitiveType = new HashSet<Type>();
}
}
1 change: 1 addition & 0 deletions src/Fpr/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static bool IsPrimitiveRoot(this Type type)
|| type == typeof(Guid)
|| type.IsEnum
|| (IsNullable(type) && IsPrimitiveRoot(Nullable.GetUnderlyingType(type)))
|| TypeAdapterConfig.GlobalSettings.PrimitiveType.Contains(type)
|| type == typeof(object)
;
}
Expand Down

0 comments on commit d3a8a50

Please sign in to comment.