我应该如何使用流畅的nhibernate配置xml

时间:2014-10-29 14:14:27

标签: nhibernate fluent

我应该如何使用流畅的nhibernate配置这个xml? 我尝试过使用CustomeType,但不能配置加密器和encryptionKey等参数。

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="EncryptedStringExample"
namespace="EncryptedStringExample">
  <typedef
  name="encrypted"
  class="EncryptedStringExample.EncryptedString,
EncryptedStringExample">
    <!--定义加密类-->
    <param name="encryptor">
      EncryptedStringExample.DESEncryptor,
      EncryptedStringExample
    </param>
    <!--设置密钥-->
    <param name="encryptionKey">12345678</param>
  </typedef>
  <class name="Account">
    <id name="Id">
      <generator class="guid.comb" />
    </id>
    <property name="Name" not-null="true" />
    <property name="EMail" not-null="true" />
    <!--要加密的字段,注意设置了type="encrypted"-->
    <property name="CardNumber" not-null="true" type="encrypted"
/>
    <property name="ExpirationMonth" not-null="true" />
    <property name="ExpirationYear" not-null="true" />
    <property name="ZipCode" not-null="true" />
  </class>
</hibernate-mapping>

0 个答案:

没有答案