views:

39

answers:

2

I USED to be a developer and part-time db designer, but it's been many years and I'm re-learning...

I'm building a web app and have a Person (actually "Profile") table with a number of child tables which have N:N relationships with my Person table, e.g. FavoriteSports MusicalInstruments ArtisticSkills

After reading through Scott Mitchell's excellent data access tutorials at www.asp.net, I want to design my app w/ well-thought-out Data Access (using Table Adapters) and Business Logic (using Classes) Layers.

Where I get hung up is in designing the Classes and Table Adapters. The "Unit of work" here is something more like a real-life object, that doesn't align directly with my table-based classes or data access objects. So I guess what I'm seeing is a need to build a class modeled not around the tables, but instead around the real-life object (my Profile+FavoriteSports+MusicalInstruments+ArtisticSkills).

What I'm really looking for is a good book or web site that describes how to do this. Specifically, how can I build a class that supports these child records (as collections?). I think I understand the concepts - I just need some guidance on how to put it into practice.

The best answer I could ask for would point me at a book (C#, preferrably) that goes into all this in all its complexities - pretty sure I'm way past the "Beginners" books with this.

Thanks -

-Pete

A: 

It'd be clear if you could follow what an ORM tool like NHibernate presents.

The key thing is to think about it less in terms of tables and more about objects.

Sounds like you'd have a Person class with child collections for a class or interface of Skills:

public class Person
{
   public IList<Skill> Skills { get; set; }
}

It's a many-to-many relationship, but you might not need for a Skill to keep track of how many Persons are associated with it.

duffymo
+1  A: 

Unfortunately one book might not help. I recommend you go for these books to get back to understanding the two worlds of RDBMS and OO. Tables and business entities may not be a 1:1 map!

Patterns of Enterprise Application Architecture

Domain-Driven Design: Tackling Complexity in the Heart of Software

.NET Domain-Driven Design with C#: Problem - Design - Solution

Hope that helps.

Perpetualcoder
I went with a bunch of books - used - from Amazon...- C# Class Design Handbook: Coding Effective Classes- Programming Microsoft Visual C# 2005: The Base Class Library (Pro-Developer)- C# Class Design Handbook - Design Patterns: Elements of Reusable Object-Oriented Software Hopefully between the four, I'll get what I was after. Thanks for the suggestions.-Pete
Those are excellent books, however I do not think they give you an idea about working end to end for a software. Best of luck!
Perpetualcoder