Skip to content

Commit ea0368a

Browse files
author
Chris Santero
committed
Merge branch 'master' into 0-4-0
2 parents fc29e67 + 55ef8b6 commit ea0368a

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

JSONAPI.EntityFramework/EntityFrameworkMaterializer.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Reflection;
1010
using System.Collections;
1111
using System.Data.Entity.Core;
12+
using JSONAPI.Extensions;
1213

1314
namespace JSONAPI.EntityFramework
1415
{
@@ -170,15 +171,7 @@ private bool IsMany(Type type)
170171

171172
public bool IsModel(Type objectType)
172173
{
173-
if (objectType.IsPrimitive
174-
|| typeof(System.Guid).IsAssignableFrom(objectType)
175-
|| typeof(System.DateTime).IsAssignableFrom(objectType)
176-
|| typeof(System.DateTimeOffset).IsAssignableFrom(objectType)
177-
|| typeof(System.Guid?).IsAssignableFrom(objectType)
178-
|| typeof(System.DateTime?).IsAssignableFrom(objectType)
179-
|| typeof(System.DateTimeOffset?).IsAssignableFrom(objectType)
180-
|| typeof(String).IsAssignableFrom(objectType)
181-
)
174+
if (objectType.CanWriteAsJsonApiAttribute())
182175
return false;
183176
else return true;
184177
}

JSONAPI/Extensions/TypeExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace JSONAPI.Extensions
44
{
5-
internal static class TypeExtensions
5+
public static class TypeExtensions
66
{
7-
internal static bool CanWriteAsJsonApiAttribute(this Type objectType)
7+
public static bool CanWriteAsJsonApiAttribute(this Type objectType)
88
{
99
if (objectType.IsGenericType && objectType.GetGenericTypeDefinition() == typeof (Nullable<>))
1010
objectType = objectType.GetGenericArguments()[0];

0 commit comments

Comments
 (0)