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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:25:46+00:00 2026-05-19T10:25:46+00:00

I am using NHibernate for persistence and have my domain model mapped out. I

  • 0

I am using NHibernate for persistence and have my domain model mapped out. I am using MVC2 and I am keen to use the built in model validation for all basic validation (string length, range, etc).

The problem is that I’m finding that there is a huge amount of work involved in this. I have 26 POCO classes representing the domain. Which means I need roughly 5 x 26 = 130 ViewModels (one for create, edit, view, list, delete) given I’m going to use ViewModels everywhere. 130 ViewModels to create and maintain considering I have my domain objects already mapped out seems wasteful.

Now I’ve bought into the idea that this is a good way to develop as a way to keep the view as dumb as possible, eliminate view related security blunders, etc. To be honest I get the strong impression I’m missing a tool or technique that would speed this process up.

Is there a way to reduce this pain?

  • 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-19T10:25:47+00:00Added an answer on May 19, 2026 at 10:25 am

    I’m not sure why you would need 5 ViewModels? The ViewModels kinda represent what you want to display (in the view):

    Lets say you have these Related Entities:

    BlogArticle
    Tags
    CategoryName
    

    You have three entities but from the form that creates the BlogArticle you’re writing the article, selecting tags and then choosing a category on one page.

    On the BlogArticle create form you just want the following ViewModel:

    BlogArticleViewModel
    +string BlogTitle
    +string BlogContent
    +string TagName //could be mapped to textbox, checkbox
    +string CategoryName//same as above
    

    You could use http://automapper.codeplex.com to map Models to ViewModels.

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

Sidebar

Related Questions

I am using nHibernate for db persistence. I have a one-to-many relationship defined between
We have implemented our domain model using the accountability pattern, which we are trying
I have the following class setup for persistence using NHibernate public class Person {
I have a problem with uninitialized proxies in nhibernate The Domain Model Let's say
I am using nhibernate for my OR persistence and I store a list of
I'm trying to write my Domain Model as persistence-ignorant as possible . The only
I am relatively new to using Nhibernate but basic things already are working. Now
I'm using DDD and NHibernate to persist my domain object. In my database every
I have read in Chapter 4 of the NHibernate docs that all of a
I started using NHibernate this week (struggling). I have a small application with 3

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.