jason
jason

Reputation: 2259

How do I expose class libraries referenced by a class library, which is then included as a project reference in Visual Studio?

I'm working on my first Visual Studio 2010 solution that has multiple projects. I'm finding myself with some project reference confusion.

I'm trying to create an API project that exposes methods to clients. This API references a project containing my business models. I want other projects to be able to reference the API dll and get access to those business models. Currently, in my test project that tests the API, I have to make a reference to both the API project and the business model project separately.

Any thoughts?

Upvotes: 0

Views: 1026

Answers (2)

to StackOverflow
to StackOverflow

Reputation: 124794

Currently, in my test project that tests the API, I have to make a reference to both the API project and the business model project separately

This is normal, you need to reference both if your "API" project exposes Types from your "business model" project.

Upvotes: 0

Jesse Carter
Jesse Carter

Reputation: 21197

If you want to incorporate an N-Tier model into your application by which business models are only exposed to a single layer you are going to have to create methods and objects at the API level which are responsible for interacting with the business layer and then communicate this information back to your tests or to any other project/person that wishes to plug into your API.

If you are trying to create a level of abstraction between your business models and other projects then you definitely don't want to directly expose your business model logic to everything. Kind of defeats the purpose.

The Wikipedia article on multi-tier architecture might prove helpful to you.

Upvotes: 1

Related Questions