Cleanup
This commit is contained in:
Родитель
5f59242dab
Коммит
756f71d0d0
|
@ -20,7 +20,6 @@ namespace Unity.Registration
|
|||
#region Fields
|
||||
|
||||
private int _refCount;
|
||||
private ResolveDelegate<BuilderContext>? _pipeline;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -132,8 +131,6 @@ namespace Unity.Registration
|
|||
|
||||
public bool BuildRequired => _registration.BuildRequired;
|
||||
|
||||
public Converter<Type, Type?>? Map => _registration.BuildType;
|
||||
|
||||
public LifetimeManager? LifetimeManager => null;
|
||||
|
||||
public int RefCount => _registration._refCount;
|
||||
|
|
|
@ -141,14 +141,14 @@ namespace Unity
|
|||
throw new ArgumentException($"The type {typeTo} cannot be assigned to variables of type {typeFrom}.");
|
||||
|
||||
#if NETSTANDARD1_0 || NETCOREAPP1_0
|
||||
if (null == typeFrom && null != typeTo && infoTo.IsInterface)
|
||||
if (null == typeFrom && null != infoTo && infoTo.IsInterface)
|
||||
#else
|
||||
if (null == typeFrom && null != typeTo && typeTo.IsInterface)
|
||||
#endif
|
||||
throw new ArgumentException($"The type {typeTo} is an interface and can not be constructed.");
|
||||
|
||||
#if NETSTANDARD1_0 || NETCOREAPP1_0
|
||||
if (null != typeFrom && null != typeTo && infoFrom.IsGenericType && infoTo.IsArray && infoFrom.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|
||||
if (null != infoFrom && null != infoTo && infoFrom.IsGenericType && infoTo.IsArray && infoFrom.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|
||||
#else
|
||||
if (null != typeFrom && null != typeTo && typeFrom.IsGenericType && typeTo.IsArray && typeFrom.GetGenericTypeDefinition() == typeof(IEnumerable<>))
|
||||
#endif
|
||||
|
|
|
@ -111,7 +111,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +131,9 @@ namespace Unity
|
|||
yield break;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +175,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +201,9 @@ namespace Unity
|
|||
catch (MakeGenericTypeFailedException) { continue; }
|
||||
catch (InvalidRegistrationException) { continue; }
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +222,9 @@ namespace Unity
|
|||
yield break;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,7 +299,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +347,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +374,9 @@ namespace Unity
|
|||
catch (MakeGenericTypeFailedException) { continue; }
|
||||
catch (InvalidRegistrationException) { continue; }
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +422,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +471,9 @@ namespace Unity
|
|||
continue;
|
||||
}
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,12 +493,16 @@ namespace Unity
|
|||
{
|
||||
var itemKey = new HashKey(typeof(TElement), registration.Name);
|
||||
var item = container.GetOrAdd(ref itemKey, typeof(TElement), registration.Name);
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
value = (TElement)resolve(typeof(TElement), item);
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
catch (MakeGenericTypeFailedException) { continue; }
|
||||
catch (InvalidRegistrationException) { continue; }
|
||||
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
yield return (TElement)value;
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,9 @@ namespace Unity
|
|||
public static TConfigurator Configure<TConfigurator>(this IUnityContainer container)
|
||||
where TConfigurator : IUnityContainerExtensionConfigurator
|
||||
{
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
return (TConfigurator)(container ?? throw new ArgumentNullException(nameof(container))).Configure(typeof(TConfigurator));
|
||||
#pragma warning restore CS8601 // Possible null reference assignment.
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Загрузка…
Ссылка в новой задаче