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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:35:31+00:00 2026-06-11T01:35:31+00:00

In Entity Framework 4.3.1 I had the following Models, and they worked fine: public

  • 0

In Entity Framework 4.3.1 I had the following Models, and they worked fine:

public class BaseUser
{
    [Key]
    [MaxLength(100)]
    public string Username { get; set; }
}

[Table("AppUser")] // Ensures EF Code First uses Table-per-Type
public class AppUser : BaseUser
{
    [MaxLength(200)]
    public string About { get; set; }
}

After upgrading to EF 5.0, I get the following exception when I try to run this application and access the associated DbContext:

EntityType 'AppUser' has no key defined. Define the key for this EntityType.

How do I resolve this issue? This appears to be a regression.

  • 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-11T01:35:32+00:00Added an answer on June 11, 2026 at 1:35 am

    This Exception is caused by mixing EF versions.

    BaseUser was defined in a shared Project that uses EF 4.3.1. AppUser was in a Project using EF 5.0. This confusing Exception is a result of trying to inherit from a model in a Project that has not been upgraded to EF 5.0. Splitting the shared project and upgrading the one referenced here resolved the issue.

    If others run into this it’s worth pointing out that upgrading is a bit awkward. Since NuGet doesn’t seem to notice the need for an upgrade, it lets you install EF 5.0 on top of it, lists the new version as 4.4 after install, and requires you to include both of the following using statements in your Model classes since some of the EF data annotations were moved (redirected), and some were not:

    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working with Entity framework and had a couple of questions on timeouts. This following
I had connection strings for entity framework edmx, which is usual EF connection string
in the mvc 3 music store example they do the following. Public Class Album
Would be nice if the Entity framework had the ADO.Net equivalent of DataRow.HasErrors. I'm
I´ve not had much contact with Entity Framework yet and therefore I´d like to
(using Entity Framework) when i write : IEnumerable<string> q = customers /*EF entity*/ .Select
The Entity Framework has a function with this signature: public EntityTypeConfiguration<TEntityType> HasKey<TKey>(Expression<Func<TEntityType, TKey>> keyExpression);
I've had a look at the Entity Framework 4. While generating code for the
Hey everyone, I had a couple of questions relating to the .NET Entity Framework
Our project had implemented Entity framework and we were floating the entity object type

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.