Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 162937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:28:46+00:00 2026-05-11T11:28:46+00:00

My development team has run into a design issue. I’m hoping someone can help

  • 0

My development team has run into a design issue. I’m hoping someone can help me clean this part of the architecture up a bit.

In my system, I have an enum with 250 members [one member represents a distinct drop down]. In order to populate the drop downs on any given window, that form sends in the enum members that relate to the drop downs needed, and the drop down information is returned.

In other words, say for example, we have 3 windows. Window A has drop downs X, Y and Z. Window B has drop downs W, X and Y and Window C has drop downs T, U and W. My DropDownType enum would consist of T, U, W, X, Y, Y, and Z. So for a specified window, given the drop downs on that window, I query for the data to appear in those drop downs.

This is a simplified example because my application consists of > 250 distinct drop downs.

As you can imagine, I have a factory setup to return the data for each drop down. And this factory is called for each drop down requested.

    switch (dropDownType)     {         case DropDownType.T:             return (from t in dataContext.GetTable<TableOne>()                      select new DropDownDto                                 {                                     DropDownDisplayName = t.ColumnA,                                    DropDownValue = t.ColumnB                                }).ToList();         case DropDownType.U:             return (from u in dataContext.GetTable<TableTwo>()                      select new DropDownDto                                 {                                     DropDownDisplayName = u.ColumnC,                                    DropDownValue = u.ColumnD                                }).ToList();         // etc...     } 

Since I have so many members in this enum, does anyone know of a more elegant way of coding this? Do you think transforming this into factory methods would be helpful (but then we’d have to worry about 250 separate files in our source…)? Is there another pattern out there that is more useful? Just having this HUGE switch statement is getting unmanageable.

Any help is greatly appreciated. Thanks in advance!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:28:47+00:00Added an answer on May 11, 2026 at 11:28 am

    You could create a Dictionary<DropDownType, DropDownDtoDelegate> with each entry containing an enum entry as a key and a delegate to retrieve the drop down data as the value. This would allow you to keep each method that returns a drop down list separate and out of the huge switch statement. You would then have one method to retrieve the delegate, execute it, and return the drop down list data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My development team of four people has been facing this issue for some time
Part of the development team I work with has been given the challenge of
My team currently has a development web/database server and a live deployment web server
My development team uses source safe at a very basic level. We're moving into
Our server operations team has asked the web development team (ASP.NET) to provide a
This question came up on the development team I'm working with and we couldn't
The story goes like this... My team has a git repo on a windows
My development team has worked with subversion for quite some time. The way that
My development team has started to use Mockito and have classes that have been
I need to involve some markup and javascript people to help development team on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.