- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试定位 PerRequestLifetimeManager。在 MSDN 中,it says that it is part of the Unity 3 assembly.
我已经通过 Nuget 安装了 Unity.Mvc4。 package.config 说我正在使用 Unity 3.0:
Microsoft.Practices.Unity.dll 说我正在使用 Unity 3.0
我使用对象浏览器查看了 DLL,找不到 PerRequestLifetimeManager。
我是不是漏掉了什么?
如果有人会建议替代类,我打算使用自定义的 PerRequestLifetimeManager 找到 here (如果我找不到类(class))。
编辑:
我卸载了Unity.Mvc4,直接在package console安装了Unity3.0,结果如下:
PM> Install-Package Unity -version 3.0.1304.1
'Unity 3.0.1304.1' already installed.
Successfully added 'Unity 3.0.1304.1' to RedLions.Presentation.Web.
即使在官方库中,我仍然找不到 PerRequestLifetimeManager 类。
最佳答案
当我只是自己回答问题时,似乎不太好回答我自己的问题。我不能再删除我的问题。
无论如何,这是我的解决方案。
我直接去Unity的源代码,我发现这个类确实存在在同一个命名空间中,但不在同一个程序集中。 PerRequestLifetimeManager 位于 Microsoft.Practices.Unity.Mvc
我检查了 MSDN,它确实说它在不同的 DLL 中,但我没有注意到。对此感到抱歉。
它不是 nuget 中 Unity 包的一部分,而是在 Nuget (Unity.Mvc) 中的另一个包中,所以这里是:http://www.nuget.org/packages/Unity.Mvc/
我决定转储 Unity.Mvc4,因为不再需要它,一切都已经在 Unity.Mvc 中了。 (App_Start/UnityConfig.cs)
关于c# - 在 Unity.MVC4 或 Unity(3.0) 中找不到 PerRequestLifetimeManager 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20768406/
我在我的项目中使用 Unity。但是我不确定我是否应该使用 using 语句,因为我正在使用 PerRequestLifetimeManager。 简单的例子: 注入(inject): contain
我有一个 MVC 应用程序,它使用 Unity 作为其 IoC 容器,并使用 PerRequestLifetimeManager 在我的应用程序中定义了多个服务。 . container.Regist
我已经为我们的项目设置了 Unity 以进行依赖注入(inject)。该项目本身是一个使用 MVC 和 Web API 的 ASP.NET 应用程序。 对于数据库上下文,我使用 PerRequestL
我有一个将 IoC 与 Unity 结合使用的 MVC 应用程序,并且我有一个使用 PerRequestLifetimeManager 定义的 DbContext 实现。该对象通过工作单元实现注入(i
我有一个 WEB API 应用程序,我使用 UnityContainer 作为我的 DI。由于我将 UnitOfWork 与 Entity Framework 一起使用,因此我想在每个请求的 Unit
我有以下使用 Unity 初始化实例的代码: IUnityContainer container = new UnityContainer(); container.RegisterType(new
我正在尝试定位 PerRequestLifetimeManager。在 MSDN 中,it says that it is part of the Unity 3 assembly. 我已经通过 Nu
这是我的 UnityConfig.cs: public class UnityConfig { private static Lazy container = new Lazy(() =>
我是一名优秀的程序员,十分优秀!