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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:55:01+00:00 2026-06-11T00:55:01+00:00

After upgrading to EF 5 I keep getting Validation failed for one or more

  • 0

After upgrading to EF 5 I keep getting Validation failed for one or more entities. See 'EntityValidationErrors' property for more details' in a particular instance of my code.

It turns out I have a field that is a NVARCHAR nullable in the database and it marked has [Required] with Data annotation in a partial class. The field in question is set to null programmatically. This worked fine in EF4 as it was validated against the database model (NVARCHAR nullable).

I need to keep that field marked as [Required] because it also takes user inputs in other instances.

What are my options? Can I ignore that attribute/validation error right before SaveChanges()?

  • 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-11T00:55:03+00:00Added an answer on June 11, 2026 at 12:55 am

    This is why it is strongly recommended that you use View models, rather than passing your entities directly to the view. Your view and data model have different requirements, and trying to use the same model with validation causes problems.

    Instead, remove the required attribute from your data model and create a View model that has the required on it, then use something like AutoMapper to map between them.

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

Sidebar

Related Questions

After upgrading to ReSharper5 it gives me even more useful tips on code improvements.
We are getting this error after upgrading to NHibernate 2.1. [QueryException: Cannot simultaneously fetch
After upgrading from Cake 1.3 to 2.0 I I'm getting missing table errors for
After upgrading the NHibernate and FluentNHibernate DLLs in a project, I'm now getting a
After upgrading my ASP MVC from 3 Preview to 3 Beta I see strange
after upgrading from grails 1.3.7 to 2.0.1 i'm getting follwong strange exception when validating
After upgrading to Android 2.3.4, I am getting following exception: javax.net.ssl.SSLException: Read error: ssl=0x*:
After upgrading a project from Delphi 2007 to Delphi 2009 I'm getting an Unknown
After upgrading to JSF2 (probably) one special accessor in an .xhtml file generates IllegalArgumentExceptions
After upgrading my copy of xcode from 3.2.2 to 3.2.3, I am getting over

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.