Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 2e9c43658e374d290a2de15d25134ac8 > files > 466

db4o-doc-8.0-1.fc15.i686.rpm

<?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="Advanced Features|Type Handling|Typehandlers" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem">
    <head><title>Pluggable Typehandler Benefits	</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#advanced_topics/type_handling/typehandlers/pluggable_typehandler_benefits.htm" style="">Open topic with navigation</a>
        </p>
        <div class="MCBreadcrumbsBox"><span class="MCBreadcrumbsPrefix">You are here: </span><a class="MCBreadcrumbsLink" href="../../../advanced_topics.htm">Advanced Features</a><span class="MCBreadcrumbsDivider"> &gt; </span><a class="MCBreadcrumbsLink" href="../../type_handling.htm">Type Handling</a><span class="MCBreadcrumbsDivider"> &gt; </span><a class="MCBreadcrumbsLink" href="../typehandlers.htm">Typehandlers</a><span class="MCBreadcrumbsDivider"> &gt; </span><span class="MCBreadcrumbs">Pluggable Typehandler Benefits</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>Pluggable Typehandler Benefits</h1>
        <p>As the name suggests Pluggable <span class="MCPopup"><a href="javascript:void(0);" class="MCPopupSpot" onclick="FMCPopup( event, this ); return false;" MadCap:src="../typehandlers.htm">Typehandler<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> allows anybody to
write custom typehandlers, and thus control the way the class objects are
stored to the database and retrieved in a query. Why would you do this? There
can be various reasons:</p>
        <ul class="unIndentedList">
            <li value="1">You know a more performant way to convert
objects to byte array or to compare them.</li>
            <li value="2">You need to store only part of the object's
information and want to skip unneeded fields to keep the database smaller. You
can also do the same using <a href="../../../tuning/selective_persistence.htm">Transient</a>marker, but this is only possible for classes with available code. Using custom
typehandler you can configure partial storage for any third-party class.</li>
            <li value="3">You need to keep information that will allow you
to restore fields that cannot be stored as is, for example: references to
environmental variables (like time zone), proxy objects or variables of
temporary state (like current memory usage). Previously, this job was done by
<a href="../translators.htm">Translators</a>, but certainly custom Typehandler gives you more control
and unifies the approach.</li>
            <li value="4">You need to perform a complex refactoring
on-the-fly (use typehandler versioning)</li>
            <li value="5">You want to cipher each object before putting it
into the database</li>
        </ul>
        <p>Other not so common and more
difficult in realization behaviours that can be realized with the new
Typehandler:</p>
        <ul class="unIndentedList">
            <li value="1">Customary indexes</li>
            <li value="2">Versioning of typehandlers (can be used for
refactoring and db4o version upgrades)</li>
        </ul>
        <p>Of course, writing typehandlers
is not totally simple, but once you understand how to do that - you will also
gain a much deeper understanding of db4o itself. You can start with a <a href="custom_typehandler_example.htm">simple
example</a> provided in this documentation and continue by looking into existing
db4o typehandler implementations: StringHandler, VariableLengthTypeHandler,
IndexableTypeHandler etc.</p>
        <script type="text/javascript" src="../../../SkinSupport/MadCapBodyEnd.js">
        </script>
    </body>
</html>