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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:25:33+00:00 2026-05-27T02:25:33+00:00

I am currently working on a project as a noob when it comes to

  • 0

I am currently working on a project as a noob when it comes to WCF\EF, using entities\tables created by another developer. I am usually pretty quick at catching up on new things, and I have the small basics down on how to use the datacontext to do your work in the application. My only problem is that the context created by the other developer don’t seem to be working, and I am unsure if the problem is with the model, the mappings, or the table.

Here is the basic premise of the project.. The developer created the database first, and then POCO objects with EF mappings for those objects, to the tables. He did this to ensure ease of upgrade later on with newer columns\tables. On the creation of the model, the mappings are substituted instead of EF’s mappings by overriding the OnModelCreating event, and adding the mappings to the model builder for each of the objects. Then the next thing that seems to happen after this is a NullReferenceException:

at System.Data.Entity.ModelConfiguration.Configuration.Properties.Navigation.NavigationPropertyConfiguration.ValidateConsistency(NavigationPropertyConfiguration navigationPropertyConfiguration)
at System.Data.Entity.ModelConfiguration.Configuration.Properties.Navigation.NavigationPropertyConfiguration.Configure(EdmNavigationProperty navigationProperty, EdmModel model, EntityTypeConfiguration entityTypeConfiguration)
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigureAssociations(EdmEntityType entityType, EdmModel model)
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EdmEntityType entityType, EdmModel model)
at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntities(EdmModel model)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

My main problem is, I can’t seem to find any information that would lead me to the cause of this by searching, as I can’t seem to find other people that have had this problem in this particular method. I would include code snippets of the mappings\POCOs\usage, but I am under an NDA for this project, and I don’t know to what extent that extends. My main problem is if someone can just tell me what area I should be looking at for the cause of this problem… POCO setup, Mappings setup, or Tables setup? Any help would be greatly appreciated! I have looked over all the code myself several times, but can’t seem to spot anythings, so some focus would help. I will try to help with what I can.

  • 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-27T02:25:34+00:00Added an answer on May 27, 2026 at 2:25 am

    OK. I am posting back here so if people encounter a problem within this method later in their environment, they can figure out where it lies.

    Since it compiled fine, and the POCO’s looked fine, I was pretty sure the error was with the mappings. I went throught the context in the project, and commented out all of the DbSet<x> declarations, as well as the mapping configurations for each one. I then went through one by one, uncommenting the dbset and configuration for an entity. The context instantiation would then succeed, and I would do the next entity. I was finally left with 2 related entities sharing a one-to-one relationship, that when uncommented, the final datacontext instantiation would fail.

    The relationship mappings were not defined correctly between the two items. This link helped me out Associations in EF Code First

    This appears to have errored because it could not navigate the navigationproperties when validating the model, so I am pretty sure the error can occur for more reasons than just this, I just happened to be the first to find it in this method.

    Hope this helps!

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

Sidebar

Related Questions

I am currently working on a project that hosts WinForms designer. I am using
I'm currently working on a project using the current if statement and i'm sure
I'm currently working on a project using Flask and Google App Engine . Calling
I'm currently working on a project that's using the Dropkick.js plugin to style select
I am currently working on a project which is using Apache HttpClient 4.1.2 and
I am currently working on a project developed using Zend Framework, based on the
I'm currently working on a project using Django 1.3 with the Django-Celery app. It's
I'm currently working on a project at work using the HTML5 Drag and Drop
I'm currently working on project with Haskell, and have found myself some trouble. I'm
I am currently working on a project and my goal is to locate text

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.