Thanks! Good suggestions, both.
I'm always looking for the "right" answer instead of just forging
ahead. Certainly for this app, I can import the source directly.
The proxy idea would help with extensibility so I could plug in other
dll's later. Then again, that may be naive thinking - each dll will
probably be different enough to require some rework.
Well, I suppose that depends. If the DLLs each provide an API that is
identical, in a way that would have made you think you could just use
an interface, then I'd think the proxy approach would be simple. It
would always just be a matter of taking the instance of the class
implemeted in the DLL, and calling the appropriate methods or
properties from the proxy class. All of the proxy classes would look
the same, even though they'd all be specific to the DLLs.
If your DLLs are somehow different, then I don't see how an interface
could have applied anyway. The whole point of an interface is that
each implementor provides exactly the same identically implemented API.
That said, I can certainly imagine a scenario where each DLL provides
almost the same API, but with trivial differences that would prevent an
interface from working even if you could just copy the DLL source into
your project. In that case, using a proxy would allow you to not only
wrap the DLL without copying the source to your project, it would
provide a convenient location to handle whatever API conversion needs
to happen.
It all comes down to just _how_ different each DLL is. But if each DLL
is similar enough that you can represent the functionality with a
single interface (whether or not the DLL itself exposes the exact same
interface), then they are similar enough for a proxy to work.
Would this approach be the provider model I hear about from MS?
I don't know. I don't know what the "provider model" that you're
hearing about from MS is.
Pete