DraganB
DraganB

Reputation: 1138

Can't see dbContext class from core class library in .NET Core

In my solution I have a .NET Core project and a class library. The class library is a layer for communicating with a database. I'm getting the error "OrderDataContext is inaccessible due to its protection level", even if I add a reference.

OrderDataAcces is my class library where I have OrderDataContext class, and OrderWebApi is my .net core class, where I defined connectionString in startup.cs:

Added reference

Upvotes: 0

Views: 180

Answers (1)

Christophe
Christophe

Reputation: 53

Add a reference to OrderDataAccess Library is not enough to solve your problem.

Your OrderDataContext class is probably not marked as public.

You probably have "class OrderDataContext" instead of "public class OrderDataContext".

Upvotes: 1

Related Questions