Lior Tal

Lior Tal

  • NA
  • 1
  • 4.3k

How to not leak out types from API

Aug 3 2010 5:54 AM

Hello all,
i'm currently writing a DLL using C# to enable communication and several other tasks with QC (Quality Center).
QC exposes functionality by supplying a COM DLL, which i'm referencing in my library.
 
Problem is, when i use my library in some other project, i would also need to reference the QC dll in order to have their types availalble.
An example would be:
Bug[] bugArray = QCManager.Query("some query");
Bug is a type defined in the Interop library, forcing me to add a reference to that DLL in my code.
 
My questions are:
1. What is the right thing to do in this scenario? should i just add the reference to both DLLs (mine & the COM one) and use it freely?
2. Should i implement another object (MyBug) that will basically be just a mirroring of the class defined in the COM dll ?
 
What is the right design decision on this case?
 
Comments will be appreciated,
Lior Tal

Answers (1)