Add some initial navigation route handlers
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
{
|
||||
public interface IServiceFactory
|
||||
{
|
||||
T? Get<T>(Type type);
|
||||
object? Create(Type type, params object?[] parameters);
|
||||
|
||||
T Create<T>(Type type, params object?[] parameters);
|
||||
T? Create<T>(Type type, params object?[] parameters);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Toolkit.Foundation
|
||||
{
|
||||
public class ServiceCreator<T> : IServiceCreator<T>
|
||||
public class ServiceCreator<I, T> : IServiceCreator<I>
|
||||
{
|
||||
public virtual object Create(Func<Type, object[], object> creator, params object[] parameters)
|
||||
{
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public T? Get<T>(Type type)
|
||||
public object? Create(Type type, params object?[] parameters)
|
||||
{
|
||||
T? value = (T?)factory(type);
|
||||
return value;
|
||||
dynamic? lookup = factory(typeof(IServiceCreator<>).MakeGenericType(type));
|
||||
return lookup is not null ? lookup.Create(creator, parameters) : creator(type, parameters);
|
||||
}
|
||||
|
||||
public T Create<T>(Type type, params object?[] parameters)
|
||||
public T? Create<T>(Type type, params object?[] parameters)
|
||||
{
|
||||
dynamic? lookup = factory(typeof(IServiceCreator<>).MakeGenericType(type));
|
||||
return lookup is not null ? (T)lookup.Create(creator, parameters) : (T)creator(type, parameters);
|
||||
|
||||
Reference in New Issue
Block a user