且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法解析符号'EnterpriseLibraryContainer“

更新时间:2023-10-03 13:41:04

Halleluiah!我刚刚发现一个帖子(即后来消失了一个链接)。这里的故事:

Halleluiah! I just found a post (on a link that has since disappeared). Here's the story:

所有块的引导代码在企业图书馆的6版本已更改。块不再使用统一管理初始化和配置,并且每个块现在包括它自己的引导代码。到EnterpriseLibraryContainer.Current.GetInstance方法从企业库块之一解决任何类型的电话应与地块具体引导代码来代替。例如,要创建一个基于配置在App.config文件中的日志写实例,您现在可以使用下面的代码:

The bootstrapping code for all of the blocks has changed in version 6 of Enterprise Library. The blocks no longer use Unity to manage the initialization and configuration, and each block now includes its own bootstrapping code. Any calls to the EnterpriseLibraryContainer.Current.GetInstance method to resolve a type from one of the Enterprise Library blocks should be replaced with the block specific bootstrap code. For example, to create a LogWriter instance based on configuration in the app.config file, you can now use the following code:

LogWriterFactory logWriterFactory = new LogWriterFactory();
var logWriter = logWriterFactory.Create();



我相信这Blurb的是从微软企业库6和Unity 3迁移指南。

I believe that this blurb is from the "Microsoft Enterprise Library 6 and Unity 3 Migration Guide".

我输入的代码所示,并没有抱怨编译器。现在我可以继续看到日志是如何工作的。

I've entered the code as shown and don't have the compiler complaining. Now I can continue to see how the logging works.