Microsoft Unity- Issue With Resolve

前端 未结 2 1494
情书的邮戳
情书的邮戳 2021-01-25 14:21

I am looking to do this:

container.Resolve();

When it does this, its going to inject a IDependency into the underlying entity object. However, the dependency st

2条回答
  •  终归单人心
    2021-01-25 14:32

    Why don't you use the static factory extension?

    var container = new UnityContainer();
    container.AddNewExtension()
             .Configure()
             .RegisterFactory(container =>
                              DependencyFactory.GetValue());
    

提交回复
热议问题