Skip to content

Commit

Permalink
Fixing UWP nuget problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Jul 7, 2016
1 parent 9929df4 commit f3e345d
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 69 deletions.
4 changes: 0 additions & 4 deletions src/AutoMapper/AssemblyInfo.cs
Expand Up @@ -2,8 +2,4 @@
using System.Security;

[assembly:CLSCompliant(true)]
#if NET45
[assembly: AllowPartiallyTrustedCallers]
//[assembly: SecurityTransparent]
//[assembly: SecurityRules(SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)]
#endif
4 changes: 3 additions & 1 deletion src/AutoMapper/Execution/IProxyGenerator.cs
@@ -1,3 +1,4 @@
#if NET45
namespace AutoMapper.Execution
{
using System;
Expand All @@ -6,4 +7,5 @@ public interface IProxyGenerator
{
Type GetProxyType(Type interfaceType);
}
}
}
#endif
6 changes: 3 additions & 3 deletions src/AutoMapper/Execution/ProxyGenerator.cs
Expand Up @@ -19,15 +19,15 @@ public class ProxyGenerator : IProxyGenerator

private static readonly byte[] privateKeyToken = StringToByteArray("be96cd2c38ef1005");

private static readonly MethodInfo delegate_Combine = typeof (Delegate).GetMethod("Combine", new[] { typeof(Delegate), typeof(Delegate) });
private static readonly MethodInfo delegate_Combine = typeof (Delegate).GetDeclaredMethod("Combine", new[] { typeof(Delegate), typeof(Delegate) });

private static readonly MethodInfo delegate_Remove = typeof (Delegate).GetMethod("Remove", new[] { typeof(Delegate), typeof(Delegate) });
private static readonly MethodInfo delegate_Remove = typeof (Delegate).GetDeclaredMethod("Remove", new[] { typeof(Delegate), typeof(Delegate) });

private static readonly EventInfo iNotifyPropertyChanged_PropertyChanged =
typeof (INotifyPropertyChanged).GetRuntimeEvent("PropertyChanged");

private static readonly ConstructorInfo proxyBase_ctor =
typeof (ProxyBase).GetConstructor(new Type[0]);
typeof (ProxyBase).GetDeclaredConstructor(new Type[0]);

private static readonly ModuleBuilder proxyModule = CreateProxyModule();

Expand Down
4 changes: 0 additions & 4 deletions src/AutoMapper/Execution/ReflectionHelper.cs
Expand Up @@ -3,9 +3,7 @@ namespace AutoMapper.Execution
using System;
using System.Collections;
using System.Collections.Generic;
#if NET45
using System.Dynamic;
#endif
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -34,7 +32,6 @@ public static object MapMember(this ResolutionContext context, MemberInfo member
return context.Mapper.Map(value, null, value?.GetType() ?? memberType, memberType, context);
}

#if NET45
public static bool IsDynamic(this object obj)
{
return obj is IDynamicMetaObjectProvider;
Expand All @@ -44,7 +41,6 @@ public static bool IsDynamic(this Type type)
{
return typeof(IDynamicMetaObjectProvider).IsAssignableFrom(type);
}
#endif

public static void SetMemberValue(this MemberInfo propertyOrField, object target, object value)
{
Expand Down
4 changes: 2 additions & 2 deletions src/AutoMapper/Execution/TypeMapPlanBuilder.cs
Expand Up @@ -249,10 +249,10 @@ public static LambdaExpression BuildMapperFunc(TypeMap typeMap, IConfigurationPr
constructorMapping = true;
return typeMap.ConstructorMap.BuildExpression(typeMapRegistry, srcParam, ctxtParam);
}
#if NET45
#if NET45
if (typeMap.DestinationTypeToUse.IsInterface())
{
var ctor = Call(Constant(ObjectCreator.DelegateFactory), typeof(DelegateFactory).GetMethod("CreateCtor", new[] { typeof(Type) }), Call(New(typeof(ProxyGenerator)), typeof(ProxyGenerator).GetMethod("GetProxyType"), Constant(typeMap.DestinationTypeToUse)));
var ctor = Call(Constant(ObjectCreator.DelegateFactory), typeof(DelegateFactory).GetDeclaredMethod("CreateCtor", new[] { typeof(Type) }), Call(New(typeof(ProxyGenerator)), typeof(ProxyGenerator).GetDeclaredMethod("GetProxyType"), Constant(typeMap.DestinationTypeToUse)));
// We're invoking a delegate here
return Invoke(ctor);
}
Expand Down
4 changes: 0 additions & 4 deletions src/AutoMapper/Mappers/DictionaryMapper.cs
Expand Up @@ -9,11 +9,7 @@ namespace AutoMapper.Mappers
public class DictionaryMapper : IObjectMapper
{
public bool IsMatch(TypePair context)
#if NET45
=> (context.SourceType.IsDictionaryType() && context.DestinationType.IsDictionaryType() && !context.SourceType.IsDynamic() && !context.DestinationType.IsDynamic());
#else
=> (context.SourceType.IsDictionaryType() && context.DestinationType.IsDictionaryType());
#endif

public Expression MapExpression(TypeMapRegistry typeMapRegistry, IConfigurationProvider configurationProvider, PropertyMap propertyMap, Expression sourceExpression, Expression destExpression, Expression contextExpression)
=> typeMapRegistry.MapCollectionExpression(configurationProvider, propertyMap, sourceExpression, destExpression, contextExpression, CollectionMapperExtensions.IfNotNull, typeof(Dictionary<,>), CollectionMapperExtensions.MapKeyPairValueExpr);
Expand Down
2 changes: 0 additions & 2 deletions src/AutoMapper/Mappers/DynamicMappers.cs
@@ -1,4 +1,3 @@
#if NET45
using System;
using System.Collections.Generic;
using System.Dynamic;
Expand Down Expand Up @@ -106,4 +105,3 @@ public Expression MapExpression(TypeMapRegistry typeMapRegistry, IConfigurationP
}
}
}
#endif
6 changes: 1 addition & 5 deletions src/AutoMapper/Mappers/MapperRegistry.cs
Expand Up @@ -15,7 +15,7 @@ public static class MapperRegistry
new PrimitiveArrayMapper(),
new ArrayMapper(),
new EnumerableToDictionaryMapper(),
#if NET45
#if NETSTANDARD1_3 || NET45
new NameValueCollectionMapper(),
#endif
new DictionaryMapper(),
Expand All @@ -25,19 +25,15 @@ public static class MapperRegistry
new EnumerableMapper(),
new StringMapper(),
new AssignableMapper(),
#if NET45
new TypeConverterMapper(),
#endif
new NullableSourceMapper(),
new ImplicitConversionOperatorMapper(),
new ExplicitConversionOperatorMapper(),
new ConvertMapper(),
new FromStringDictionaryMapper(),
new ToStringDictionaryMapper(),
#if NET45
new FromDynamicMapper(),
new ToDynamicMapper()
#endif
};

private static readonly List<IObjectMapper> _mappers = new List<IObjectMapper>(_initialMappers);
Expand Down
2 changes: 1 addition & 1 deletion src/AutoMapper/Mappers/NameValueCollectionMapper.cs
@@ -1,4 +1,4 @@
#if NET45
#if NETSTANDARD1_3 || NET45
namespace AutoMapper.Mappers
{
using System.Linq;
Expand Down
2 changes: 0 additions & 2 deletions src/AutoMapper/Mappers/TypeConverterMapper.cs
@@ -1,4 +1,3 @@
#if NET45
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -58,4 +57,3 @@ private static TypeConverter GetTypeConverter(Type type)
}
}
}
#endif
4 changes: 2 additions & 2 deletions src/AutoMapper/TypeExtensions.cs
Expand Up @@ -29,12 +29,12 @@ public static IEnumerable<ConstructorInfo> GetDeclaredConstructors(this Type typ
return type.GetTypeInfo().DeclaredConstructors;
}

#if NET45
#if NET45
public static Type CreateType(this TypeBuilder type)
{
return type.CreateTypeInfo().AsType();
}
#endif
#endif

public static IEnumerable<MemberInfo> GetDeclaredMembers(this Type type)
{
Expand Down
2 changes: 0 additions & 2 deletions src/AutoMapper/TypeMap.cs
Expand Up @@ -160,10 +160,8 @@ public bool PassesCtorValidation()
if (ConstructorMap?.CanResolve == true)
return true;

#if NET45
if (DestinationTypeToUse.IsInterface())
return true;
#endif

if (DestinationTypeToUse.IsAbstract())
return true;
Expand Down
50 changes: 13 additions & 37 deletions src/AutoMapper/project.json
@@ -1,5 +1,5 @@
{
"version": "5.0.1",
"version": "5.0.2",
"authors": [ "Jimmy Bogard" ],
"description": "A convention-based object-object mapper. AutoMapper uses a fluent configuration API to define an object-object mapping strategy. AutoMapper uses a convention-based matching algorithm to match up source to destination values. Currently, AutoMapper is designed for model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or simply an anti-corruption layer between the domain and application layer.",
"packOptions": {
Expand All @@ -9,14 +9,7 @@
"projectUrl": "http://automapper.org",
"iconUrl": "https://s3.amazonaws.com/automapper/icon.png",
"requireLicenseAcceptance": false,
"summary": "A convention-based object-object mapper",
"files": {
"mappings": {
"lib/net45/AutoMapper.pdb": "bin/Release/net45/AutoMapper.pdb",
"lib/netstandard1.1/AutoMapper.pdb": "bin/Release/netstandard1.1/AutoMapper.pdb",
"lib/netstandard1.3/AutoMapper.pdb": "bin/Release/netstandard1.3/AutoMapper.pdb"
}
}
"summary": "A convention-based object-object mapper"
},
"buildOptions": {
"keyFile": "..\\AutoMapper.snk",
Expand All @@ -34,41 +27,24 @@
"frameworks": {
"netstandard1.3": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Collections.Concurrent": "4.0.12",
"System.Diagnostics.Debug": "4.0.11",
"System.Globalization": "4.0.11",
"System.Linq": "4.1.0",
"System.Linq.Expressions": "4.1.0",
"System.ObjectModel": "4.0.12",
"System.Reflection": "4.1.0",
"System.Reflection.Extensions": "4.0.1",
"System.Runtime": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"System.Text.RegularExpressions": "4.1.0",
"System.Threading": "4.0.11",
"System.Linq.Queryable": "4.0.1"
"NETStandard.Library": "1.6.0",
"System.Linq.Queryable": "4.0.1",
"System.Collections.Specialized": "4.0.1",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Dynamic.Runtime": "4.0.11",
"Microsoft.CSharp": "4.0.1"
}
},
"netstandard1.1": {
"dependencies": {
"System.Collections": "4.0.11",
"System.Collections.Concurrent": "4.0.12",
"System.Diagnostics.Debug": "4.0.11",
"System.Globalization": "4.0.11",
"System.Linq": "4.1.0",
"System.Linq.Expressions": "4.1.0",
"NETStandard.Library": "1.6.0",
"System.Linq.Queryable": "4.0.1",
"System.ObjectModel": "4.0.12",
"System.Reflection": "4.1.0",
"System.Reflection.Extensions": "4.0.1",
"System.Runtime": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"System.Text.RegularExpressions": "4.1.0",
"System.Threading": "4.0.11"
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Dynamic.Runtime": "4.0.11",
"Microsoft.CSharp": "4.0.1"
}
},
"net45": {
}
}
}
}

0 comments on commit f3e345d

Please sign in to comment.