MVC + EF Application with N-Layers

0

I'm working on an MVC project with EF 6, and I'm having a rather curious problem, in some ViewModel, the object that comes from my DbContext does not seem to persist and I get the generic message System.NullReferenceException.

The curious thing I say is because this occurs in a few layers, I have already reviewed my mapping in DbContext, compared to those that are working and I can not find a possible cause of the problem.

This project has several separate layers:

  

Software.Data

     

Software.Domain

     

Software.Services

     

Software.Core

     

Software.Web

My DbContext is initialized in Core, so when we need to call some method we do the following:

  

ProductCoreController productCore = new ProductCoreController ();

     

viewModelProducts.Product = productCore.ReturnProduct (id, IDLoja);

Some views work normally, but in this particular case when I move to my Partial the Model with objects already loaded, it persisted within the partial but on my first call of output it accuses the error.

Has anyone had the problem or similar, what could I check the most or may have forgotten?

    
asked by anonymous 23.06.2015 / 02:07

0 answers