Click here to Skip to main content

Design and Architecture

    RSS: RSS Feed

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
QuestionHow to control another application Pinmembercullyk17:13 11 Dec '09  
AnswerRe: How to control another application PinmvpLuc Pattyn18:35 11 Dec '09  
GeneralRe: How to control another application Pinmembercullyk19:02 11 Dec '09  
QuestionBest way to share the load on a project for two developers? Pinmemberbuzzwright12:36 3 Dec '09  
AnswerRe: Best way to share the load on a project for two developers? PinmemberEddy Vluggen12:40 11 Dec '09  
Questiongood production software should contain some or most of the following? PinmemberboyGenius4:02 22 Nov '09  
QuestionDynamic filters in n-tier applications - how to implement? Pinmembermidix6:13 18 Nov '09  
I was thinking about a scenario which is often seen. Let's start form the user perspective. He opens a web page and there is some data table and filters like that:
Filter by: equals <input value here>
 
User chooses a field name and enters some value and submits that.
 
Web application (presentation layer) takes user input and transfers the request to the web service (using automatic .NET XML serialization). So it seems data transfer object pattern can be used here.
 
Then my web service transforms that DTO to some valid query. Let's assume we are using some OR/M tool to query it for objects which satisfies the query. Also let's assume that OR/M tool offers some easy way to construct dynamic queries (BTW, LINQ-to-SQL has some problems with this).
 
So the question is - how to better pass data from user form to the data access layer (OR/M tool) so the dynamic query could be generated with less hassle? It would be awful to have web method for each field like this: GetCustomerByName(string name), GetCustomerByCity ... and so on. Then I have to analyze the user input and call appropriate web method. But maybe it is the right way?
 
I prefer some method GetCustomersByFilter, so then I can almost directly pass the request to web service and then can convert the request to query in OR/M servicing component. But what to pass to this GetCustomersByFilter method? Dictionary with field names as keys? Many nullable parameters? Custom objects?
 
It would be nice to use the same data structures that are used to pass data to the web application - the same data transfer objects, I guess. Like this:
Customer[] GetCustomersByFilter(Customer filter);
 
but then I have to allow all the fields of Customer to be nullable so I can later see which fields are used as filters. And if that does not correspond my business/validation rules (if rules say - some property cannot be null) than it would be a bit confusing. Also if I would like to use some generator to create web forms based on my DTO objects, it would be impossible to mark required fields easily just by detecting if some field is nullable or not.
 
So maybe I need some other object, like CustomerFilter with all nullable fields? Wouldn't it be overkill to have two classes for each object (also, accounting that those DTOs are converted to domain entities later - then we have even more classes)?
 
This dynamic filtering issue is really bugging me. Has anybody any experience with that, especially using domain driven design?
 
Thanks.
QuestionDocument Management Syatem PinmemberOdd Arne8:16 17 Nov '09  
AnswerRe: Document Management Syatem PinmemberMREcoolio8:58 19 Nov '09  
AnswerRe: Document Management Syatem PinmemberRobin_Roy19:42 2 Dec '09  
AnswerRe: Document Management Syatem PinmemberEddy Vluggen3:11 6 Dec '09  
AnswerRe: Document Management Syatem Pinmemberpuri keemti1:34 7 Dec '09  
AnswerRe: Document Management Syatem PinmemberDavid Lario10:12 22 Jan '10  
QuestionDoes a developer need local administrator rights? PinmemberWindswept22:55 13 Nov '09  
AnswerRe: Does a developer need local administrator rights? PinmvpPete O'Hanlon10:36 15 Nov '09  
GeneralRe: Does a developer need local administrator rights? PinmemberWindswept10:32 16 Nov '09  
AnswerRe: Does a developer need local administrator rights? PinmemberIan Shlasko11:41 16 Nov '09  
GeneralRe: Does a developer need local administrator rights? PinmemberWindswept22:41 16 Nov '09  
GeneralRe: Does a developer need local administrator rights? PinmemberIan Shlasko4:32 17 Nov '09  
AnswerRe: Does a developer need local administrator rights? PinmemberMREcoolio8:50 19 Nov '09  
AnswerRe: Does a developer need local administrator rights? [modified] PinmemberFlint-Bear6:14 8 Dec '09  
QuestionEmpty IEnumerable or null PinmemberGideon Engelberth10:19 10 Nov '09  
AnswerRe: Empty IEnumerable or null PinmvpLuc Pattyn14:36 10 Nov '09  
GeneralRe: Empty IEnumerable or null PinmemberGideon Engelberth6:21 16 Nov '09  
AnswerRe: Empty IEnumerable or null PinmemberDavid Skelly23:47 10 Nov '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.5.120210.1 | Last Updated 13 Feb 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid