Referencing Projects Question

G

Guest

Hello All:

I need some help understanding project references. I have two projects that
are giving me grief. They are called Business and Messaging.

The Business proejct contains classes that handle the business layer. These
handle database calls that return data from the system's databases. It
contains classes like Policy, Unit and Vehicle. Currently, the Business
project has no reference to the Messaging project.

The Messaging project handles calls to a third-party system and uses
Business' classes (Unit, Policy and Vehicle). For example, The Messaging
class will use a Business.Vehicle class which holds information about a
Vehicle to request information from the third-party system about that
vehicle. Currently, the Messaging project has a reference to the Business
project.

If I delete the Messaging project's reference to the Business project and
create a reference to the Messaging project in the Business project, the
Messaging classes' method calls can not use the Policy, Unit or Vehicle
classes. An example of the message that is displayed is "Type
Business.Policy is not defined."

Why?

Finally, I need to architect this such that the Business project references
the Messaging project. I want to be able to pass Busienss classes to
Messaging classes so that the Messaging classes can retrieve data from the
third-party and pass that data back to the Business classes (i.e. act as a
database layer). Does anyone have an idea how I could do this?

I hope that I have been somewhat clear.

TIA,
 
G

Guest

If I delete the Messaging project's reference to the Business project and
create a reference to the Messaging project in the Business project, the
Messaging classes' method calls can not use the Policy, Unit or Vehicle
classes. An example of the message that is displayed is "Type
Business.Policy is not defined."

I believe, you have already identified that a circular
reference between projects is not allowed. Meaning ,if bussiness references
messaging, messaging cannot have a refernce back to bussiness.
I want to be able to pass Busienss classes to
Messaging classes so that the Messaging classes can retrieve data from the
third-party and pass that data back to the Business classes (i.e. act as a
database layer). Does anyone have an idea how I could do this?

while waiting to hear from experts, One simple method to handle this
is to define your data structure (c# struct) (the data you pass between
message & bussiness) in a seperate proj so both message & bussiness can
reference and pass it between calls.. Doesnt hurt if used in small projects.
I am sure there will be another systematic, efficient design approch...
 
G

Guest

Sreejith,

Thanks for your reply. The idea was to remove the Busienss reference from
Messaging and have in its place a Messaging reference in Business.

Joe
 
B

Bruce Barker

for a project to use classes defined in another project, it needs a
reference. if you want business to reference messaging, and messaging to use
clsses defined in business, yo have two options:

1) merge them into 1 project.
2) create a third project (ref'd by both business and message) that defines
the shared classes. the best approach whould be to define abstact classes
here, and allow the business layer to implement it.

-- bruce (sqlwork.com)
 
G

Guest

Bruce,

How would option 2 work? Would you please give an example showing how to do
this or do you know of an example online soimewhere?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top