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.