<?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 : Multiple DataSource in a Single Model</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Multiple DataSource in a Single Model</description>
  <pubDate>Thu, 16 Apr 2026 23:34:53 -700</pubDate>
  <lastBuildDate>Thu, 08 Dec 2011 18:37:56 -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=3129</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>Multiple DataSource in a Single Model : It&amp;#039;s recommended to have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12190#12190</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 08-Dec-2011 at 6:37pm<br /><br />It's recommended to have both edmx in the same DomainModel assembly.<div><br></div><div>A single domain model in this case means a single EntityManager. In your example, GlobalDB.edmx and ProductDB.edmx can have the same EntityManager as long as they're in the same namespace and assembly.</div><div><br></div><div>Please see&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/many-models-per-manager" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/many-models-per-manager</a>&nbsp;for more details.</div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 18:37:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12190#12190</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Hi Denis,I&amp;#039;m just curious...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12188#12188</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 08-Dec-2011 at 5:01pm<br /><br />Hi Denis,<div><br></div><div>I'm just curious what does it mean by this?</div><div>I thought I could create single consolidated model with entities coming from multiple datasource such as databases, different databases, WCF services and etc.</div><div><br></div><div><h3 ="blackermain"="" style="text-align: left; : rgb251, 251, 253; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 20px; font-weight: normal; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; line-height: 22pt; ">Multiple data sources</h3><span ="apple-style-span"="" style="text-align: left; : rgb251, 251, 253; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">The Entity Framework only supports one database per Entity Data Model. DevForce lets you define a single domain model that holds entities from&nbsp;</span><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/create-entitymanager-datasource-extensi&#111;n" target="_blank">multiple data sources</a><span ="apple-style-span"="" style="text-align: left; : rgb251, 251, 253; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">&nbsp;and use navigation properties to move seamlessly between them. Saving back to these data sources is just as seamless as DevForce can encapsulates all of the changes into a single transaction.</span></div><div><span ="apple-style-span"="" style="text-align: left; : rgb251, 251, 253; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; "><br></span></div><div><span ="apple-style-span"="" style="text-align: left; : rgb251, 251, 253; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">Thanks,</span></div><div><span ="apple-style-span"="" style="text-align: left; : rgb251, 251, 253; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">Von</span></div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 17:01:53 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12188#12188</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Ok I&amp;#039;ll try to do it.Btw,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12187#12187</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 08-Dec-2011 at 4:59pm<br /><br />Ok I'll try to do it.<div>Btw, does it mean that in GlobalDB.edmx project I should have a reference to Product.edmx in case of different project or they should&nbsp;reside on the same assembly?</div><div><br></div><div>Thanks,</div><div>Von</div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 16:59:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12187#12187</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Hi Von;Sorry for the misunderstanding....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12186#12186</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 08-Dec-2011 at 4:01pm<br /><br />Hi Von;<div><br></div><div>Sorry for the misunderstanding. I'm afraid we don't support setting different connections per entity in runtime.</div><div><br></div><div>However, there is a workaround that will enable you to do the above.</div><div><br></div><div>It requires a specific setup as follows:</div><div><br></div><div>1. Create a new edmx, say GlobalDB.edmx that will contain entity ABC and points to GlobalDB</div><div><br></div><div>2. Create another edmx, ProductDB.edmx that will contain entity DEF, XYZ and VON and points to ProductDB</div><div><br></div><div>3. In your ABC partial class, create the association between ABC and DEF as follows.</div><div><br></div><div>Assuming the relationship is as follows DEF (1) to (many) ABC</div><div>DEF - DEF_id - PK</div><div><br></div><div>ABC - ABC_id - PK</div><div>ABC - DEF_id - FK to DEF</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>public DEF DEF {</div><div>&nbsp; get {</div><div>&nbsp; &nbsp; return this.EntityManager.DEF.Where(e =&gt; e.DEF_Id == this.DEF_Id).FirstOrNullEntity();&nbsp;</div><div>&nbsp; }</div><div>}</div></div><div></pre></td></tr></table></div><div><br></div><div><div>4. In your DEF partial class, create the association between ABC and DEF as follows.</div><div><br></div><div>Assuming the relationship is as follows DEF (1) to (many) ABC</div><div><div>DEF - DEF_id - PK</div><div><br></div><div>ABC - ABC_id - PK</div><div>ABC - DEF_id - FK to DEF</div></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>public IList&lt;ABC&gt; ABCs {</div><div>&nbsp; get {</div><div>&nbsp; &nbsp; return this.EntityManager.ABC.Where(e =&gt; e.DEF_id == this.DEF_Id).ToList();</div><div>&nbsp; }</div><div>}</div></div><div></pre></td></tr></table></div></div><div><br></div><div>In other words, the association is not defined in the edmx but rather in the entity partial class in code.</div><div><br></div><div>Hope this helps.</div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 16:01:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12186#12186</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Hi Denis,I believe the one you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12180#12180</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 07-Dec-2011 at 9:05pm<br /><br />Hi Denis,<div><br></div><div>I believe the one you send is for programmatically changing the connection in runtime.</div><div>But my question is is there a possibility that within a single Model, like in my example.</div><div><br></div><div><div style="text-align: left; : rgb251, 251, 253; ">1. ABC - this entity connects to Global DB&nbsp;</div><div style="text-align: left; : rgb251, 251, 253; ">2. DEF&nbsp;- this entity connects to Product DB</div><div style="text-align: left; : rgb251, 251, 253; ">3. XYZ&nbsp;- this entity connects to&nbsp;Product&nbsp;DB</div><div style="text-align: left; : rgb251, 251, 253; ">4. VON&nbsp;- this entity connects to&nbsp;Product&nbsp;DB</div><div style="text-align: left; : rgb251, 251, 253; "><br></div><div style="text-align: left; : rgb251, 251, 253; ">And then I put association between ABC and DEF.</div></div><div style="text-align: left; : rgb251, 251, 253; "><br></div><div style="text-align: left; : rgb251, 251, 253; ">Entities connects to different datasource, what I mean is that, when I query ABC and DEF in a single query expression, it will&nbsp;</div><div style="text-align: left; : rgb251, 251, 253; ">access different database.</div><div style="text-align: left; : rgb251, 251, 253; "><br></div><div style="text-align: left; : rgb251, 251, 253; ">var query = context.ABC.Select(p =&gt; new {</div><div style="text-align: left; : rgb251, 251, 253; "><span ="Apple-tab-span" style="white-space:pre">									</span>ComesFrom_GlobalDB =&nbsp;p.DEF.columnHere,</div><div style="text-align: left; : rgb251, 251, 253; "><span ="Apple-tab-span" style="white-space:pre">									</span>ComesFrom_ProductDB = p.columnHere</div><div style="text-align: left; : rgb251, 251, 253; "><span ="Apple-tab-span" style="white-space:pre">								</span>&nbsp; &nbsp;}</div><div style="text-align: left; : rgb251, 251, 253; "><span ="Apple-tab-span" style="white-space:pre">						</span>);</div><div style="text-align: left; : rgb251, 251, 253; "><br></div><div style="text-align: left; : rgb251, 251, 253; ">Like in this example, ABC should connect to GlobalDB and DEF should connect to ProductDB.</div><div style="text-align: left; : rgb251, 251, 253; ">How can I set different connections per entity in runtime?</div><div style="text-align: left; : rgb251, 251, 253; "><br></div><div style="text-align: left; : rgb251, 251, 253; ">Thanks,</div><div style="text-align: left; : rgb251, 251, 253; ">Von</div>]]>
   </description>
   <pubDate>Wed, 07 Dec 2011 21:05:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12180#12180</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Hi Von;You can dynamically build...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12178#12178</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 07-Dec-2011 at 6:31pm<br /><br />Hi Von;<div><br></div><div>You can dynamically build a connection string at runtime by implementing IDataSourceKeyResolver. Please see the following pages and let me know if you have further questions.</div><div><br></div><div>DataSourceKeys and DataSourceExtensions discussion -&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/data-sources" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/data-sources</a></div><div><br></div><div>Code sample -&nbsp;<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/code-sample-custom-datasourcekeyresolver" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-datasourcekeyresolver</a></div>]]>
   </description>
   <pubDate>Wed, 07 Dec 2011 18:31:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12178#12178</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Taken from your page:Multiple...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12174#12174</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 06-Dec-2011 at 8:09pm<br /><br />Taken from your page:<div><br></div><div><div style="margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; "><h3 ="blackerMain" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 20px; font-weight: normal; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; line-height: 22pt; ">Multiple data sources</h3><span ="Apple-style-span" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">The Entity Framework only supports one database per Entity Data Model. DevForce lets you define a single domain model that holds entities from&nbsp;</span><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/create-entitymanager-datasource-extensi&#111;n" target="_blank">multiple data sources</a><span ="Apple-style-span" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 15px; line-height: normal; ">&nbsp;and use navigation properties to move seamlessly between them. Saving back to these data sources is just as seamless as DevForce can encapsulates all of the changes into a single transaction.&nbsp;</span></div></div>]]>
   </description>
   <pubDate>Tue, 06 Dec 2011 20:09:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12174#12174</guid>
  </item> 
  <item>
   <title>Multiple DataSource in a Single Model : Hi,I believe Devforce has a way...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12173#12173</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1228" rel="nofollow">Vonzkie</a><br /><strong>Subject:</strong> 3129<br /><strong>Posted:</strong> 06-Dec-2011 at 7:37pm<br /><br />Hi,<div><br></div><div>I believe Devforce has a way to direct a single Entity in a model to connect to a different datasource in runtime while the remaining Entities in the model connects to a different datasource as well.</div><div><br></div><div>Example I defined DomainModel w/c consists of 4 entities:</div><div><br></div><div>1. ABC - this entity connects to Global DB&nbsp;</div><div>2. DEF&nbsp;- this entity connects to Product DB</div><div>3. XYZ&nbsp;- this entity connects to&nbsp;Product&nbsp;DB</div><div>4. VON&nbsp;- this entity connects to&nbsp;Product&nbsp;DB</div><div><br></div><div>And then I put association between ABC and DEF.</div><div><br></div><div>How can I build the connection in runtime programmatically?</div><div><br></div><div>Thanks,</div><div>Von</div><div><div style="margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; "><h3 ="blackerMain" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 20px; font-weight: normal; font-family: Helvetica, Geneva, Arial, SunSans-Regular, sans-serif; line-height: 22pt; "><br></h3></div></div>]]>
   </description>
   <pubDate>Tue, 06 Dec 2011 19:37:36 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3129&amp;PID=12173#12173</guid>
  </item> 
 </channel>
</rss>