Use new reflection API

This commit is contained in:
David Fowler 2013-12-15 06:53:05 -08:00
parent cb2e881d4b
commit 99f612e5cb
4 changed files with 9 additions and 6 deletions

View File

@ -57,8 +57,8 @@ namespace Microsoft.AspNet.CoreServices
throw new ArgumentNullException("type"); throw new ArgumentNullException("type");
} }
ConstructorInfo[] constructors = type ConstructorInfo[] constructors = type.GetTypeInfo()
.GetConstructors() .DeclaredConstructors
.Where(IsInjectable) .Where(IsInjectable)
.ToArray(); .ToArray();

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Reflection;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -41,10 +42,10 @@ namespace Microsoft.AspNet.CoreServices
private object GetMultiService(Type collectionType) private object GetMultiService(Type collectionType)
{ {
if (collectionType.IsGenericType && if (collectionType.GetTypeInfo().IsGenericType &&
collectionType.GetGenericTypeDefinition() == typeof(IEnumerable<>)) collectionType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
{ {
Type serviceType = collectionType.GetGenericArguments().Single(); Type serviceType = collectionType.GetTypeInfo().GenericTypeArguments.Single();
Type listType = typeof(List<>).MakeGenericType(serviceType); Type listType = typeof(List<>).MakeGenericType(serviceType);
var services = (IList)Activator.CreateInstance(listType); var services = (IList)Activator.CreateInstance(listType);

View File

@ -1,6 +1,7 @@
{ {
"dependencies": [], "dependencies": [],
"configurations": [ "configurations": [
{ "net45": {} } { "net45": {} },
{ "k10": {} }
] ]
} }

View File

@ -11,7 +11,8 @@
"dependencies": [ "dependencies": [
{ "System.Net.Http" : { } } { "System.Net.Http" : { } }
] ]
} },
"k10" : { }
} }
] ]
} }