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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:13:36+00:00 2026-06-13T04:13:36+00:00

I reckon this should be simple for experienced programmers but here it goes. I

  • 0

I reckon this should be simple for experienced programmers but here it goes. I am working on a project using entity framework code first.I have also enabled migrations and set to auto (Lovely feature).

I stupidly declared one of the datatype wrong in my entity class and now i realised that it wouldn’t work with what i was trying to do. Must have been the auto complete feature. But anyways, the field was nullable and now that i have changed it to what i want, it has set the field to “not null”.

Originally: public virtual Byte[] ImageData { get; set; }

Changed to: public virtual byte ImageData { get; set; }

Now that i have changed and built the solution, update-database -force will not work and throws an error that:

Cannot insert the value NULL into column 'ImageData', column does not allow nulls. UPDATE fails. The statement has been terminated.

Is there a Data Annotation i could use to set this field back to nullable?

eg: [DataType(DataType.Upload)]

I have looked through here for a considerable amount of time and i can’t seem to find what i am looking for.

  • 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-13T04:13:37+00:00Added an answer on June 13, 2026 at 4:13 am

    Change the property type to the nullable form byte?.

    public virtual byte? ImageData { get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been scatching my head about this - and I reckon it's simple but
It's all in the title; super-simple I reckon, but it's so hard to search
This is for uni homework, but I reckon it is more a generic problem
This is the first time I am working for a front-end project that requires
Code: @albums = @genres.each_with_index { |item,key| if item.keys.include?('Albums') break end } This should be
I reckon this will be quite trivial but I can't work out how to
I am intending to use the n-gram code from this article . The algorithm
Note there's a lot of code posted below but its mostly all the same,
I have a question very similar to this one but the answer does not
I'm creating a multi-tenant Asp.Net MVC 3 Web app, and using EF4.1 code first

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.