NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Type Library to Metadata conversions

The COM method signatures differ from the NGWS runtime signatures in the following ways:

The class defined in the metadata derives from System.Object, and implements all of the interfaces which the classic COM object implements. While the method definitions appear on the class, they are flagged as MethodImpl. This means that when you create an instance of this class, you can call the methods inherited from Object but you cannot call the interface method implementations directly. Instead, you can call them through an interface pointer acquired from the class. This is analogous to the way classes and interfaces work in classic COM.

This implies that the following code will NOT work (where CFoo wraps a classic COM server implementing IFoo, which has a Bar method)

CFoo MyFoo = new CFoo; 
MyFoo->Bar();

This does work:

IFoo MyIFoo = (IFoo) new CFoo;

The wrapper classes that are created (like CFoo in the above example) do have a simple constructor which is implemented by the wrapper. We may call CoCreateInstance() during this constructor or defer creation of the classic COM object to another time (like the first method call). You should be prepared for ClassLoadException (or related exceptions) at any time.

Appendices