Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

IDE services

  • Last UpdatedJul 23, 2024
  • 2 minute read

A service is any reusable functionality provided by the IDE or an extension module, which can be shared by all extension modules. The IDE provides some default services to facilitate extension development. An IDE extension should register its service with the service pool in order to make it available to the IDE and its extensions. Once a service is registered, it will be available for consumption.

As explained in the section “Creating a Command Extension”, all IDE extensions must implement “IaaSnapin” interface. IDE calls the extension’s “Initialize” method implementation in this interface and sets its “IaaServiceProvider” site, when the extension is loaded. The extension can use the site to access global service pool. The “IaaServiceProvider” interface has three methods for registering, un-registering and accessing services, two events to subscribers when a service is added or removed; and one indexer for ease of usage as explained below.

  • RegisterService – The method allows extension register its service to the IDE and makes it available in the global service pool.

  • UnregisterService – The method allows extension to un-register its service and pulls it out of the global service pool.

  • GetService – The method allows extension query for a specific service from the IDE global service pool.

  • ServiceAdded – The event to notify subscribers when a service is added to the service pool.

  • ServiceRemoved – The event to notify subscribers when a service is removed from the service pool.

  • Services – The indexer is alternative to “GetService” method with ease of usage.

The following is an example of how a typical extension would register its service with the IDE and make it available in the global service pool.

[aaPlugin("907162B9-F0AE-40d0-92C9-79E3DAB04D43")]

public class MyClass : IaaSnapin, IaaCommandTarget, INewInterface

{

// TODO: Class, IaaCommandTarget and INewInterface implementation.

void IaaSnapin.Initialize(IaaServiceProvider site)

{

if(site != null)

{

m_site = site;

m_site.RegisterService(typeof(INewInterface), this);

}

}

}

The following is an example of how another extension would consume a service registered by the previous extension.

INewInterface mi = m_site.Services[typeof(INewInterface)] as INewInterface;

if(mi != null)

{

// TODO: Use INewInterface service.

}

TitleResults for “How to create a CRG?”Also Available in