What I have?
I have below requirements:
- Search the database and return TreeNode objects to build a tree view
- Search the database and return a generic list to construct a diagram.
- Extensibility should be there to do search and return different type of objects
- Database is huge and performance should be considered with high priority
What problem am I facing?
I am trying to do a class design for the problem. Here, searching method is same and only return type differs. I am confused which design pattern to use here.
Can somebody help me in this?
Thanks in advance!
Update-1
Searching logic will be same and APIs are provided that purpose. The APIs will accept search parameters and return the results as a DataReader (in C#). Using the reader, I need to construct either TreeNode, a generic list, or any other object that may come in future.
I need to design a component that sits in business layer to serve the presentation layer. Depending on the user's selection, the search results will be displayed with different controls. These controls need different type of objects to bind.