How Do I Add an Interface to My Provider?

Determine which object you want to add the interface to (usually data source, rowset, command, or session objects created by the ATL Provider Wizard). It is possible that the object you need to add the interface to is one that your provider does not currently support. In that case, run the ATL Object Wizard to create the object (right-click in the Project Workspace window ClassView pane and choose New ATL Object).

If you created a new class to support the interface, make the object inherit from that class. For example, you might add the class IRowsetIndexImpl to a rowset object:

template <class Creator>
class CAgentRowset :
public CRowsetImpl< CAgentRowset<Creator>, CAgentMan, Creator>,
   public IRowsetIndexImpl< … >

Add the interface to the COM_MAP in the object using the COM_INTERFACE_ENTRY macro. If there is no map, create one. For example:

BEGIN_COM_MAP(CAgentRowset)
     COM_INTERFACE_ENTRY(IRowsetIndex)
END_COM_MAP()

For the rowset object, chain the map of its parent object so that the object can delegate to the parent class. In this example, add the COM_INTERFACE_ENTRY_CHAIN macro to the map:

BEGIN_COM_MAP(CAgentRowset)
     COM_INTERFACE_ENTRY(IRowsetIndex)
     COM_INTERFACE_ENTRY_CHAIN(CRowsetImpl)
END_COM_MAP()