I am using entity framework 5.0 and I am not able to save tables with foreign key relation. I have a table called "Order" (OrderID & Date) and a table called "OrderLine" (Price,ID,OrderID). With the Following code, I am unable to save OrderLine. System just saves data in Order table.
using (var db = new DartProjectionsDb())
{
var view = new Order
{
OrderID = e.Identity.Identifier,
Date = SystemTime.UtcNow(),
};
OrderLine orderLine = new OrderLine();
orderLine.ID = 1;
orderLine.OrderID = e.Identity.Identifier;
orderLine.Price = 100;
view.OrderLines.Add(orderLine);
db.Orders.Add(view);
db.SaveChanges();
}