【问题标题】:Micsoroft Enterprise Validation framework -> How to have one config file per validated TypeMicrosoft 企业验证框架 -> 如何为每个验证类型拥有一个配置文件
【发布时间】:2015-11-01 08:22:29
【问题描述】:

我正在使用微软企业验证框架。我正在我的 app.config 文件中链接文件“validation.config”。

<section name="validation"    type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        allowLocation="true" allowDefinition="MachineToApplication" restartOnExternalChanges="false"  />

<validation configSource="LocalConfiguration\validation.config" />

在我的“validation.config”文件中

<?xml version="1.0" encoding="utf-8" ?>
<validation>
    <type name="Car">
     <ruleset>
      <properties>
       <validators>...</validators>
      </properties>
     </ruleset>
    </type>
    <type name="Human">
     <ruleset>
      <properties>
       <validators>...</validators>
      </properties>
     </ruleset>
    </type>
</validation>

问题是:我可以将“Car”和“Human”类型放在不同的文件中,并在validation.config 中链接这些文件,或者是否有任何其他分离方式,因为我的验证器太多了,我希望它是干净易读。

【问题讨论】:

    标签: app-config enterprise-library


    【解决方案1】:

    @.NETJunkieSplitting up Validation Application Block configuration into multiple files 上有一篇博文,应该可以满足您的需求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-24
      • 1970-01-01
      • 1970-01-01
      • 2018-10-23
      相关资源
      最近更新 更多