DB-level External Applications

DB-level External Applications

Database-level add-ins are External Applications that do not add anything to the Revit UI. DB-level External Applications can be used when the purpose of the application is to assign events and/or updaters to the Revit session.

To add a DB-level External Application to Revit, you create an object that implements the IExternalDBApplication interface.

The IExternalDBApplication interface has two abstract methods, OnStartup() and OnShutdown(), which you override in your DB-level external application. Revit calls OnStartup() when it starts, and OnShutdown() when it closes. This is very similar to IExternalApplication, but note that these methods return Autodesk.Revit.DB.ExternalDBApplicationResult rather than Autodesk.Revit.UI.Result and use ControlledApplication rather than UIControlledApplication.

Code Region: IExternalDBApplication OnShutdown() and OnStartup()

public interface IExternalDBApplication
{
        public Autodesk.Revit.DB.ExternalDBApplicationResult OnStartup(ControlledApplication application);
        public Autodesk.Revit.DB.ExternalDBApplicationResult OnShutdown(ControlledApplication application);
}

The ControlledApplication parameter provides access to Revit database events. Events and Updaters to which the database-level application will respond can be registered in the OnStartup method.