Removed IRegistration from Member selector
This commit is contained in:
Родитель
eb6e5ef941
Коммит
af3b4963df
|
@ -1,10 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Unity.Registration;
|
||||
using Unity.Injection;
|
||||
|
||||
namespace Unity
|
||||
{
|
||||
public delegate IEnumerable<object> MemberSelector<TMember>(Type type, IRegistration? set)
|
||||
public delegate IEnumerable<object> MemberSelector<TMember>(Type type, InjectionMember[]? members)
|
||||
where TMember : MemberInfo;
|
||||
}
|
||||
|
|
|
@ -75,12 +75,12 @@ namespace Unity
|
|||
|
||||
#region Selection
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
var members = new List<InjectionMember>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<ConstructorInfo, object[]>)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Unity
|
|||
|
||||
// Select ConstructorInfo
|
||||
var selector = GetOrDefault(builder.Registration);
|
||||
var selection = selector.Invoke(builder.Type, builder.Registration)
|
||||
var selection = selector.Invoke(builder.Type, builder.InjectionMembers)
|
||||
.FirstOrDefault();
|
||||
|
||||
// Select constructor for the Type
|
||||
|
|
|
@ -5,17 +5,16 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Unity.Exceptions;
|
||||
using Unity.Injection;
|
||||
using Unity.Registration;
|
||||
|
||||
namespace Unity
|
||||
{
|
||||
public partial class ConstructorPipeline
|
||||
{
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<ConstructorInfo, object[]>)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Reflection;
|
|||
using Unity.Builder;
|
||||
using Unity.Exceptions;
|
||||
using Unity.Injection;
|
||||
using Unity.Registration;
|
||||
using Unity.Resolution;
|
||||
|
||||
namespace Unity
|
||||
|
@ -24,12 +23,12 @@ namespace Unity
|
|||
|
||||
#region Overrides
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
HashSet<object> memberSet = new HashSet<object>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<FieldInfo, object> && memberSet.Add(injectionMember))
|
||||
yield return injectionMember;
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace Unity
|
|||
public IEnumerable<Expression> GetExpressions(Type type, IRegistration? registration)
|
||||
{
|
||||
var selector = GetOrDefault(registration);
|
||||
var members = selector(type, registration);
|
||||
var members = selector(type, registration?.InjectionMembers);
|
||||
|
||||
return ExpressionsFromSelection(type, members);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Unity
|
|||
|
||||
var pipeline = builder.Pipeline();
|
||||
var selector = GetOrDefault(builder.Registration);
|
||||
var members = selector.Invoke(builder.Type, builder.Registration);
|
||||
var members = selector.Invoke(builder.Type, builder.InjectionMembers);
|
||||
var resolvers = ResolversFromSelection(builder.Type, members).ToArray();
|
||||
|
||||
return 0 == resolvers.Length
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Unity.Injection;
|
||||
using Unity.Registration;
|
||||
|
||||
namespace Unity
|
||||
{
|
||||
public abstract partial class MemberPipeline<TMemberInfo, TData>
|
||||
{
|
||||
public virtual IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public virtual IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
HashSet<object> memberSet = new HashSet<object>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<TMemberInfo, TData> && memberSet.Add(injectionMember))
|
||||
yield return injectionMember;
|
||||
|
|
|
@ -26,12 +26,12 @@ namespace Unity
|
|||
|
||||
#region Overrides
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
HashSet<object> memberSet = new HashSet<object>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<MethodInfo, object[]> && memberSet.Add(injectionMember))
|
||||
yield return injectionMember;
|
||||
|
|
|
@ -2,19 +2,18 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Unity.Injection;
|
||||
using Unity.Registration;
|
||||
|
||||
namespace Unity
|
||||
{
|
||||
public partial class MethodPipeline
|
||||
{
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
HashSet<object> memberSet = new HashSet<object>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<MethodInfo, object[]> && memberSet.Add(injectionMember))
|
||||
yield return injectionMember;
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Reflection;
|
|||
using Unity.Builder;
|
||||
using Unity.Exceptions;
|
||||
using Unity.Injection;
|
||||
using Unity.Registration;
|
||||
using Unity.Resolution;
|
||||
|
||||
namespace Unity
|
||||
|
@ -25,12 +24,12 @@ namespace Unity
|
|||
|
||||
#region Overrides
|
||||
|
||||
public override IEnumerable<object> Select(Type type, IRegistration? registration)
|
||||
public override IEnumerable<object> Select(Type type, InjectionMember[]? injectionMembers)
|
||||
{
|
||||
HashSet<object> memberSet = new HashSet<object>();
|
||||
|
||||
// Select Injected Members
|
||||
foreach (var injectionMember in registration?.InjectionMembers ?? EmptyCollection)
|
||||
foreach (var injectionMember in injectionMembers ?? EmptyCollection)
|
||||
{
|
||||
if (injectionMember is InjectionMember<PropertyInfo, object> && memberSet.Add(injectionMember))
|
||||
yield return injectionMember;
|
||||
|
|
Загрузка…
Ссылка в новой задаче