<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Tech Tip: Data Source Extensions</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Tech Tip: Data Source Extensions</description>
  <pubDate>Sat, 11 Apr 2026 13:45:46 -700</pubDate>
  <lastBuildDate>Wed, 06 Jun 2007 11:09:30 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=33</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Tech Tip: Data Source Extensions : Level 300 DevForce Professional...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=33&amp;PID=93#93</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=21" rel="nofollow">IdeaBlade</a><br /><strong>Subject:</strong> 33<br /><strong>Posted:</strong> 06-Jun-2007 at 11:09am<br /><br /><P =Questi&#111;n style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3><strong><EM>Level 300 <BR>DevForce Professional </EM></strong></FONT></P><P =Questi&#111;n style="MARGIN: 0in 0in 0pt"><strong><EM><FONT face="Times New Roman" size=3>May 23, 2006</FONT></EM></strong></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">Many IT shops prescribe separate Development, QA, Test, Stage, and Production environments. Each version of the application works its way through a testing gauntlet from the developer environment to the ultimate production release.<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">Suppose our application refers to a database data source called “default”. Its <I style="mso-bidi-font-style: normal">data source key</I> is “default”. The application will use this key at runtime to find a <I style="mso-bidi-font-style: normal">data source configuration </I>in the application configuration file (IdeaBlade.ibconfig).<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">The data source configuration is very simple for the development environment. The development deployment puts all tiers on the PC. The “default” development configuration’s connection string points to a database on the PC.<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">The QA environment, on the other hand, has a 3 tier deployment with separate machines for client, business object server, and database. This requires many changes to the “default” configuration including a different connection string that points to the QA database. We really need a separate “default” configuration for QA.<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">In fact, we need five “default” configurations in the application configuration file.<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">The <I style="mso-bidi-font-style: normal">symbolic</I> data source, “default”, doesn’t change as we cross environments. The business objects associated with the “default” data source should be indifferent to configuration differences. The executing environment, on the other hand, has to know which of the “default” configuration to use.<o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><SPAN style="mso-bidi-font-size: 10.0pt"><FONT size=2><FONT face="Times New Roman">DevForce provides data source key <I style="mso-bidi-font-style: normal">extensions</I> to help distinguish the five “default” data source configurations. By convention, the data source configuration name is the data source key name followed optionally by a data source key extension (with an underscore “_” separating the two). <o:p></o:p></FONT></FONT></SPAN></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT size=2><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman">In our example, the configurations could be named “Default_Development”, “Default_QA”, etc. When the application launches, it determines its runtime environment and then tells the </FONT></SPAN><SPAN style="COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt">PersistenceManager</SPAN><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman"> to connect to its data source(s) using the extension to find the appropriate data source configuration information. If we execute in development, we initialize the PM with “Development” and it adds the “_Development” suffix to “default”.<o:p></o:p></FONT></SPAN></FONT></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT size=2><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman">If the </FONT></SPAN><SPAN style="COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt">PersistenceManager</SPAN><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>(and, later, the </FONT></SPAN><SPAN style="COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.0pt">PersistenceServer</SPAN><SPAN style="mso-bidi-font-size: 10.0pt"><FONT face="Times New Roman">) cannot find a data source configuration named “Default_Development”, it will look for one named “default” before giving up.<o:p></o:p></FONT></SPAN></FONT></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 13pt"><B><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica; mso-bidi-font-size: 12.0pt">An example section of an IdeaBlade.ibconfig file is showing below:</SPAN></B><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica"><o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: 13pt"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica">&nbsp;<o:p></o:p></SPAN></P><P =CodeSnippet style="MARGIN: 0in 0in 0pt 0.25in"><strong><FONT size=2><FONT color=#808080><FONT style=": #e6e6e6"><FONT face="Courier New">&lt;rdbKey name="Default_Development"&gt;<BR>&nbsp;&nbsp;&lt;connection&gt;Provider=SQLOLEDB.1;Integrated Security=SSPI;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Persist Security Info=False;Initial Catalog=IdeaBladeTest;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Data Source=.&lt;/connection&gt;<BR>&lt;/rdbKey&gt;<BR>&lt;rdbKey name="Default_QA"&gt;<BR>&nbsp;&nbsp;&lt;connection&gt;Provider=SQLNCLI.1;Integrated Security=SSPI;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Persist Security Info=False;Initial Catalog=IdeaBladeTest;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Data Source=.&lt;/connection&gt;<BR>&lt;/rdbKey&gt;<BR>&lt;rdbKey name="Default_Test"&gt;<BR>&nbsp;&nbsp;&lt;connection&gt;Data Source=.;Initial Catalog=IdeaBladeTest;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Integrated Security=True&lt;/connection&gt;<BR>&lt;/rdbKey&gt;<BR>&lt;rdbKey name="Default_Test_ORACLE"&gt;<BR>&nbsp;&nbsp;&lt;dataProvider&gt;System.Data.OracleClient &lt;/dataProvider&gt;<BR>&nbsp;&nbsp;&lt;connection&gt;Data Source=Oracle10G/ibnorth; Password=password;<BR>&nbsp;&nbsp;&nbsp;&nbsp;Persist Security Info=True;User ID=sa;&lt;/connection&gt;<BR>&lt;/rdbKey&gt;<SPAN style="FONT-FAMILY: Helvetica"><o:p></o:p></SPAN></FONT></FONT></FONT></FONT></strong></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT face="Times New Roman" size=2>Note that the multiple RdbKeys for a single data source do not have to use the same ADO.NET dataProvider, nor do they have to reference the same database from the same database vendor (providing the schemas are compatible). </FONT></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT face="Times New Roman" size=2>In addition, entities in the PM may map to more than one data source. The PM will suffix each data source key name with the same extension.</FONT></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt"><FONT face="Times New Roman" size=2>At runtime the appropriate datasource can be accessed via a call similar to the one below, where the “datasourceExtensionName” is determined dynamically by the executing application.</FONT></P><P =Ms&#111;normal style="MARGIN: 5pt 0in; LINE-HEIGHT: 13pt"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Helvetica">&nbsp;</SPAN><FONT face="Times New Roman"><B><SPAN style="FONT-SIZE: 12pt">C#:</SPAN></B><SPAN style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></FONT></P><P =CodeSnippet style="MARGIN: 0in 0in 0pt 0.25in"><strong><FONT size=2><FONT style=": #e6e6e6" face="Courier New" color=#808080>PersistenceManager pm =<BR>&nbsp;&nbsp;&nbsp;new PersistenceManager (true, datasourceExtensionName);</FONT></FONT></strong></P><P =Ms&#111;normal style="MARGIN: 8pt 0in 0pt; LINE-HEIGHT: 13pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN><FONT face="Times New Roman"><strong>VB.NET:</strong><o:p></o:p></FONT></SPAN></P><P =CodeSnippet style="MARGIN: 0in 0in 0pt 0.25in"><strong><FONT size=2><FONT style=": #e6e6e6" face="Courier New" color=#808080>Dim pm As PersistenceManager = _<BR>&nbsp;&nbsp;&nbsp;New PersistenceManager (True, datasourceExtensionName)</FONT></FONT></strong></P>]]>
   </description>
   <pubDate>Wed, 06 Jun 2007 11:09:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=33&amp;PID=93#93</guid>
  </item> 
 </channel>
</rss>