Skip to content

Commit

Permalink
Supporting .NET 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Aug 5, 2015
1 parent 2cc4bf4 commit 009d3d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/AutoMapper/Internal/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static Type[] GetGenericParameters(this Type type)
{
#if NETFX_CORE || MONODROID || MONOTOUCH || __IOS__ || DNXCORE50
return type.GetGenericTypeDefinition().GetTypeInfo().GenericTypeParameters;
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetGenericTypeDefinition().GetGenericArguments();
#else
return type.GetGenericTypeDefinition().GetTypeInfo().GenericTypeParameters;
Expand All @@ -26,7 +26,7 @@ public static IEnumerable<ConstructorInfo> GetDeclaredConstructors(this Type typ
{
#if NETFX_CORE || MONODROID || MONOTOUCH || __IOS__ || DNXCORE50
return type.GetTypeInfo().DeclaredConstructors;
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
#else
return type.GetTypeInfo().DeclaredConstructors;
Expand All @@ -37,7 +37,7 @@ public static IEnumerable<MemberInfo> GetDeclaredMembers(this Type type)
{
#if NETFX_CORE || MONODROID || MONOTOUCH || __IOS__ || DNXCORE50
return type.GetTypeInfo().DeclaredMembers;
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
#else
return type.GetTypeInfo().DeclaredMembers;
Expand All @@ -48,7 +48,7 @@ public static IEnumerable<MethodInfo> GetDeclaredMethods(this Type type)
{
#if NETFX_CORE || MONODROID || MONOTOUCH || __IOS__ || DNXCORE50
return type.GetTypeInfo().DeclaredMethods;
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
#else
return type.GetTypeInfo().DeclaredMethods;
Expand All @@ -59,7 +59,7 @@ public static IEnumerable<MethodInfo> GetAllMethods(this Type type)
{
#if MONODROID || MONOTOUCH || __IOS__
return type.GetTypeInfo().GetMethods();
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
#elif DNXCORE50
return type.GetMethods();
Expand All @@ -72,7 +72,7 @@ public static IEnumerable<PropertyInfo> GetDeclaredProperties(this Type type)
{
#if NETFX_CORE || MONODROID || MONOTOUCH || __IOS__ || DNXCORE50
return type.GetTypeInfo().DeclaredProperties;
#elif SILVERLIGHT
#elif SILVERLIGHT || NET40
return type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
#else
return type.GetTypeInfo().DeclaredProperties;
Expand Down Expand Up @@ -119,7 +119,7 @@ public static Assembly Assembly(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().Assembly;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.Assembly;
#else
return type.GetTypeInfo().Assembly;
Expand All @@ -130,7 +130,7 @@ public static Type BaseType(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().BaseType;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.BaseType;
#else
return type.GetTypeInfo().BaseType;
Expand All @@ -150,7 +150,7 @@ public static bool IsAbstract(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsAbstract;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsAbstract;
#else
return type.GetTypeInfo().IsAbstract;
Expand All @@ -161,7 +161,7 @@ public static bool IsClass(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsClass;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsClass;
#else
return type.GetTypeInfo().IsClass;
Expand All @@ -172,7 +172,7 @@ public static bool IsEnum(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsEnum;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsEnum;
#else
return type.GetTypeInfo().IsEnum;
Expand All @@ -183,7 +183,7 @@ public static bool IsGenericType(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsGenericType;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsGenericType;
#else
return type.GetTypeInfo().IsGenericType;
Expand All @@ -194,7 +194,7 @@ public static bool IsGenericTypeDefinition(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsGenericTypeDefinition;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsGenericTypeDefinition;
#else
return type.GetTypeInfo().IsGenericTypeDefinition;
Expand All @@ -205,7 +205,7 @@ public static bool IsInterface(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsInterface;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsInterface;
#else
return type.GetTypeInfo().IsInterface;
Expand All @@ -216,7 +216,7 @@ public static bool IsPrimitive(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsPrimitive;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsPrimitive;
#else
return type.GetTypeInfo().IsPrimitive;
Expand All @@ -227,7 +227,7 @@ public static bool IsSealed(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsSealed;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsSealed;
#else
return type.GetTypeInfo().IsSealed;
Expand All @@ -238,15 +238,15 @@ public static bool IsValueType(this Type type)
{
#if DNXCORE50 || NETFX_CORE
return type.GetTypeInfo().IsValueType;
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__
#elif SILVERLIGHT || MONODROID || MONOTOUCH || __IOS__ || NET40
return type.IsValueType;
#else
return type.GetTypeInfo().IsValueType;
#endif
}


#if !SILVERLIGHT
#if !SILVERLIGHT && !NET40
public static bool IsInstanceOfType(this Type type, object o)
{
return o != null && type.IsAssignableFrom(o.GetType());
Expand Down
11 changes: 11 additions & 0 deletions src/AutoMapper/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
"compilationOptions": {
"define": [ "NET4" ]
}
},
"net40": {
"dependencies": {
"Microsoft.Bcl": "1.1.9"
},
"compilationOptions": {
"define": [ "NET40" ]
}
},
"net35": {

},
"sl5": {
"frameworkAssemblies": {
Expand Down

0 comments on commit 009d3d0

Please sign in to comment.