NHibernate fluent HasMany mapping inserts NULL Foreign key
问题 I have an entity Company that has many Orders. I mapped these as following to each other: Company HasMany(x => x.Orders).KeyColumn("CompanyID").Cascade.All().Inverse(); Order References(x => x.Company).Column("CompanyID") However when i create a new order for the company and try to save it, I get a SQL error: "Cannot insert the value NULL into column 'CompanyID', table 'Orders'; column does not allow nulls. INSERT fails." (this is the generated SQL statement: INSERT INTO Order (Name,