Hi! I have two database tables Asset & Book. Book inherits from Asset in a 1:1 relationship. Unfortunately the following code fails with a FORIEGN KEY CONSTRAINT error (listed at bootom). Basically it's telling me that the Asset data needed to saved BEFORE the Book data. Neddless to say I thought the LLBL did this for me.
Anyway, I could use some advice as to how I should resolve this.
BookEntity bookEntity = new BookEntity();
//Data in the Asset Table
bookEntity.Status = basicData.Status.ToString().ToUpper();
bookEntity.Title = basicData.Title;
bookEntity.SubTitle = basicData.SubTitle;
bookEntity.Guid = Guid.NewGuid();
//Data in the Book table
bookEntity.PrimaryIsbn13 = basicData.PrimaryIsbn13;
adapter.SaveEntity(bookEntity, true);
Error:
An exception was caught during the execution of an action query: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Book_Asset". The conflict occurred in database "Octavo", table "dbo.Asset", column 'Id'. The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.