0

I have a two EXEs:

   ImportJob.EXE

   Validator.EXE

Each EXE calls a library:

  Validation.DLL

That all works great. The next thing I need to do is to add some logic from my data layer to my Import Job. The data layer is called Data.DLL. In order to include Data.DLL, I need to reference it in Validation.DLL.

The problem is that I don't want to distribute Data.DLL with Validator.DLL.

I can't compile unless I reference DATA.DLL so I can't just put a try/catch around my call because the reference will be missing:

From Validation.DLL:

 try 
    { 
        results = DATA.RunMethod();
    }
catch (Exception e)
    {
        // 100% okay with eating it
    }

I would super appreciate any advice or ideas.

Missy
  • 1,286
  • 23
  • 52

1 Answers1

1

Theoretically if you use Dependency Injection you can

  1. create project IData having interfaces only exactly to be implemented by your Data.dll classes
  2. create project NullData having classes the implement the interfaces with your exceptations and handling for the case when there is no Data.dll
  3. have your Data.dll implement the interfaces in IData
  4. replace the calls for the classes from Data.dll with calls to their interfaces

you then register the services either from NullData.dll or Data.dll based on the existence of the dll

Dharman
  • 30,962
  • 25
  • 85
  • 135
Modar Na
  • 873
  • 7
  • 18