I have two tables that look like this:
Customer
ID int (PK) NOT NULL
Name varchar(250) NOT NULL
Order
ID int (PK) NOT NULL
Name varchar(250) NOT NULL
CustomerID int (FK to Customer.ID) NOT NULL
If I try to save an entity recursivly, I get an SQL exception that says that the CustomerID of Order is not set.
var customerEntity = new CustomerEntity();
customerEntity.Name = "Test";
customerEntity.Orders.Add(new OrderEntity { Number = "Test" });
using (var adapter = new DataAccessAdapter())
{
adapter.SaveEntity(customerEntity, true, true);
}
Why doesn't LLBLGen set the foreignkey field with the id of the saved Customer entity automatically? Do I have to do that manually?
I'm using LLBLGen 3.5 and SQL Server.