Filtering - reducing duplicate code

Rockfan

New member
Joined
Feb 7, 2007
Messages
4
Programming Experience
1-3
Hello people,
I have a somewhat annoying problem, maybe someone can help me demistify this :)

Project outline:

The application handles processing of dossiers, each contains information about payments, debtors, summations as well as some general information such as IDs, dates etc. Not that complicated right? Just your every day CRUD operations...

The GUI consists of about 5 ASP.NET webforms, each displaying a simple HTML table with the respective object information. E.g. ViewDossiers, ViewSummations, ViewDebtors - you get the idea.

Ok so, Ive defined an interface for DB access; currently its implemented as a mock DAO, the next step would be to implement it for MS SQL Server 2005.

And here is the problem: recently Ive been asked to implement filtering functionality - for each property of each relevant class(dossier, document...). Ugh. If these were generic datasets, I could just make 1 function, pass the table, column and value to filter by as parameters and databind the result. Too bad datasets are out of the question.. So I turned my attention to LINQ which provides neat filtering options via the From..Where..Select structure. Although - am I forced to implement a function for EVERY property I want to filter on? There has to be a better way? Resorting to hacky solutions like CallByName() and alike seem very clunky, not to mention inflexible. Has anyone any idea how I would go about solving this..? :confused:

Thanks in advance!

VS.NET class diagram here: http://img132.imageshack.us/img132/2066/dcdm.png

You can see currently the filtering is implemented as a "GetFiltered..." function which returns an IEnumerable of the respective type. This is basically what needs fixing/improving as every time you add a new class/property you need to add a filter function in the GUI, one in the BLL layer, and several in the data access layer..

Alternatives, tips, thoughts - I'm open for anything!
 
Back
Top