我的解决办法包括两个项目:
- a class library project (named as
DataAccess
) that defines a class (named asMyContext
) inheriting fromDbContext
. AsDbContext
is defined inEntityFramework.dll
assembly, I need to add a reference to this assembly into this class library project. I have no confusion in this mechanism. - a console application project (named as
Tester
) that consumes theDataAccess
class defined in the class library above. Adding a reference to the assembly of the class library above is understandable. Unfortunately, I cannot compile the solution until I add a reference toEntityFramework.dll
into this console application.
Why do we need to add a reference to an assembly, from which a class library project inherits, into a consumer project?
In my mental model, it is enough to only add a reference to DataAccess
project assembly into Tester
project and the chained references should be done automatically.