<?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 : DataSourceKey question</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : DataSourceKey question</description>
  <pubDate>Sun, 12 Apr 2026 23:35:39 -700</pubDate>
  <lastBuildDate>Wed, 14 Dec 2011 09:50:29 -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=3151</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>DataSourceKey question : we encountered a similar problem...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12237#12237</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1090" rel="nofollow">rickadams</a><br /><strong>Subject:</strong> 3151<br /><strong>Posted:</strong> 14-Dec-2011 at 9:50am<br /><br />we encountered a similar problem where we needed to connect to multiple databases using the same EntityModels. Our solution was to divide up the connection string and the metadata string into a DataResource Table. We looked up the metadata using the keyName and the database connection using the keyExtension. Our DataKeyResolver then concatenated the two to return the correct connection string. This means that we only have 1 metadata string per EntityModel and however many database connections we needed ( in our case 4). This also means we can also handle generating the connectionstrings for DEV, PROD and TEST databases without having an insane number of entries in the web.config ( we have a web farm of 6 servers so imaging the maintenance ). I can send you code if you wish. Hope this helps]]>
   </description>
   <pubDate>Wed, 14 Dec 2011 09:50:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12237#12237</guid>
  </item> 
  <item>
   <title>DataSourceKey question : That kinda matches what I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12233#12233</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3151<br /><strong>Posted:</strong> 13-Dec-2011 at 12:31pm<br /><br />That kinda matches what I have played with but it just feels wonky. Thank you for confirming]]>
   </description>
   <pubDate>Tue, 13 Dec 2011 12:31:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12233#12233</guid>
  </item> 
  <item>
   <title>DataSourceKey question :     You have 27 EDMXes in...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12232#12232</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3151<br /><strong>Posted:</strong> 13-Dec-2011 at 12:11pm<br /><br /><p>You have 27 EDMXes in your application!?<br></p><div>Well ... the GetKey method on the resolver is called with the data source key name and extension.&nbsp; The resolver can also be exported by composition context, so you could have different resolvers for different contexts.&nbsp; You also know that the metadata names will always be based on the EDMX name, so for example a NorthwindIB.edmx would use a metadata string like</div><p>&nbsp;&nbsp; metadata=res://*/NorthwindIB.csdl|res://*/NorthwindIB.ssdl|res://*/NorthwindIB.msl;<br></p><div>So you might be able to use the data source key + extension either as your model name, or as a key to&nbsp;your own dictionary of model names.</div><div>&nbsp;</div><div>That's about all I can come up with.&nbsp; :)<br>&nbsp;</div><p>&nbsp;</p>]]>
   </description>
   <pubDate>Tue, 13 Dec 2011 12:11:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12232#12232</guid>
  </item> 
  <item>
   <title>DataSourceKey question : We have a bunch of different models...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12219#12219</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3151<br /><strong>Posted:</strong> 12-Dec-2011 at 9:46am<br /><br /><DIV =msg>We have a bunch of different models and each one hits the same database so technically we only have one or two connection strings...but we currently have an EdmKey defined for each model since it includes the metadata. <DIV>&nbsp;</DIV><DIV>So right now we have 27 EdmKeys in the web.config when we could just have 2 if you threw out the metadata. I have tried a few different ways of doing that with no real "success" as each "successful" solution required even more work/maintenance.</DIV><DIV>&nbsp;</DIV><DIV>In trying IDataSourceKeyResolver I see that it is of no help in this area - unless there is a way to programmatically tease the metadata text out of the model but I assume that its not possible as we don't know the context?</DIV><DIV>&nbsp;</DIV><DIV>Suggestions needed :)</DIV></DIV>]]>
   </description>
   <pubDate>Mon, 12 Dec 2011 09:46:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3151&amp;PID=12219#12219</guid>
  </item> 
 </channel>
</rss>