You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
586 B
21 lines
586 B
using System;
|
|
using Autofac;
|
|
|
|
namespace Trash.Command
|
|
{
|
|
internal static class CliTypeActivator
|
|
{
|
|
public static object ResolveType(IContainer container, Type typeToResolve)
|
|
{
|
|
var instance = container.Resolve(typeToResolve);
|
|
if (instance.GetType().IsAssignableTo<IServiceCommand>())
|
|
{
|
|
var activeServiceProvider = container.Resolve<IActiveServiceCommandProvider>();
|
|
activeServiceProvider.ActiveCommand = (IServiceCommand) instance;
|
|
}
|
|
|
|
return instance;
|
|
}
|
|
}
|
|
}
|