简体   繁体   中英

Error in Microsoft Enterprise Library 6 Unitycontainer

I am using the following code in project with Enterprise Library 6 and get this error :

"the type or namespace name 'EnterpriseLibraryCoreExtension' could not be found "

How to Fix this error ?

var container = new Unitycontainer().Addnewextension<EnterpriseLibraryCoreExtension>();

container.Registertype<Ilog, logger_enterprise>();

var logger = container.resolve<Ilog>();
logger.log("message");

According to Grigori Melnik on the release announcement page ,

The Enterprise Library blocks no longer use the Unity container to resolve instances. You should remove all calls to the AddNewExtension method of the Unity container from your code. If your application currently resolves Enterprise Library objects from the container, you must either manually register the required types in the Unity container, or modify your application to use the static facades in the blocks to configure and retrieve the Enterprise Library objects your application uses.

Also, for other changes, don't forget to check out the change log and the Migration Guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM