Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2011, 05:29 PM
Authorized User
 
Join Date: Dec 2010
Posts: 23
Thanks: 3
Thanked 2 Times in 2 Posts
Default How to handle "lists" of data?

I'm curious what you recommend for handling "lists" of data, if it should be a part of the regular domain model, or some other special type of model, or something else entirely.

When I say "lists" of data, I'm referring to things that the admin end-user of the system might pick from, e.g. a list of countries, a list of currencies. Using the Agatha's storefront example, the store owner might want to specify which countries they will ship/sell to. They'll need to pick these countries from a list of all countries. Similarly, they might want to specify the currency code that indicates the currency for all their products. They'd need to pick 1 currency from a list of currencies.

How would you persist and load the list of countries and currencies, and then store the store owner's selections from that list? Another way to put would be, I want to offer the store owner some "settings" they can configure for their store, and some of these settings are restricted to pre-defined set of options (country, currency).

Does this belong in the regular domain model? Is there some other "settings" model that should be used instead?

Thanks very much!
Reply With Quote
  #2 (permalink)  
Old January 27th, 2011, 10:02 AM
elbandit's Avatar
Wrox Author
Points: 599, Level: 8
Points: 599, Level: 8 Points: 599, Level: 8 Points: 599, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi ksouthworth,

Even though countries and currencies may need to be displayed as lists they are still concerns within your domain and should be modelled as such. Even though I modelled the Country as a string property on the address, really it would have made more sense to model it as an entity or a value object, as over time it will have behaviour such as what couriers deliver to that country etc. Same with currency, at the moment in the Agathas solution I have a decimal property, but how do I know what the currency is and how on earth do I display it and format it? All of this should be behaviour within a currency value object - I think we touched on this in this post - Why is Price a "string" type in the ViewModel instead of Decimal?.

Thinking back I should have added more value objects into the Agathas solution, but to keep the page count down and because of time I dumbed it down. Value objects for things such as Money, Currency, Price, Discount etc are very, very powerful when used in a domain model, they convey the concerns of the domain better than simple types.

But to get back to your question I use a repository for Countries and Currencies.

Cheers
Scott
Reply With Quote
  #3 (permalink)  
Old January 28th, 2011, 11:10 AM
Authorized User
 
Join Date: Dec 2010
Posts: 23
Thanks: 3
Thanked 2 Times in 2 Posts
Default

So you'd have repository with corresponding domain Entities for Country, Currency, etc. even though the data in those database tables isn't really going to ever change from the initial set of data? i.e. the list of countries in the world doesn't really change.

This is basically what I've done in the past as well, was just curious if there was an alternative way to do it
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
Difficulties with "web.config" and "ASPNETDB" CFRham BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 2 July 3rd, 2010 10:19 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM



All times are GMT -4. The time now is 11:38 AM.


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