Get rid of IContainer.GetRegistered

This commit is contained in:
Stephan
2018-11-27 15:20:26 +01:00
parent de8dbe0041
commit 80f3fc6864
5 changed files with 1 additions and 52 deletions

View File

@@ -33,14 +33,6 @@ namespace Umbraco.Core.Composing
public static T TryGetInstance<T>(this IContainer container)
=> (T) container.TryGetInstance(typeof(T));
/// <summary>
/// Gets registrations for a service.
/// </summary>
/// <typeparam name="TService">The type of the service.</typeparam>
/// <returns>The registrations for the service.</returns>
public static IEnumerable<Registration> GetRegistered<TService>(this IContainer container)
=> container.GetRegistered(typeof(TService));
/// <summary>
/// Creates an instance with arguments.
/// </summary>

View File

@@ -61,13 +61,6 @@ namespace Umbraco.Core.Composing
/// <typeparam name="TService">The type of the service.</typeparam>
IEnumerable<TService> GetAllInstances<TService>();
/// <summary>
/// Gets registrations for a service.
/// </summary>
/// <param name="serviceType">The type of the service.</param>
/// <returns>The registrations for the service.</returns>
IEnumerable<Registration> GetRegistered(Type serviceType);
/// <summary>
/// Releases an instance.
/// </summary>
@@ -76,7 +69,7 @@ namespace Umbraco.Core.Composing
/// See https://stackoverflow.com/questions/14072208 and http://kozmic.net/2010/08/27/must-i-release-everything-when-using-windsor/,
/// you only need to release instances you specifically resolved, and even then, if done right, that might never be needed. For
/// instance, LightInject does not require this and does not support it - should work with scopes.
/// </remarks>
/// </remarks>
void Release(object instance);
#endregion

View File

@@ -117,10 +117,6 @@ namespace Umbraco.Core.Composing.LightInject
public IEnumerable<object> GetAllInstances(Type type)
=> Container.GetAllInstances(type);
/// <inheritdoc />
public IEnumerable<Registration> GetRegistered(Type type)
=> Container.AvailableServices.Where(x => x.ServiceType == type).Select(x => new Registration(x.ServiceType, x.ServiceName));
/// <inheritdoc />
public void Release(object instance)
{

View File

@@ -1,31 +0,0 @@
using System;
namespace Umbraco.Core.Composing
{
/// <summary>
/// Represents a service registration in the container.
/// </summary>
public class Registration
{
/// <summary>
/// Initializes a new instance of the <see cref="Registration"/> class.
/// </summary>
/// <param name="serviceType"></param>
/// <param name="serviceName"></param>
public Registration(Type serviceType, string serviceName)
{
ServiceType = serviceType;
ServiceName = serviceName;
}
/// <summary>
/// Gets the service type.
/// </summary>
public Type ServiceType { get; }
/// <summary>
/// Gets the service name.
/// </summary>
public string ServiceName { get; }
}
}

View File

@@ -190,7 +190,6 @@
<Compile Include="Composing\LightInject\LightInjectContainer.cs" />
<Compile Include="Composing\LightInject\MixedLightInjectScopeManagerProvider.cs" />
<Compile Include="Composing\OrderedCollectionBuilderBase.cs" />
<Compile Include="Composing\Registration.cs" />
<Compile Include="Composing\TypeFinder.cs" />
<Compile Include="Composing\TypeHelper.cs" />
<Compile Include="Composing\TypeLoader.cs" />