When AutoCAD loads a
.NET dll, it queries the application's assembly for an ExtensionApplication
custom attribute. |
|
If this attribute is
found, AutoCAD sets the attribute's associated type as the application's
entry point. This class specified in the attribute will need to implement the
IExtensionApplication interface and this interface has Initialize and
Terminate functions. We can use the Initialize function to set up our
application such as adding the context
menu. The terminate function will be called when the .NET assembly is
unloaded. This will happen when AutoCAD is shut down as there is not an
straight forward way to unload a .NET module. Also using the
ExtensionApplication attribute can save time loading a large .NET module
because AutoCAD will not need to check all of the objects in the assembly, to
find out if there is a class that is the ExtensionApplication. |
|