<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="docs.css"> <!--[if gte IE 5]> <link href="docs_ie.css" rel="stylesheet" type="text/css"> <![endif]--> </head> <body><div id="pagecontainer"><table><tr><td width="5"> </td><td><a name="ObjectManagerOverview"></a><br> <a name="outline139"></a><br><h1>3. Object Manager Enterprise Overview</h1><br> If you did not install the Object Manager Enterprise yet, please, return to <a href="FirstGlance.html#FirstGlance">FirstGlance</a> chapter and follow the installation instructions there.<br> Once the Object Manager Enterprise (OME) is installed you can see it in Visual Studio Tools menu:<br> <img border="0" src="OMN1.jpg" /><br> <br> You should also be able to see OME toolbar icons:<br> <img border="0" src="OMN_Tool.jpg" /><br> <br> <ul> <a name="outline140"></a><br><h2>3.1. Browsing the database</h2>In the <a href="First.html#First">previous chapter</a> we've learned how to create a new database and store objects in it. Let's create a new database and store some objects in it now:<br> <table width="100%" cellpadding="3" cellspacing="0" border="0"><tr><td class="lg"> <code>// storePilots<br> using(IObjectContainer db = Db4oEmbedded.OpenFile(YapFileName))<br> {<br> Pilot pilot1 = new Pilot("Michael Schumacher", 100);<br> db.Store(pilot1);<br> Console.WriteLine("Stored {0}", pilot1);<br> Pilot pilot2 = new Pilot("Rubens Barrichello", 99);<br> db.Store(pilot2);<br> Console.WriteLine("Stored {0}", pilot2);<br> }</code></td><td class="lg" align="left" valign="bottom" width=43><input type='button' class='button' value='Run' onclick='window.external.RunExample("com.db4odoc.f1.chapter3.OMEExample", "storePilots")' /></td></tr></table> <br> Now we can see the resultant database in the Object Manager. Please select Tools->Object Manager Enterprise->Connect (or use a shortcut button from the toolbar menu) and browse to ome.db4o file in your Local Application Data folder. (normally it is C:\Documents and Settings\[user name]\Local Settings\Application Data on Windows XP/2000, c:/Users/[user name]/AppData/Local on Windows Vista).<br> Once you've connected you will see a screen similar to this:<br> <img border="0" src="OMN_Pilot.jpg" /><br> <br> In this view you can see:<br> - Db4o Browser: window displaying the contents of the open db4o database<br> - Database Properties: window displaying the properties of the open database or the properties of the selected database class<br> - Build Query: windows allowing to build a query using drag&drop functionality<br> - Query Results: window to browse the results of the query execution<br> <br> The Db4o Browser window shows that there is 1 class in the database (Pilot), which contains 2 fields: _name and _points. In the Property Viewer you can see more information about the class fields. You can also change "Indexed" field and add the index to the database by pressing "Save Index" button.<br> The filter panel on the top of the view allows easier navigation through the database with lots of different classes. You can use wildcard searches and benefit from the search history to make the selection faster. To further improve the navigation experience, you can create favourite folders and drag&drop frequently used classes into these folders.<br> <img border="0" src="OMN_Fav.jpg" /><br> <a name="outline141"></a><br><h2>3.2. Querying</h2>It is easy to retrieve all of the Pilot instances from the database: just right-click the Pilot class in Db4o Browser and select "Show All Objects". The list of the Pilot objects will be shown in the Query Result view:<br> <img border="0" src="OMN_Result.jpg" /><br> <br> You can see object details in the detailed view below. Try to change any values and use Save button to persist the changes to the database. You can also use Delete button to delete objects from the database. For the objects containing field objects you will be prompted to use cascade on delete.<br> More complex queries can be done by using Query Builder view:<br> <img border="0" src="OME_Query.jpg" /><br> <br> Drag "_name" field from the Db4o Browser view into the Query Builder view, set condition "Contains", put a value "a" and run the query. You can return to the Built Query tab and modify the query later on again. For example: add "AND" operator, drag "_name" field, set Condition to "Starts With" and the value to "M". Re-run the query. <br> If you want only selected fields to be displayed in the query result, drag and drop fields to be displayed from Db4o Browser into "Attribute List" window.<br> <img border="0" src="OME_Attr.jpg" /><br> <br> When the new query is created, the previous query is stored and can be selected from the history drop-down:<br> <img border="0" src="OME_QHistory.jpg" /><br> <br> More sophisticated queries can be build by joining grouped constraints using "Add Group" button.<br> When you are done working with the database in OME, you can close the connection by using Tools->Object Manager Enterprise-> Disconnect menu command or by using the equivalent button on the toolbar. <br> <br> In the <a href="Query.html#Query">next chapter</a> we will explore more about db4o querying capabilities. You can continue using OME while going through the rest of this tutorial. If you are using the interactive version you will find the database in formula1.db4o file in your Local Application Data folder (normally it is C:\Documents and Settings\[user name]\Local Settings\Application Data on Windows XP/2000, c:/Users/[user name]/AppData/Local on Windows Vista) Please, remember to disconnect OME before running any of the tutorial examples, as only one active connection is allowed to the database file. <br> <br><br><div id="footer"><p align="center">Do you have any questions, suggestions or feedback? Ask your questions in the <a href="http://developer.db4o.com/Forums.aspx" target=_top>db4o forums</a>. Join the <a href="http://developer.db4o.com" target=_top>db4o community</a> for addional resources and news.<br><br><a href="http://www.db4o.com/" target=_top><small>www.db4o.com</small></a></p>.</div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></td></tr></table></div></body></html>