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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:33:18+00:00 2026-05-20T09:33:18+00:00

Update : It turns out I had (hidden away in my POCO objects) a

  • 0

Update: It turns out I had (hidden away in my POCO objects) a property with an abstract type. Removing this property solves the issue.


I’m trying to have a model-first scenario with entity framework 4 ctp 5 generate my database (currently using a SQL Server CE4 backend, but I can reproduce on a Sql Server 2008 backend) from my model.

I think I might have messed up my model definition somehow, but I can’t seem to figure out how and the error message leaves me none the wiser.

My DbContext object is set up as such:

public class MyDb : DbContext
{
    public MyDb()
    {
        // Apply forced recreation tactics for now
        DbDatabase.SetInitializer<MyDb>(new CreateDatabaseIfNotExists<MyDb>());
    }

    public DbSet<UserAccount> UserAccounts { get; set; }
    public DbSet<OtherData> OtherDatas { get; set; }
    // etc
}

When I query it (as follows):

        MyDb db = new MyDb();
        var matchingAccount = from user in db.UserAccounts where user.Email == email select user;
        return matchingAccount.SingleOrDefault();

I get the following error:

[ArgumentNullException: Value cannot
be null. Parameter name: entitySet]
System.Lazy1.get_Value() +9591079
System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
+371 System.Data.Entity.Internal.InternalContext.Initialize()
+16 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type
entityType) +15
System.Data.Entity.Internal.Linq.InternalSet
1.Initialize()
+62 System.Data.Entity.Internal.Linq.InternalSet1.get_Provider()
+15 System.Data.Entity.Infrastructure.DbQuery
1.System.Linq.IQueryable.get_Provider()
+13 System.Linq.Queryable.Where(IQueryable1
source, Expression
1 predicate) +63

However, the first time I build, this is the specific error:

[ArgumentNullException: Value cannot
be null. Parameter name: entitySet]
System.Data.Entity.ModelConfiguration.Utilities.RuntimeFailureMethods.ReportFailure(ContractFailureKind
contractFailureKind, String
userMessage, String conditionText,
Exception innerException) +970860
System.Data.Entity.ModelConfiguration.Edm.Db.Mapping.DbDatabaseMappingExtensions.GetEntitySetMapping(DbDatabaseMapping
databaseMapping, EdmEntitySet
entitySet) +147
System.Data.Entity.ModelConfiguration.Edm.Services.EntityTypeMappingGenerator.Generate(EdmEntityType
entityType, DbDatabaseMapping
databaseMapping) +206
System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(EdmModel
model, DbDatabaseMapping
databaseMapping) +253
System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel
model) +168
System.Data.Entity.ModelConfiguration.Edm.EdmModelExtensions.GenerateDatabaseMapping(EdmModel
model, DbProviderManifest
providerManifest) +233
System.Data.Entity.ModelConfiguration.ModelBuilder.Build(DbProviderManifest
providerManifest, DbProviderInfo
providerInfo, Boolean validateModel)
+280 System.Data.Entity.ModelConfiguration.ModelBuilder.Build(DbConnection
providerConnection) +173
System.Data.Entity.Internal.LazyInternalContext.CreateModel()
+61

  • 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-05-20T09:33:19+00:00Added an answer on May 20, 2026 at 9:33 am

    the

     // Apply forced recreation tactics for now
            DbDatabase.SetInitializer<BudgetnetDatabase>(new CreateDatabaseIfNotExists<BudgetnetDatabase>());
    

    should only be applied once in your project. i suggest you move this code out of the class.

    is there more to your db context?

    any configuration?

    is it possible to see BudgetnetDatabase ?

    we will also need to see the poco objects.

    is the database getting create at all?

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

Sidebar

Related Questions

Update: So, this turns out to have nothing to do with Tortoise SVN. I
Update : this is more-or-less a dupe , and it turns out to be
Update: Check out this follow-up question: Gem Update on Windows - is it broken?
UPDATE: Turns out my code works. Browser was caching previous failed response. Thanks for
Update: Now that it's 2016 I'd use PowerShell for this unless there's a really
I thought I was fairly good with C++, it turns out that I'm not.
Update: Solved, with code I got it working, see my answer below for the
Update: giving a much more thorough example. The first two solutions offered were right
UPDATE: Focus your answers on hardware solutions please. What hardware/tools/add-in are you using to
Update : Looks like the query does not throw any timeout. The connection is

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.