I have two classes:
public class CarModel
{
public virtual int Id { get; set; }
public virtual string model_name { get; set; }
}
and
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; }
}
And mapping:
<?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>
And I get exception when I try to send values to database(In view it works perfectly): + $exception {"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"} System.Exception {System.ArgumentOutOfRangeException}
And I can't find what might be wrong here?