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");
}
ConstructorInfo[] constructors = type
.GetConstructors()
ConstructorInfo[] constructors = type.GetTypeInfo()
.DeclaredConstructors
.Where(IsInjectable)
.ToArray();

View File

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

View File

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

View File

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