Sep 15, 2010 at 8:47 PM
Edited Sep 15, 2010 at 8:48 PM
I'm pretty new to unity and i can't seem to get the policy injection via web.config (as opposed to the API) working. I've followed the example code in the help chm (the version for vs2008), noticed a typo or two, and still have very little luck. here's the
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity"> <!--The Unity Configuration Schema-->
<sectionExtension type="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration"/>
<extension type="Interception" />
<register type="TestClass" name="whatever">
<lifetime type="singleton" />
<interceptor type="InterfaceInterceptor" name="logger"/>
<addInterface type="ITest" />
<register type="ICallHandler" mapTo="LoggingCallHandler" name="logger"></register>
<register type="IMatchingRule" mapTo="MemberNameMatchingRule"></register>
<policy name="log" >
I apologize in advance if I've done something really stupid, but I've tried what seems like a million different things with no luck whatsoever, and so the config is truly garbled at this stage. all i'm trying to do is have a policy that has a matchrule and
a callhandler that intercepts any method implementing the ITest interface.
The TestClass is returned by the container when I call the container to resolve the ITest interface. it's method (there's only 1) gets called, but that's it. no match check, no callhandler...nothing.
MemberNameMatchingRule match method would always return true (by design), but it never gets called. neither does the callhandler (probably because the match algorithm is never performed).
I can get much further using the Unity 2.0 api and can accomplish this 100% using PIAB v 4.1 but have no luck at all with the config file...