【发布时间】:2014-06-18 06:35:38
【问题描述】:
我有两个班级:
public class CarModel
{
public virtual int Id { get; set; }
public virtual string model_name { get; set; }
}
和
public class Transport
{
public virtual int Id { get; set; }
public virtual string lic_plate { get; set; }
public virtual int model { get; set; }
public virtual string odometer { get; set; }
public virtual string moto_val { get; set; }
public virtual Class.CarModel Modelis { get; set; }
}
和映射:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" assembly="web_nt" namespace="web_nt.Models">
<class name="Transport" table="transport" dynamic-update="true" lazy="false">
<id name="Id" column="Id" type="int">
<generator class="native" />
</id>
<property name="lic_plate" />
<property name="model" />
<property name="odometer" />
<property name="moto_val" />
<many-to-one name="Modelis" column="model" cascade="none" class="web_nt.Models.Class.CarModel" lazy="false" />
</class>
<class name="web_nt.Models.Class.CarModel" table="car_model">
<id name="Id" column="id" type="int">
<generator class="native" />
</id>
<property name="model_name" />
</class>
</hibernate-mapping>
当我尝试将值发送到数据库时出现异常(在视图中它运行良好):+ $exception {“索引超出范围。必须是非负数并且小于集合的大小。\r \n参数名称:索引"} System.Exception {System.ArgumentOutOfRangeException}
我找不到这里可能有什么问题?
【问题讨论】:
标签: c# asp.net nhibernate