NHibernate: Error dehydrating property - What the heck is this?
It's likely that nhibernate is not showing the correct property of error, check the adjacent properties in the mapping file, looking for errors in relationship between data types from your database and data types from .net or repeated columns in properties... also check this link Fluent NHibernate - IndexOutOfRange
You should check CFAPTransaction mapping, It looks like you wanted to specify one Vendor for each transaction. In this case your mapping has to be like below code.
public CFAPTransactionMap()
{
HasOne(x => x.Vendor).ForeignKey("VendorId").Cascade.All();
...
}
In my case it was a missing Identity Specification on the SQL-Server.
Simple object:
public class Employee
{
public virtual int ID { get; set; }
}
Mapping:
public class EmployeeMap : ClassMapping<Employee>
{
public EmployeeMap()
{
Id(x => x.ID, map => { map.Generator(Generators.Identity); map.UnsavedValue(0); });
}
}
SQL:
Here is the ID column with the primary key constraint.
And here you can see the missing Identity Specification, which is causing the problem.
To solve the problem, you have to specify the ID column as IDENTITY
i.e.
CREATE TABLE EMPLOYEE
(
ID int NOT NULL IDENTITY(0, 1)
);