尝试配置 NHibernate 连接到 Oracle 时遇到错误:
NhbHelper.CUSTOMER.hbm.xml(6,8):XML 验证错误:命名空间“urn:nhibernate-mapping-2.2”中的元素“id”在命名空间“urn:nhibernate-mapping-2.2”中具有无效的子元素“列” '。
当我尝试添加程序集时发生错误
var configuration = new Configuration();
configuration.AddAssembly("NhbHelper");
sessionFactory = configuration.BuildSessionFactory();
我的客户.cs
using System.Collections.Generic;
using System.Text;
using System;
namespace NhbHelper.Customer {
public class CUSTOMER {
public CUSTOMER() { }
public virtual long CUSTOMER_ID { get; set; }
public virtual string CUSTOMER_CODE { get; set; }
public virtual string CUSTOMER_NAME { get; set; }
public virtual string SHOP_ID { get; set; }
public virtual string COUNTRY { get; set; }
public virtual string AREA_CODE { get; set; }
public virtual string STREET { get; set; }
public virtual string HOUSENUMBER { get; set; }
public virtual string PHONE { get; set; }
public virtual System.Nullable<System.DateTime> CREATE_DATE { get; set; }
public virtual System.Nullable<System.DateTime> UPDATE_DATE { get; set; }
public virtual string POSTAL_CODE { get; set; }
public virtual string CONTACT_PERSON { get; set; }
public virtual string TAX_CODE { get; set; }
public virtual string MOBILEPHONE { get; set; }
public virtual string LOCATION { get; set; }
public virtual long CUSTOMER_TYPE_ID { get; set; }
public virtual long LOYALTY { get; set; }
public virtual string CREATE_USER { get; set; }
public virtual string UPDATE_USER { get; set; }
public virtual string DISLAY { get; set; }
public virtual System.Nullable<System.DateTime> LAST_APPROVE_ORDER { get; set; }
public virtual System.Nullable<System.DateTime> LAST_ORDER { get; set; }
public virtual System.Nullable<long> STATUS { get; set; }
}
}
这是我的 CUSTOMER.hbm.xml :
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping assembly="NhbHelper" namespace="NhbHelper.Customer" xmlns="urn:nhibernate-mapping-2.2">
<class name="CUSTOMER" table="CUSTOMER" lazy="true" >
<id name="CUSTOMER_ID">
<generator class="identity" />
<column name="CUSTOMER_ID" sql-type="NUMBER" />
</id>
<property name="CUSTOMER_CODE">
<column name="CUSTOMER_CODE" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="CUSTOMER_NAME">
<column name="CUSTOMER_NAME" sql-type="NVARCHAR2" not-null="false" />
</property>
<property name="SHOP_ID">
<column name="SHOP_ID" sql-type="NVARCHAR2" not-null="true" />
</property>
<property name="COUNTRY">
<column name="COUNTRY" sql-type="NVARCHAR2" not-null="false" />
</property>
<property name="AREA_CODE">
<column name="AREA_CODE" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="STREET">
<column name="STREET" sql-type="NVARCHAR2" not-null="false" />
</property>
<property name="HOUSENUMBER">
<column name="HOUSENUMBER" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="PHONE">
<column name="PHONE" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="CREATE_DATE">
<column name="CREATE_DATE" sql-type="DATE" not-null="false" />
</property>
<property name="UPDATE_DATE">
<column name="UPDATE_DATE" sql-type="DATE" not-null="false" />
</property>
<property name="POSTAL_CODE">
<column name="POSTAL_CODE" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="CONTACT_PERSON">
<column name="CONTACT_PERSON" sql-type="NVARCHAR2" not-null="false" />
</property>
<property name="TAX_CODE">
<column name="TAX_CODE" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="MOBILEPHONE">
<column name="MOBILEPHONE" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="LOCATION">
<column name="LOCATION" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="CUSTOMER_TYPE_ID">
<column name="CUSTOMER_TYPE_ID" sql-type="NUMBER" not-null="true" />
</property>
<property name="LOYALTY">
<column name="LOYALTY" sql-type="NUMBER" not-null="true" />
</property>
<property name="CREATE_USER">
<column name="CREATE_USER" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="UPDATE_USER">
<column name="UPDATE_USER" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="DISLAY">
<column name="DISLAY" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="LAST_APPROVE_ORDER">
<column name="LAST_APPROVE_ORDER" sql-type="DATE" not-null="false" />
</property>
<property name="LAST_ORDER">
<column name="LAST_ORDER" sql-type="DATE" not-null="false" />
</property>
<property name="STATUS">
<column name="STATUS" sql-type="NUMBER" not-null="false" />
</property>
</class>
</hibernate-mapping>
请帮忙 !