开发者

Microsoft Unity XML configuration for Interception

I've been trying to configure interception for Unity (I want to log to log4net before and after object method calls).

I've used this example:

http://www.codeproject.com/KB/architecture/UnityAOPNHibernate.aspx

and its similar to this answer:

Microsoft Unity - code to xml

but I get "Unrecognized element 'extensionConf开发者_运维技巧ig'." - on the line where it does GetSection("unity") below.

        IUnityContainer unityContainer = new UnityContainer();
        var configurationSection = 
          (UnityConfigurationSection)ConfigurationManager.GetSection("unity")

Please help


You need to add a section extention for this to work

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration"/>
...

Refer page 60 of Unity20.PDF for the documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜