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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:43:44+00:00 2026-06-06T11:43:44+00:00

Wether I use Automapper or manually mapping, that plays no role. All the data

  • 0

Wether I use Automapper or manually mapping, that plays no role.

All the data for a ReleaseViewModel must be first in the Release because it is filled in the data access layer with it. 90% of my model are like this. Why the overhead of duplicating everything?

What about the KISS principle and over-engineering?

Of course every tool for its appropriate task, but very often I read on SO that not using ViewModels in asp.net mvc is a NO-GO.

Where to draw the line? Should I use ViewModels when they differentiate to 50 %, 75% or 99% from my models ?

I have a model Release:

 public class Release
    {      
        public int Id { get; set; }       
        public string Name { get; set; }
        public string Author { get; set; }
        public DateTime CreatedAt { get; set; }
        public int FailedTestsCount { get; set; }
        public int SucceededTestsCount { get; set; }
        public int SumTestsCount
        {
            get
            {
                return SucceededTestsCount + FailedTestsCount;
            }
        }
        public int SumTestingTime { get; set; }
    }

a viewmodel ReleaseViewModel:

public class ReleaseViewModel
{
    [HiddenInput(DisplayValue = false)]
    public int Id { get; set; }

    [Required(ErrorMessage = "Name must not be empty.")]
    [StringLength(30, ErrorMessage = "Enter max. 30 chars for a name.")]
    [Remote("ReleaseExists", "Release", ErrorMessage = "This name already exists.")]
    public string Name { get; set; }    
    public string Author { get; set; }    
    public DateTime CreatedAt { get; set; }    
    public int FailedTestsCount { get; set; }    
    public int SucceededTestsCount { get; set; }    
    public int SumTestsCount 
    {
        get
        {
            return SucceededTestsCount + FailedTestsCount;
        }
    }

    public int SumTestingTime { get; set; }
}
  • 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-06T11:43:46+00:00Added an answer on June 6, 2026 at 11:43 am

    ViewModel is something which is for the VIEW. most of the time it is similar to your entity model. But not always.

    Look at your example. In your ViewModel, you have the Remote Attribute and some Validation attributes. So this Remote Name checking is something you add to give a better user experience to your User. It is specific to the View.

    Another scenario you need a Viewmodel is for screens where you have more than one models involved. Ex : You have a User Entity and a Project Entity and you want to provide a screen where a Project can be added to a User. So in this case, you can create a viewmodel to handle that

    public class ProjectToUserVM
    {
      public int UserId { set;get;}
      public string UserName { set;get;}  // i want to display only name of user!
      public int ProjectID { set;get;}
      public IEnumerable<SelectListItem> Projects { set;get}
    }
    

    Do not use ViewModels for all your Model Entities. Create it when your VIEW really need it. I use my Model entity objects directly in some views without create a viewmodel sometimes because those are exactly same. Ex : Country / State/ City ( Look up table data.No Add/Edit)

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

Sidebar

Related Questions

I'd like ask a question about building applications in .NET that use data from
I am to decide wether to use a comfortable function that was introduced with
It appears to me that it matters whether you use a variable to temporary
I've been trying to use AutoMapper to save some time going from my DTOs
I have an array that I am trying to check wether or not an
is there a way to use dependency injection to inject all available implementations of
Usage scenario We have implemented a webservice that our web frontend developers use (via
I'm trying to figure out wether I should use SOAP or REST for a
While creating my website i was stuck on a thing. Wether i should use
I use a custom UITableView to display some data together with the contacts out

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.