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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:23:31+00:00 2026-05-11T03:23:31+00:00

I am trying to wrap my head around doing validation in a MVC scenario.

  • 0

I am trying to wrap my head around doing validation in a MVC scenario. I have my application setup so that it has a Data/Repository layer that uses Linq2SQL and creates objects in my domain model. I don’t expose my Linq2SQL objects directly to the rest of my app however, for now, my domain model mostly looks like my database tables. I wanted to do this in case I wanted to drop Linq2SQL later.

Then I have a service layer that is called from my controllers to perform actions and grab my domain model from my Data layer.

I want to use a validation framework such as xVal. It seems common wisdom that your model should contain your validation rules. My question is how do you validate part of the model (or various states)? For instance, I have a User object that has username, password and other properties. I have a Login action where I’d like to make sure the Username and Password are provided. However, when I create a new user, I’d want more fields to be required. It seems weird to create a Login object in my model when I already have my User object.

Right now, my Login action is just taking a username and password parameter that are posted to it.

  • 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. 2026-05-11T03:23:31+00:00Added an answer on May 11, 2026 at 3:23 am

    You’re right that validation is usual in the Model layer. The problem is probably in your domain model — you have an idea of a User that isn’t valid until it has all that stuff in it.

    Think instead of a User that can be anonymous, or can be filled in. An easy way to think that out is to have User have an instance of a Credentials object; that’s also a good place to track permissions etc.

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

Sidebar

Related Questions

Trying to wrap my head around JTA and have arbitrarily chosen Bitronix as the
Trying to wrap my head around django forms and the django way of doing
I have been trying to wrap my head around this for a while now
I'm currently trying to get my head wrap around Cassandra/thrift with Erlang... I have
I am trying to wrap my head around items that will be displayed in
I have been trying to wrap my head around mvvm for the last week
I'm trying to wrap my head around threading, and I know that I may
Trying to wrap my head around the jQuery .not() function, and running into a
Im trying to wrap my head around MVVM. I understand a lot of it,
I'm trying to wrap my head around Arquillian and am just not fundamentally understanding

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.