PTracker Example - Multiple Resource Types

PTracker Example - Multiple Resource Types

Old forum URL: forums.lhotka.net/forums/t/2354.aspx


davecorun posted on Thursday, February 15, 2007

Hi everyone, we have a quick CSLA design question.  We're just getting into the framework and are pushing our way through the C# version of the book.  Very exciting stuff!

To relate our question to the included PTracker example:

We have a situation where a Project can have Resources of different data types.  This means we are currently considering having a seperate class for each data type.  So they would be ResourceBoolean, ResourceDateTime, etc.  We like this design b/c of the possibility of overriding ToString and modifying the output, as well as the inherant type-safety of this approach.

How would we accomplish this type of scenario, while using the CSLA framework and leveraging it's capabilities?  We definitely want to have the N-Level undo, object collections, permissions, etc.

Any guidance would be greatly appreciated.

Thanks!

// Dave

skagen00 replied on Thursday, February 15, 2007

One way is to define an interface such as IProjectResource, and then you'd have a ProjectResources collection that would contain IProjectResource members.

(i.e. a polymorphic collection - you'll find threads if you search on that I believe)

Polymorphic collections are a little trickier to work with but sometimes it's what I find I end up needing to do myself.

davecorun replied on Thursday, February 15, 2007

Ok, this makes a lot of sense.  We (my co-worker and I) are going to go researching through the threads to find a good example of the polymorphic collection in action.

Aside from this solution, are there any other good ways to implement our scenario?

Thanks!

// Dave

skagen00 replied on Thursday, February 15, 2007

BTW, You can look at this "document" from Rocky on the subject.

http://lhotka.net/Article.aspx?area=4&id=b8515cd9-7f8e-43df-9efd-cd958dfdc21a

Though I found that there were a couple questions unanswered (especially w/ data access).

No obvious good alternatives come to my mind but others might have nice suggestions.

 

davecorun replied on Thursday, February 15, 2007

Awesome, I just found that same article too.

I'm looking forward to new and fresh perspectives on this scenario.

Thanks!

// Dave

Copyright (c) Marimer LLC