The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

masoud_sedighy@yahoo.com (11) [Avatar] Offline
#1
Hello

In listing 11.19 if the publisher or author does not exist, we want to create a new instance and insert
Them into the database, but I do not know when we insert that in publisher table after creating
"Publisher = (existingPublisher ??
new Publisher {
ID = Guid.Empty,
Name = (string)attributes.Element(ns + "Publisher")
}

Because there is not method like "InsertOnSubmit(publisher)" in the code. "newContext.Books.InsertOnSubmit(book)" will insert data just in book table or can insert in publisher table also?

Please help
Best regards.
fabrice.marguerie (224) [Avatar] Offline
#2
Re: when we insert new publisher in publisher table in listing 11.19
Yes, when a book is inserted, it's related objects (the publisher here) get inserted automatically.