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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:24:40+00:00 2026-06-09T16:24:40+00:00

I just set about updating a project from Entity Framework 4.3.1 and .NET 4

  • 0

I just set about updating a project from Entity Framework 4.3.1 and .NET 4 to Entity Framework 5.0 and .NET 4.5. I updated the .NET version first, and ensured that I’m referencing EF 5.0.0.0 rather than the .NET 4 compatible 4.4.0.0.

I have a class structure like

public class MyBase
{
    [NotMapped]
    public bool MyProperty { get; set; }
}

public class MyDefinition : MyBase
{
    // Some other properties
}

When I attempt to load some MyDefinition instances

using (MyContext ctx = new MyContext())
{
    ctx.Configuration.AutoDetectChangesEnabled = false;
    ctx.Configuration.LazyLoadingEnabled = false;
    ctx.Configuration.ProxyCreationEnabled = false;

    var defs = from def in ctx.MyDefinitions.AsNoTracking() select def;

    foreach (MyDefinition def in defs) // <-- Exception here
    {
        // Do stuff
    }
}

I get a SqlException

Invalid column name ‘MyProperty’.

It is as if NotMapped is respected for purposes of determining whether the existing schema is valid, but the SELECT generated by EF 5 expects there to be a MyProperty column.

The base class and derived class are defined in different assemblies. Both assemblies were carefully checked to ensure they reference EF 5.0.0.0 and target .NET 4.5.

Intellisense claims that NotMapped is System.ComponentModel.DataAnnotations.Schema.NotMapped

How can I prevent EF 5 from selecting that non-existent column?

  • 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-09T16:24:42+00:00Added an answer on June 9, 2026 at 4:24 pm

    D’oh!

    I also updated to VS 2012 today. Something unrelated broke with a post-build event, which caused an earlier version of the assembly containing the base class to be available to the derived class. Fixing the post build event resolved the issue.

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

Sidebar

Related Questions

The location text from Twitter could be just about anything. Sometimes Twitter clients set
I have just set about the task of stripping out HTML entities from our
just set up a simple project to test the functionality of the maven exec
I have a CRON job php script that I just set up not too
I just set up Nginx for the first time, having liked what I read
I've been making my first ASP.NET Visual Studio website and I have just started
I just set up JDK 7 on my PC running Windows 7 and created
I just set up IDE env for Python 3. I was wondering how I
I just set up a simple virtual server with Debian netinst. Now I want
I just set up the Parallel Nsight debugging environment and started remote debugging my

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.