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

  • SEARCH
  • Home
  • 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 8578721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:27:24+00:00 2026-06-11T20:27:24+00:00

Our application does its best to keep the controllers smallish, our views are concerned

  • 0

Our application does its best to keep the controllers smallish, our views are concerned with UI, and we have a ViewModel for each View which pulls in the model data. We use AutoMapper were possible to map the Models into the ViewModels.

In some cases we ave a good bit of code needed for building out the ViewModels which while technically can be done in AutoMapper’s Map functionality it becomes huge and ugly. So we have this bit of logic which has made its way into some of our ViewModels but then those become 200+ lines in length and it just does not feel correct. For example, for one ViewModel we have about half a dozen properties which are not derived from a single model but from about 4-5 models and are dynamic in that they are calculated at runtime so its not as simple as mapping a name parameter from a model into our ViewModel.

Has anyone else run into this issue or have found a need to create some kind of ViewModel factory for those ViewModels which cannot easily be constructed from a single model?

EDIT

Example: Lets say you have a page for a Course such as ‘Beginning French 101’. The Course model might have a teacher, subject, pre-reqs, class number, section, etc. When a student visits the course page I might want to change how or what additional information is displayed about this class (or other classes) based upon the student’s enrollment status, registration, past history, what other classes the student is registered for, etc. I have two models here, Course and Student, but I may want to pull in additional information to include within the ViewModel based upon certain business rules.

  • 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-06-11T20:27:25+00:00Added an answer on June 11, 2026 at 8:27 pm

    If it’s a business logic, then it should not be placed in your mapping layer. Define Dtos and prepare your objects as much as possible in your business layer. If you have such humongous differences between your business models and your view models it means that you probably need another layer to translate your hefty business domain models into Data transfer Objects that will be more easily mapped to view models. In general you shoyuld avoid placing complex business logic in your mapping layer.

    Unfortunately without a specific code sample from your part it would be difficult to expand any further.

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

Sidebar

Related Questions

We have a bug in our application that does not occur every time and
I have a custom WebForms application that is utilized for our helpdesk that does
I have an application (video stream capture) which constantly writes its data to a
Does Adobe recommend we use Flex or HTML5 for our enterprise application development? In
Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have
We have a legacy VB6 app, which is critical to our business. We're working
We have embedded JasperReports into our application to generate reports, but I've been rather
We've been using Spark view engine for a while now in our application. Since
Our multithreaded application does a lengthy computational loop. On average it takes about 29
I have a program, written in Java, which originally used its directory in Program

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.