I need an opinion on writing a managed (C#) wrapper for an unmanaged C++ DLL.
Let's say I have an object like this:
public class ManagedObject
{
public void DoSomethingWithTheObject()
{
}
}
and suppose that the DoSomethingWithTheObject() method has to make a call to the unmanaged DLL method.
Now there are two acceptable possibilities that come to my mind:
public void DoSomethingWithTheObject()
{
DllWrapperClass.DirectCallToUnmanagedMethod(some_value_type);
}
and
public void DoSomethingWithTheObject()
{
DllWrapperClass.MethodName(this);
}
What I'm basically asking is if
the wrapper class should merely be a wrapper to the unmanaged methods and all objects call those methods directly
the wrapper class should be neatly integrated with the objects and hide as much of the "unmanaged way" of working as possbile
I'm leaning towards the second option, but I'd like to hear some other opinions as both ways have their own pros and cons.