Use new reflection API
This commit is contained in:
parent
cb2e881d4b
commit
99f612e5cb
|
|
@ -57,8 +57,8 @@ namespace Microsoft.AspNet.CoreServices
|
|||
throw new ArgumentNullException("type");
|
||||
}
|
||||
|
||||
ConstructorInfo[] constructors = type
|
||||
.GetConstructors()
|
||||
ConstructorInfo[] constructors = type.GetTypeInfo()
|
||||
.DeclaredConstructors
|
||||
.Where(IsInjectable)
|
||||
.ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"dependencies": [],
|
||||
"configurations": [
|
||||
{ "net45": {} }
|
||||
{ "net45": {} },
|
||||
{ "k10": {} }
|
||||
]
|
||||
}
|
||||
|
|
@ -11,7 +11,8 @@
|
|||
"dependencies": [
|
||||
{ "System.Net.Http" : { } }
|
||||
]
|
||||
}
|
||||
},
|
||||
"k10" : { }
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue