Added new Package configuration

This commit is contained in:
Eugene Sadovoi 2017-10-16 12:42:06 -04:00
Родитель aa377d1a6c
Коммит 215ddf8290
5 изменённых файлов: 265 добавлений и 25 удалений

1
src/Properties/Resources.Designer.cs сгенерированный
Просмотреть файл

@ -10,7 +10,6 @@
namespace Unity.Interception.Properties {
using System;
using System.Reflection;
/// <summary>

Просмотреть файл

@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net47</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Unity Interception</Description>
<Version>5.0.0-beta</Version>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
@ -17,28 +15,9 @@
<PackageId>Unity.Interception</PackageId>
<Authors>Microsoft.Practices.Unity</Authors>
<Company>Microsoft.Practices.Unity</Company>
<Configurations>Debug;Release;Package</Configurations>
</PropertyGroup>
<PropertyGroup Condition="Exists('..\..\package.snk')">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\package.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'net40' ">
<Compile Remove="Utilities\net 4.0\**" />
<EmbeddedResource Remove="Utilities\net 4.0\**" />
<None Remove="Utilities\net 4.0\**" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Container\src\Unity.Container.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
@ -54,5 +33,43 @@
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>package.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'net40' ">
<Compile Remove="Utilities\net 4.0\**" />
<EmbeddedResource Remove="Utilities\net 4.0\**" />
<None Remove="Utilities\net 4.0\**" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>net47;net45;net40</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Package'">
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TargetFrameworks>net47;net45;net40</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TargetFramework>net47</TargetFramework>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)'!='Release'">
<ProjectReference Include="..\..\Abstractions\src\Unity.Abstractions.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
<PackageReference Include="Unity.Abstractions" Version="2.0.0-RC3" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,224 @@
using System.Collections.Generic;
using System.Threading;
namespace System.Reflection
{
#if NET40
internal class TypeInfo
{
private const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
private Type _type;
internal TypeInfo(Type type)
{
_type = type ?? throw new ArgumentNullException(nameof(type));
}
public Assembly Assembly => _type.Assembly;
public bool IsGenericTypeDefinition => _type.IsGenericTypeDefinition;
public Type[] GenericTypeArguments => _type.GetGenericArguments();
public Type[] GenericTypeParameters => _type.IsGenericTypeDefinition ? _type.GetGenericArguments()
: Type.EmptyTypes;
public string Name => _type.Name;
public Type BaseType => _type.BaseType;
public bool IsGenericType => _type.IsGenericType;
public Type AsType() => _type;
public bool IsAssignableFrom(TypeInfo typeInfo) => _type.IsAssignableFrom(typeInfo.AsType());
public bool IsGenericParameter => _type.IsGenericParameter;
public bool IsInterface => _type.IsInterface;
public bool IsAbstract => _type.IsAbstract;
public bool IsSubclassOf(Type type) => _type.IsSubclassOf(type);
public bool IsValueType => _type.IsValueType;
public bool ContainsGenericParameters => _type.ContainsGenericParameters;
#region moved over from Type
//// Fields
public virtual EventInfo GetDeclaredEvent(String name)
{
return _type.GetEvent(name, DeclaredOnlyLookup);
}
public virtual FieldInfo GetDeclaredField(String name)
{
return _type.GetField(name, DeclaredOnlyLookup);
}
public virtual MethodInfo GetDeclaredMethod(String name)
{
return _type.GetMethod(name, DeclaredOnlyLookup);
}
public virtual IEnumerable<MethodInfo> GetDeclaredMethods(String name)
{
foreach (MethodInfo method in _type.GetMethods(DeclaredOnlyLookup))
{
if (method.Name == name)
yield return method;
}
}
public virtual System.Reflection.TypeInfo GetDeclaredNestedType(String name)
{
var nt = _type.GetNestedType(name, DeclaredOnlyLookup);
if (nt == null)
{
return null; //the extension method GetTypeInfo throws for null
}
else
{
return nt.GetTypeInfo();
}
}
public virtual PropertyInfo GetDeclaredProperty(String name)
{
return _type.GetProperty(name, DeclaredOnlyLookup);
}
//// Properties
public virtual IEnumerable<ConstructorInfo> DeclaredConstructors
{
get
{
return _type.GetConstructors(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<EventInfo> DeclaredEvents
{
get
{
return _type.GetEvents(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<FieldInfo> DeclaredFields
{
get
{
return _type.GetFields(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<MemberInfo> DeclaredMembers
{
get
{
return _type.GetMembers(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<MethodInfo> DeclaredMethods
{
get
{
return _type.GetMethods(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes
{
get
{
foreach (var t in _type.GetNestedTypes(DeclaredOnlyLookup))
{
yield return t.GetTypeInfo();
}
}
}
public virtual IEnumerable<PropertyInfo> DeclaredProperties
{
get
{
return _type.GetProperties(DeclaredOnlyLookup);
}
}
public virtual IEnumerable<Type> ImplementedInterfaces
{
get
{
return _type.GetInterfaces();
}
}
#endregion
public override int GetHashCode()
{
return _type.GetHashCode();
}
public override bool Equals(object obj)
{
return _type.Equals(obj);
}
public static bool operator ==(TypeInfo left, TypeInfo right)
{
return left?.GetHashCode() == right?.GetHashCode();
}
public static bool operator !=(TypeInfo left, TypeInfo right)
{
return left?.GetHashCode() != right?.GetHashCode();
}
}
#endif
internal static class IntrospectionExtensions
{
#if NET40
public static TypeInfo GetTypeInfo(this Type type)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
return new TypeInfo(type);
}
public static Delegate CreateDelegate(this MethodInfo method, Type delegateType)
{
return Delegate.CreateDelegate(delegateType, method);
}
public static Delegate CreateDelegate(this MethodInfo method, Type delegateType, object target)
{
return Delegate.CreateDelegate(delegateType, target, method);
}
#else
public static MethodInfo GetGetMethod(this PropertyInfo info, bool _)
{
return info.GetMethod;
}
public static MethodInfo GetSetMethod(this PropertyInfo info, bool _)
{
return info.SetMethod;
}
#endif
}
}

Просмотреть файл

@ -66,7 +66,7 @@ namespace Microsoft.Practices.Unity.Utility
{
var property = GetPropertyInfo<T, TProperty>(expression);
var getMethod = property.GetMethod;
var getMethod = property.GetGetMethod(true);
if (getMethod == null)
{
throw new InvalidOperationException("Invalid expression form passed");
@ -91,7 +91,7 @@ namespace Microsoft.Practices.Unity.Utility
{
var property = GetPropertyInfo<T, TProperty>(expression);
var setMethod = property.SetMethod;
var setMethod = property.GetSetMethod(true);
if (setMethod == null)
{
throw new InvalidOperationException("Invalid expression form passed");

Двоичные данные
src/package.snk Normal file

Двоичный файл не отображается.