C++
AcDbDatabase* workingDatabase() const;
Description
This method may not be overridden.
workingDatabase() may be called by the host application, by database code, and by both dependent and independent ObjectARX applications. When AutoCAD is the host application, this is equivalent to the old acdbCurDwg() API, and will return a pointer to the primary database open in whichever document (window) has focus. In other host applications, the meaning of working database will be application-defined.
Note that all RealDWG host applications must instantiate and set at least one AcDbDatabase to be the working database. Many areas of ObjectDBX code require a database to query for information. For example, if you make an AcDbEntity in memory, it may require default information from a database. It will take that information from the working database.
If you want to create some form of Multiple Drawing Interface (MDI) application, where your concept of a document includes one or more databases, you'll need to make sure that you update the working database in synch with whatever document switching scheme your application implements.