IUnityContainer.Resolve throws error claiming it cannot be used with type parameters

前端 未结 5 773
陌清茗
陌清茗 2020-12-22 23:46

Yesterday I\'ve implemented the code:

CustomerProductManager productsManager = container.Resolve();

It was co

5条回答
  •  佛祖请我去吃肉
    2020-12-23 00:19

    I had the same problem and found the "fix" looking at Prism sample code files. Looks like, even if it is not a dll in Unity V2 you have to add a reference in your class to: Microsoft.Practices.Unity

    my complete "using" section is as follow

    using System;
    using System.Windows;
    using Microsoft.Practices.Composite.Modularity;
    using Microsoft.Practices.Unity;
    using Microsoft.Practices.Composite.UnityExtensions;
    

    I'm not sure if you are using Silverlight, but the generic version for Container.Resolve IS in Microsoft.Practices.Unity.

提交回复
热议问题