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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:04:17+00:00 2026-06-05T20:04:17+00:00

Here is one of my Entityclasses: public class Customer { public int Id {

  • 0

Here is one of my Entityclasses:

public class Customer
{
    public int Id { get; set; }
    [Required]
    public int CustomerNumber { get; set; }
    [Required]
    [StringLength(50)]
    public string Prename { get; set; }
    [StringLength(50)]
    public string Surname { get; set; }
    public DateTime? Birthday { get; set; }
    public bool Active { get; set; }
    [Column(TypeName = "image")]
    public byte[] Image { get; set; }
}

After adding objects, I used the following line to save my changes:

((IObjectContextAdapter)context).ObjectContext.SaveChanges();

Everything worked fine, I was able to save a Customer..

Well now I must change that to the following:

context.SaveChanges();

I found out, that my previous line didn’t validate, only the second does, because its inheriting from DbContext

Now I have the problem that I cannot save a Customer anymore, the reason is, that I got an exception at the context.SaveChanges(); Line.

In the EntityValidationError I found the following Error: ErrorMessage = “The field Image must be a string or array type with a maximum length of ‘4000’.”
Well know my question is, how can I avoid validating this one entity only..? I know that there is a possibilty to avoid validating a whole entity, but thats not the idea. I hope someone can help me, I’m stuck at this one..

  • 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-05T20:04:18+00:00Added an answer on June 5, 2026 at 8:04 pm

    You could use a CustomValidationAttribute. Here is an example.

    You could make a method that just returns success.

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

Sidebar

Related Questions

Here one more basic question asked in MS interview recently class A { public
I have two entity classes: public class Invoice { public int ID { get;
I hope to get help here one more time. Here is my sample input
I hope to get help here one more time. Here is my sample input
Assume the following entity classes: public class Player { public virtual int ID {
<span class=here one-two-sdfs test>click1</span> <br /> <span class=here one-two-3er te3st>click2</span> <br /> <span class=here
Here is one I am working on: var fStep = from insp in sq.Inspections
Interesting one here. I have an ASP.NET 1.1 project that contains a web service
Can any one here suggest a good Dojo and JSON book or a site
Having another tough one here guys, basically I would like to check if a

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.