/// <see cref="GenericDAO{PK, M}"/> protected override Book CreateObjectFromDataReader(DbDataReader dr) { var book = new Book { // Fills the book fields. PrimaryKey = new DecimalPrimaryKey(DatabaseUtils.SafeGetDecimal(dr, "BOOK_ISBN")), Title = DatabaseUtils.SafeGetString(dr, "BOOK_TITLE"), Description = DatabaseUtils.SafeGetString(dr, "BOOK_DESCRIPTION"), PublicationDate = DatabaseUtils.SafeGetDateTime(dr, "BOOK_PUBLICATION_DATE"), Edition = DatabaseUtils.SafeGetDecimal(dr, "BOOK_EDITION"), IsAvailable = DatabaseUtils.SafeGetBoolean(dr, "BOOK_IS_AVAILABLE"), QuantityAvailable = DatabaseUtils.SafeGetDecimal(dr, "BOOK_QUANTITY_AVAILABLE"), Pages = DatabaseUtils.SafeGetDecimal(dr, "BOOK_PAGES"), ImageUrl01 = DatabaseUtils.SafeGetString(dr, "BOOK_IMG_URL_01"), ImageUrl02 = DatabaseUtils.SafeGetString(dr, "BOOK_IMG_URL_02"), ImageUrl03 = DatabaseUtils.SafeGetString(dr, "BOOK_IMG_URL_03"), ImageUrl04 = DatabaseUtils.SafeGetString(dr, "BOOK_IMG_URL_04"), ImageUrl05 = DatabaseUtils.SafeGetString(dr, "BOOK_IMG_URL_05"), CreateDate = DatabaseUtils.SafeGetDateTime(dr, "BOOK_CREATE_DATE"), RemoveDate = DatabaseUtils.SafeGetDateTime(dr, "BOOK_REMOVE_DATE"), LastUpdateDate = DatabaseUtils.SafeGetDateTime(dr, "BOOK_LAST_UPDATE_DATE"), Categories = new HashSet <Category>(), Authors = new HashSet <Author>(), // Fills the publisher Publisher = DatabaseUtils.CreatePublisher( dr.GetDecimal(dr.GetOrdinal("PUBLISHER_ID")), dr.GetString(dr.GetOrdinal("PUBLISHER_NAME")), dr.GetDateTime(dr.GetOrdinal("PUBLISHER_CREATE_DATE")) ) }; // Fills the categories. var categories = DatabaseUtils.SafeGetString(dr, "CATEGORIES"); if (!string.IsNullOrWhiteSpace(categories)) { foreach (string category in categories.Split(new char[] { ';' })) { book.Categories.Add(DatabaseUtils.CreateDomainModelFromStringWithSeparator <Category>(category, new char[] { '|' })); } } // Fills the authors. var authors = DatabaseUtils.SafeGetString(dr, "AUTHORS"); if (!string.IsNullOrWhiteSpace(authors)) { foreach (string author in authors.Split(new char[] { ';' })) { book.Authors.Add(DatabaseUtils.CreateDomainModelFromStringWithSeparator <Author>(author, new char[] { '|' })); } } return(book); }