Sophie

Sophie

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

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|Refactoring And Schema Evolution" MadCap:InPreviewMode="false" MadCap:RuntimeFileType="Topic" MadCap:TargetType="WebHelp" MadCap:PathToHelpSystem="../../../" MadCap:HelpSystemFileName="index.xml" MadCap:SearchType="Stem">
    <head><title>Refactoring API	</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="../../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>
        <script src="../../SkinSupport/MadCapAll.js" type="text/javascript">
        </script>
    </head>
    <body>
        <p class="MCWebHelpFramesetLink" style="display: none;"><a href="../../../index_CSH.html#advanced_topics/refactoring_and_schema_evolution/refactoring_api.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="../refactoring_and_schema_evolution.htm">Refactoring And Schema Evolution</a><span class="MCBreadcrumbsDivider"> &gt; </span><span class="MCBreadcrumbs">Renaming API</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="kanchor92"></a>Renaming API</h1>
        <p>db4o provides a special API to move classes between <span class="PrimaryPackages">namespace</span>, rename classes or fields. </p>
        <h2>Rename a Class</h2>
        <p>Use the <a href="../../configuration/objectclass_configuration.htm">configuration API&#160;to rename a class</a>.You need to rename the class before you open the database. </p>
        <p MadCap:conditions="Primary..NET">Remember to include the <a href="../../platform_specific_issues/class_name_format_in_.net.htm">assembly name</a>.</p>
        <div class="codesnippet" MadCap:conditions="Primary.c#">
            <pre class="prettyprint" xml:space="preserve">configuration.Common.ObjectClass("Db4oDoc.Code.Strategies.Refactoring.PersonOld, Db4oDoc")
    .Rename("Db4oDoc.Code.Strategies.Refactoring.PersonNew, Db4oDoc");</pre>
            <div class="codesnippet-meta">RefactoringExamples.cs: Rename a class
			<div class="codedownload"><a href="../../CodeExamples/strategies/refactoring/Example-strategies-refactoring-csharp.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
        </div>
        <div class="codesnippet" MadCap:conditions="Primary.VB.NET">
            <pre class="prettyprint lang-vb" MadCap:conditions="Primary.Online" xml:space="preserve">configuration.Common.ObjectClass("Db4oDoc.Code.Strategies.Refactoring.PersonOld, Db4oDoc") _
    .Rename("Db4oDoc.Code.Strategies.Refactoring.PersonNew, Db4oDoc")</pre>
            <div class="codesnippet-meta">RefactoringExamples.vb: Rename a class
			<div class="codedownload"><a href="../../CodeExamples/strategies/refactoring/Example-strategies-refactoring-vb.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
        </div>
        <h2>Rename a Field</h2>
        <p>Use the <a href="../../configuration/objectfield_configuration.htm">configuration API to rename a field</a>.&#160;You need to rename the field before you open the database.</p>
        <p MadCap:conditions="Primary..NET">Remember to include the <a href="../../platform_specific_issues/class_name_format_in_.net.htm">assembly name</a>.</p>
        <div class="codesnippet" MadCap:conditions="Primary.c#">
            <pre class="prettyprint" xml:space="preserve">configuration.Common.ObjectClass("Db4oDoc.Code.Strategies.Refactoring.PersonOld, Db4oDoc")
    .ObjectField("name").Rename("sirname");</pre>
            <div class="codesnippet-meta">RefactoringExamples.cs: Rename field
			<div class="codedownload"><a href="../../CodeExamples/strategies/refactoring/Example-strategies-refactoring-csharp.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
        </div>
        <div class="codesnippet" MadCap:conditions="Primary.VB.NET">
            <pre class="prettyprint lang-vb" MadCap:conditions="Primary.Online" xml:space="preserve">configuration.Common.ObjectClass("Db4oDoc.Code.Strategies.Refactoring.PersonOld, Db4oDoc") _
    .ObjectField("name").Rename("sirname")</pre>
            <div class="codesnippet-meta">RefactoringExamples.vb: Rename field
			<div class="codedownload"><a href="../../CodeExamples/strategies/refactoring/Example-strategies-refactoring-vb.zip" class="codedownload" MadCap:conditions="Primary.Online">Download Code</a></div><div class="codedownload copylink-marker" MadCap:conditions="Primary.Online"><a href="#copy">Copy Code</a></div></div>
        </div>
        <h2>Rename Step by Step</h2>
        <p>The safe order of actions for renaming is:</p>
        <ol>
            <li value="1">Backup your database.</li>
            <li value="2">Close all open object containers if any. </li>
            <li value="3">Rename classes or fields in your application.</li>
            <li value="4">Add the renaming call to on the configuration before opening the database.</li>
            <li value="5">Pass the configuration with the rename-information to the object container factory. Open the database and you're ready to work with the renamed classes or fields.</li>
        </ol>
        <script type="text/javascript" src="../../SkinSupport/MadCapBodyEnd.js">
        </script>
    </body>
</html>