我有一个抽象工厂已经在某些控制器实例中注册了注入。
我能否将该抽象工厂注册并用作注入工厂?
这是我的代码:
public interface ILevelFactory
{
Levels Create();
}
.RegisterType<ILevelFactory, LevelFactory>()
.RegisterType<Levels>(new InjectionFactory((c) => StaticLevelFactory.GetLevels()))
期望的情况:
.RegisterType<ILevelFactory, LevelFactory>()
.RegisterType<Levels>(*** look up and use ILevelFactory ***)
简而言之,我想摆脱StaticLevelFactory。