02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Data Management<br />

IWorkspace Interface<br />

The DataManager Workspace property provides access to the active workspace through<br />

the product family implementation of the IWorkspace interface. IWorkspace allows<br />

you to add your custom objects to the system so that they may be retrieved for use by<br />

other objects and services. It also provides properties to uniquely identify the workspace<br />

and its default data source. IWorkspace is defined as:<br />

public interface IWorkspace<br />

{<br />

void AddWorkspaceState (object state);<br />

IEnumerable Find () where T : class;<br />

void RemoveWorkspaceState (object state);<br />

}<br />

IDataSource DefaultSource { get; }<br />

Guid Guid { get; }<br />

The AddWorkspaceState method will add an object to the workspace. The object<br />

added must be serializable or AddWorkspaceState will throw an exception.<br />

The Find method is used to locate objects of a particular type in the workspace. Find<br />

will return an enumerable list of all objects of the specified type. You cannot find objects<br />

provided by the product family project.<br />

The RemoveWorkspaceState method will remove an object from the workspace. The<br />

object to remove is provided as an argument to the method.<br />

private void AddXYZClick(object sender, EventArgs e)<br />

{<br />

// Create a new XYZ object.<br />

XYZObject xyz = new XYZObject();<br />

}<br />

// Add the object to our workspace.<br />

DataManager.Workspace.AddWorkspaceState(xyz);<br />

// Method to find the XYZ objects in our workspace<br />

private void FindXYZObjects()<br />

<strong>Schlumberger</strong> Private<br />

<strong>Ocean</strong> Core 3-65

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

Saved successfully!

Ooh no, something went wrong!