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

I'm trying to wrap my head around something that I can't seem to figure
I'm trying to wrap my head around this task and wondering if there is
Trying to wrap my head around perl's Autovivification and based on what it sounds
Trying to wrap my head around perl's Autovivification and based on what it sounds
Im trying to wrap my head around this, using Jquery I want to browse
I am trying to wrap my head around symfony's user authentication. Need advice on
I'm trying to wrap my head around closures in Javascript. Here is an example
I'm trying to wrap my head around what the C# compiler does when I'm
I am trying to use geom_point to illustrate the count of my data. I
I am trying to implement a trie data structure in F#. I am having

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.