Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
|
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 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 November 5th, 2010, 06:13 PM
Authorized User
 
Join Date: Jan 2006
Posts: 13
Thanks: 6
Thanked 1 Time in 1 Post
Default very simple service that returns a list of names... ?

Hi,

I am designing a web app which has a combobox (textbox + drop down), much like the Google toolbar where a list of suggestions will show after typing a few characters.

The combobox is meant to suggest member names after a few characters are entered.

Question:

This is AJAX based on asmx script service. Should I have:
  1. the Service call the Repository which returns a list of User objects (an Entity with a lot of properties and methods), and then return just an array of names (as DTO) back to the web page?, OR
  2. the service call an ad hoc DAL method that returns just a list of names "List (of String)" without involving the Domain Model and any DTO?
Is #2 acceptable in domain driven design? Or should I design some kind of value object around the User entity which contains only Username & Email & First/Last Name (just an example), and work with a Repository for the value object (doesn't sound right to me though... seems like a DTO)?

#1 to me seems just too heavy for this simple operation.

Thanks! I am new to this domain model (used to Transaction Script) so please bear with me.. if this sounds stupid.
 
Old November 5th, 2010, 07:09 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi Samvan,

I think option two is definately the way to go. Have a look at a popular domain driven design method called Command-Query Responsibility Segregation, it splits all actions down into either a query or a command e,g. Do this or give me this information.The query operations simply return view models (DTOs) straight from the data store.

I also regularly include a readonly reporting or presentation repository that returns simple DTO view models of the domain for senarios like this which I use this directly from the UI. This is much more effective for displaying purposes espically as I am not running any business logic.

Cheers
Scott
The Following User Says Thank You to elbandit For This Useful Post:
samvan (November 5th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
binding service to an activity, simple example? dan77062 BOOK: Professional Android 2 Application Development 0 October 8th, 2010 10:48 PM
VB Net Ms Access list column names (how to sample) jhkraft VB Databases Basics 2 March 13th, 2008 03:27 PM
Service returns xmlNode instead of xmlDocument! KC7ZDM .NET Web Services 0 February 18th, 2005 08:18 PM
Simple HTTP POST .Net web service? DaveCollinsPenchant .NET Web Services 1 September 10th, 2004 04:46 PM
Creating a simple .Net service badgolfer VS.NET 2002/2003 0 March 31st, 2004 04:29 AM





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