I am currently working on a project as noob when it comes to WCF \ EF using entities \ tables created by another developer. I usually caught up with new things pretty quickly, and I have a small base for how to use the datacontext to do your work in the application. My only problem is that the context created by another developer does not seem to work, and I'm not sure if the problem is with the model, mappings, or table.
Here is the basic premise of the project. The developer first created a database, and then POCO objects with EF mappings for these objects into tables. He did this to simplify updating later with new columns / tables. When creating a model, the mappings are replaced by the OnModelCreating event instead of the EF mappings and the mappings are added to the model builder for each of the objects. Then the next thing that seems to happen after that 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 that I can not find any information that would lead me to the reason for this by searching, because I can not find other people who had this problem in this particular method. I would include code snippets from the \ POCOs \ use mappings, but I'm under the NDA for this project, and I donβt know to what extent this applies. My main problem is that someone can just tell me in which area should I look for the cause of this problem ... Setting up POCO, setting up mappings, or setting up tables? Any help would be greatly appreciated! I looked through all the code on my own several times, but I donβt seem to see anything, so some tricks will help. I will try to help with what I can.
source share