'The entity type is not part of the model for the current context.'

Posted: January 09, 2019 at 3:41 PM Quote #217845
Hello!  

We have a plugin that we are moving from our 3.6 site to our 4.0 site.  I have been getting the error `The entity type JDECarrierCodeRecord is not part of the model for the current context.` on this code:


public virtual IPagedList<JDECarrierCodeRecord> GetAllCarrierCodes(int pageIndex = 0, int pageSize = 30)
        {
            
                var query = from pnc in _pncRepository.Table
                            orderby pnc.CarrierCode, pnc.CarrierName
                            select pnc;

                var records = new PagedList<JDECarrierCodeRecord>(query, pageIndex, pageSize);
                return records;
            
        }


After lots of struggle, we realized that this code works perfectly on my coworker's machine; however, I get the error on mine.  The environments really should be the same -- and I've been working to verify that.  None of the common answers around Google are helpful because this code works fine on another machine.  It's something on my localhost only.  Unfortunately, my localhost is the system from which we build and deploy things to our dev server, so I need to get it working sparkly on here.  

Can anyone think of some places to check for a cause for this?  Maybe some dependency like Entity Framework is out of order, but I don't see anything.

Thanks!

Jeremy
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 09, 2019 at 11:10 PM Quote #217854
Does it run fine without the plugin?


This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Lam Woon Cherk
https://www.pronopcommerce.com

Sign up to my mailing list for tons of tips on nopCommerce: http://bit.ly/2fg5fMy

HINT: Upon signing up, you'll receive my e-book "nopCommerce Speed Optimization" on
how to make your nopCommerce websites score A in Google PageSpeed Insights
Posted: January 10, 2019 at 7:52 AM Quote #217871
Oh, yeah.  Everything runs fine.  Even other plugins that are using the same sort of code to do the same sort of thing work fine.  But this plugin in particular is failing on my machine.  I've uninstalled and reinstalled and cleaned and built and rebuilt and prayed and made mean faces at it.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: January 11, 2019 at 2:41 PM Quote #217920
I got this working, but the solution is still unsettling.  I just created a new directory and cloned the repo for the site from Git into the new directory.  Everything builds and works perfectly there.  I've been comparing the new folder to my existing folder, but I haven't found any relevant differences yet.  Can anyone think of anything I could look for?  I'm back in business now, but I'd love to know what happened so I could prevent it in the future.

Thanks!

Jeremy
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: yesterday Quote #217996
I currently have the same kind of problem. Did you reach any conclusion?
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: yesterday Quote #217998
Unfortunately, not really.  All I did was create a new directory on my localhost and then clone the solution again from Git.  Whatever was causing my issue was something in my localhost folder, so starting with a fresh copy from source control got me moving again.  I have never figured out what the problem in the old directory was, though.

Jeremy
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: yesterday Quote #218006
That's too bad. But thanks for the fast answer.

I'll keep at it.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.