This question is locked. New answers and comments are not allowed.
Hi,
from the documentation
my code:
everything gets inserted into my database (sql 2005)
EXCEPT the JobID in my Print table. JobID is still null.
Is there something i need to set before SaveChanges?
thanks for help
UPDATE: Found the solutions some posts below. Thread can be closed
from the documentation
Car newCar =
new
Car();
newCar.ABS =
true
;
newCar.AirConditioner =
true
;
newCar.ASR =
true
;
newCar.Available =
false
;
newCar.CarYear = 2012;
newCar.DVDPlayer =
false
;
newCar.Make =
"Audi"
;
newCar.Model =
"A8"
;
newCar.Mp3Player =
true
;
newCar.Navigation =
false
;
newCar.TagNumber =
"PB 3341 SS"
;
Category newCategory =
new
Category();
newCategory.CategoryName =
"MyCategory"
;
newCategory.Cars.Add(newCar);
dbContext.Add(newCategory);
dbContext.SaveChanges();
my code:
Print p =
new
Print();
p.LocationID = loc.ID;p.Timestamp = DateTime.Now;
job.Prints.Add(p);
everything gets inserted into my database (sql 2005)
EXCEPT the JobID in my Print table. JobID is still null.
Is there something i need to set before SaveChanges?
thanks for help
UPDATE: Found the solutions some posts below. Thread can be closed