<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="2" MadCap:lastHeight="120" MadCap:lastWidth="624" MadCap:disableMasterStylesheet="true" MadCap:tocPath="Object Manager Enterprise" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem"> <head><title>Viewing Enum Values In OME</title> <script type="text/javascript">/* <![CDATA[ */ window.onload = function(){ var pathToFlash = $('html').attr('MadCap:PathToHelpSystem') + 'Content/Resources/Code/ZeroClipboard.swf'; ZeroClipboard.setMoviePath(pathToFlash); function bindToClipBord(element,content){ var clip = new ZeroClipboard.Client(); clip.setText(content); clip.glue(element); }; if(location.protocol==='file:'){ $('.copylink-marker').remove(); } else{ $('.copylink-marker').each(function(){ var text = $(this).parent().parent().children('.prettyprint').html(); $(this).hover(function(){ bindToClipBord(this,text); }, function(){}); }); } prettyPrint(); }; /* ]]> */</script> <link href="../../SkinSupport/MadCap.css" rel="stylesheet" /> <link href="../../Resources/Stylesheets/OnlineStyle.css" rel="stylesheet" /> <script src="../../SkinSupport/MadCapAll.js"> </script> <script src="../../Resources/Code/prettify.js"> </script> <script src="../../Resources/Code/lang-vb.js"> </script> <script src="../../Resources/Code/jquery.min.js"> </script> <script src="../../Resources/Code/ZeroClipboard.js"> </script> </head> <body> <p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../../index_CSH.html#object_manager_enterprise/ome_for_visual_studio/viewing_enum_values_in_ome.htm" style="">Open topic with navigation</a> </p> <div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../../object_manager_enterprise.htm">Object Manager Enterprise</a><span class="MCBreadcrumbsDivider"> > </span><span class="MCBreadcrumbs">Viewing enum Values In OME</span> </div> <p> <script type="text/javascript">/*<![CDATA[*/document.write('<a href="' + location.href +'">'); document.write("Direct Link"); document.write('</a>');/*]]>*/</script> </p> <p> </p> <h1><a name="kanchor128"></a>Viewing Enum Values In OME</h1> <p><a href="../../advanced_topics/type_handling/static_fields_and_enums/.net_enumerations.htm">.NET-enums </a> <![CDATA[ ]]>do not carry any database identity and are stored in their parent object slot. If you open a database with enum values in <span class="MCTextPopup"><a href="javascript:void(0);" class="MCTextPopupSpot" onclick="FMCTextPopup( event, this ); return false;">OME<img style="border: none;margin-left: 5px;" src="../../SkinSupport/ExpandingClosed.gif" MadCap:altsrc="../../SkinSupport/ExpandingOpen.gif" class="MCExpandingIcon" onload="if ( typeof( FMCPreloadImage ) == 'function' ) { FMCPreloadImage( '../../SkinSupport/ExpandingOpen.gif' ); }" /></a><span class="MCTextPopupBody" style="display: none; ">Object Manager, a tool to view and edit a db4o database</span></span>, you will be able to see the enum class in the db4o Browser view, but if you proceed and select "Show all objects" from the right-click menu you will see that there are no enum objects stored in the database.</p> <p>But don't worry, an enum is just an integer so all we need are the values of the enum fields in the database.  Please, select a class with the enum field in the db4o Browser view. Right-click it and select "Show all objects". </p> <p> <img src="viewing_enum_values_in_ome/ome-door-null.jpg" /> </p> <p>Something went wrong here - there are no Enum values and nulls are stored instead. Is the information lost? </p> <p>Here you will need to understand how enum values are stored in the database. In order to save space in the database file, db4o stores only the absolutely necessary information for the enums:</p> <ul> <li value="1">Enum class id</li> <li value="2">Enum numeric value</li> </ul> <p>The actual enum representation will be picked up in the runtime using enum class definition. As OME by default runs without class definitions using Generic Reflector, OME can't interpret the Enum field value correctly.  In order to fix you need to add the assemblies which contain the enum-type.</p> <p>Go to "Tools" -> "Object Manager Enterprise" -> "Options" menu and select "Assembly Search Path...". Add the path to the assembly, containing the type definition. Now disconnect and reconnect the database and browse the objects again:</p> <p> <img src="viewing_enum_values_in_ome/ome-door.jpg" /> </p> <script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js"> </script> </body> </html>