Wrox Programmer Forums
|
BOOK: Professional DotNetNuke Module Programming ISBN: 978-0-470-17116-5
This is the forum to discuss the Wrox book Professional DotNetNuke Module Programming by Mitchel Sellers and Shaun Walker - Wrox DotNetNuke Series Editor; ISBN: 978-0-470-17116-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional DotNetNuke Module Programming ISBN: 978-0-470-17116-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2009, 08:06 AM
Authorized User
 
Join Date: Jul 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default IHydratable and Arrays

(Simplifying:) I am creating a module that is a book catalog.

In SQL Server I have 3 tables to store this book catalog.
If every book has just 1 author I could suffice with just 1 table. But there are books that have multiple authors.
The 3 tables in SQL Server look like this.

The first table (BookDetails) has the following fields:
BookID (int)
YearOfPublishing (int)
Title (nvarchar)

The second table (Authors) has the following fields:
AuthorID (int)
FirstName (nvarchar)
LastName (nvarchar)

The third table links the first 2 tables and has the fields:
ID (int)
ArticleID (int)
AuthorID (int)

In DotNetNuke I created a BookInfo class with arrays of string as data types for the FirstName and LastName properties.
This to be able to store multiple authors for 1 book.
So the BookInfo class has the following properties:
YearOfPublishing as Integer
Title as String
FirstName() as String
LastName() as String

How do I tie this all up within the IHydratable Fill method?
Can it be done or should I use another approach?
Help much appreciated.
 
Old November 29th, 2009, 09:31 PM
Wrox Author
 
Join Date: Jul 2008
Posts: 74
Thanks: 1
Thanked 8 Times in 8 Posts
Send a message via MSN to msellers
Default

A few recommendations here.

1.) I would change your structure a bit and create an "Author" class, to hold the AuthorId, FirstName, and Last Name value

2.) I would then change your BookInfo object to have a "List<Of AuthorInfo>" for the authors.

What you can then do is in your iHyrdratable method, you can call out to the database, and fill the list of authors using the same methods.
__________________
Mitchel Sellers
Microsoft C# MVP, MCITP
Director of Development
IowaComputerGurus Inc.

My blog for .NET and DotNetNuke info

Author of "Professional DotNetNuke Module Programming"

Tech Editor on "Visual Studio 2010 six-in-one" and "Pro C# 4.0"
 
Old December 9th, 2009, 11:23 AM
Authorized User
 
Join Date: Jul 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for your reply.
The 1st and 2nd step are clear to me.

Quote:
Originally Posted by msellers View Post
What you can then do is in your iHyrdratable method, you can call out to the database, and fill the list of authors using the same methods.
Only the last part I don't yet have a clear picture of. Could you may be make it a bit more explicit, may be with a few lines of example code?





Similar Threads
Thread Thread Starter Forum Replies Last Post
arrays Abraham Java Basics 5 April 11th, 2009 11:10 PM
Multidemmesional Arrays OR arrays gmoney060 Classic ASP Basics 3 November 1st, 2004 03:42 PM
Arrays tajin Excel VBA 0 June 20th, 2004 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.