02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ServiceLocator Class<br />

The user may control how services are instantiated through the Lazy property. If the<br />

Lazy property is set to true then services wrapped in a ServiceCreatorCallback will<br />

be added without being instantiated. If Lazy is set to false, then wrapped services will be<br />

unwrapped and instantiated before being added. Changing the property to false after<br />

services have been added will result in those services being immediately instantiated.<br />

The ServiceLocator class referenced by CoreSystem.Services provides a method<br />

to remove services. It is usually not required that services be removed. A service may be<br />

removed entirely or its removal may be restricted to a specific type of object.<br />

...<br />

// Remove all use of the map renderer service<br />

CoreSystem.Services.RemoveService(typeof(IMapRenderer));<br />

// Remove map renderer service that applies to XYZObject.<br />

CoreSystem.Services.RemoveService(typeof(XYZObject),<br />

typeof(IMapRenderer));<br />

...<br />

3-74 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!