13,190
社区成员
发帖
与我相关
我的任务
分享
<policyInjection>
<policies>
<add name="testPolicy">
<matchingRules>
<add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.MemberNameMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Member Name Matching Rule">
<matches>
<add match="ShowName" />
</matches>
</add>
<add type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.TypeMatchingRule, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Type Matching Rule">
<matches>
<add match="UnitTest.Core.Person" />
</matches>
</add>
</matchingRules>
<handlers>
<add type="UnitTest.Core.PersonCallHandler, UnitTest.Core"
name="PersonCallHandler" />
</handlers>
</add>
</policies>
</policyInjection>
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common" />
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="File-based Configuration Source">
<sources>
<add name="System Configuration Source"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common" />
<add name="File-based Configuration Source"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common"
filePath="InjectionPolicy.xml" />
</sources>
</enterpriseLibrary.ConfigurationSource>
</configuration>
然后建一个InjectionPolicy.xml文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="policyInjection"
type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.Configuration.PolicyInjectionSettings, Microsoft.Practices.EnterpriseLibrary.PolicyInjection" />
</configSections>
<policyInjection>
<policies>
<add name="testPolicy">
。。。
</add>
</policies>
</policyInjection>
</configuration>