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 5841669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:55:10+00:00 2026-05-22T11:55:10+00:00

I am working on a fairly large MVC 3 application, and I’m running into

  • 0

I am working on a fairly large MVC 3 application, and I’m running into an issue that doesn’t smell quite right to me. This question takes a little set up to understand, so here are the premises that I’m currently operating on:

  • Views should be strongly typed (ViewBag/ViewData should be avoided)
  • Because the views are strongly typed, view model objects should be created that encapsulate all the data the view needs to display
  • When we have a need for drop down menus we should have two properties:
    1. A property in the model that stores the selected value of the drop down
    2. A SelectList property in the view model that represents the items in the drop down
  • The view itself always uses the @Html.DropDownListFor() helper method
  • We are using Entity Framework 4, and letting it generate entity classes from our already designed database
  • To avoid duplication and take advantage of LINQ, we are not creating our own separate business/model classes but adding to the partial classes generated by the entity framework
  • These partial classes that we write are located in the business layer to make everything compile correctly
  • Most model classes have a shared editor template that can be used in multiple views

Here’s where the trouble comes in. The shared editor template’s model type is set to the model class. This means that the partial view that makes up the editor template does not have access to the containing view model object where the list of drop down items is stored.

I was able to “solve” this by adding a SelectList property directly to the model class in the business layer instead of keeping it in the view model. But the SelectList class is specific to MVC, which in turn means that my business layer has a dependcy on MVC. That doesn’t seem right to me because the BL should be agnostic to the UI.

Has anyone else run into this issue? How should I solve this? It’s also possible that one of my premises are wrong.

  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-22T11:55:11+00:00Added an answer on May 22, 2026 at 11:55 am

    Well, we ended up taking the simple way out. In the business layer we just changed the type to plain old Object. I figured that, regardless of the presentation layer, it will need some sort of list to contain the options available.

    I know this isn’t super clean as per @Darin and @Jakub, but I don’t see our end result being any different this way except that we’ve avoided having to write and/or set up a whole bunch of mappings between objects.

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

Sidebar

Related Questions

I'm working on an fairly large ASP application that will be fully localized. I'm
I'm working on a fairly complex Android application that requires a somewhat large amount
Working with a fairly large VB.Net back office winforms application. 1 million+ LOC. Big
I'm working on a fairly large web site built in PHP that will potentially
I'm working on a fairly large CMS-like app that includes a forum, wiki pages,
I am working in Java on a fairly large project. My question is about
I have to develop a fairly large ASP.NET MVC project very quickly and I
I am working on a fairly large project (with a number of modules, a
I am working on a fairly large aspx web project with extensive use of
I'm working on a fairly large project for a trading company in Philadelphia. The

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.