ObjectContext is inaccessible due to its protection level

edited March 2012
Hi, I'm brand new to LINQ and LINQPad. I've set up an Entity Framework Custom Assembly Connection, and the connection works. The DB tables load in the upper-left pane and I can generate some basic queries from them. However, when I try to execute the queries, I get the message that "'MyEntityObjectContext' is inaccessible due to its protection level". I've googled this and searched stack overflow as well as the old O'Reilly forum, and cannot find anyone talking about this problem. I've tried obvious things like going into the designer file and setting the class's protection level from internal to public. No luck.

Any help? This seems to be the only thing standing in the way of me learning LINQ using my existing entity framework. Much obliged for any advice!

Comments

  • Changing the class's protection level from internal to public should definitely fix this. It has to be public because LINQPad is in a different assembly and needs to access it. Have you checked that the generated class is, in fact, public?
  • Doh. I created the connection using the debug mode DLL, but the solution was compiling in release mode (which it was not supposed to be). Changing the protection level from internal to public and then switching the build mode back to debug fixed the issue. Thanks for the help, Joe, I appreciate it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!