code sweep

This commit is contained in:
Daniel Clark
2022-12-10 16:11:07 +00:00
parent 4f243eba2e
commit 0da4a37173
84 changed files with 2040 additions and 2104 deletions
@@ -1,25 +1,24 @@
using System.Reflection;
namespace Toolkit.Foundation
namespace Toolkit.Framework.Foundation;
internal class ServiceFactoryDescriptor
{
internal class ServiceFactoryDescriptor
private readonly IServiceFactory serviceFactory;
public ServiceFactoryDescriptor(IServiceFactory serviceFactory)
{
private readonly IServiceFactory serviceFactory;
public ServiceFactoryDescriptor(IServiceFactory serviceFactory)
{
this.serviceFactory = serviceFactory;
}
public object? Create(Type type)
{
MethodInfo? methodInfo = typeof(ServiceFactoryDescriptor).GetMethod(nameof(Create), BindingFlags.NonPublic | BindingFlags.Instance);
return methodInfo?.MakeGenericMethod(type).Invoke(this, new object[] { type });
}
private T Create<T>(Type type)
{
return serviceFactory.Create<T>(type);
}
this.serviceFactory = serviceFactory;
}
}
public object? Create(Type type)
{
MethodInfo? methodInfo = typeof(ServiceFactoryDescriptor).GetMethod(nameof(Create), BindingFlags.NonPublic | BindingFlags.Instance);
return methodInfo?.MakeGenericMethod(type).Invoke(this, new object[] { type });
}
private T? Create<T>(Type type)
{
return serviceFactory.Create<T>(type);
}
}