I have ShelfEntity and BookEntity in 1:m relation
and I can add new books on a shelf with use of ShelfEntity:Books
ShelfEntity has public key ID, that is also foreign key for BookEntity
// I create brand new shelf, ID will be assigned by trigger in DB
var shelf = new BookShelfEntity();
shelf.Name = "huge shelf";
adapter.SaveEntity(shelf ...);
^ this works perfect, now I can start adding book to the shelf
but if I will try to do it in one call:
var shelf = new BookShelfEntity()
shelf.Name = "huge shelf";
shelf.Books.AddNew().Name = "some fancy book";
adapter.SaveEntity(shelf ...);
I will get exception from saving book naming that BookEntity:Shelf_ID can't be null
how can I fix this ? ( I can't just assign shelf.Id to newBook.ShelfId as Id is assigned in trigger)
BR
PoKrec