<?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 : Connection object or string in Entity Manager</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Connection object or string in Entity Manager</description>
  <pubDate>Fri, 10 Apr 2026 20:03:38 -700</pubDate>
  <lastBuildDate>Mon, 06 Aug 2012 15:23:32 -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=1632</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>Connection object or string in Entity Manager : If you wrote your own DataSourceKeyResolver...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=14143#14143</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 06-Aug-2012 at 3:23pm<br /><br />If you wrote your own DataSourceKeyResolver which delivers the string to DevForce, why can't you call it yourself to get the string you need? I'm just trying to sidestep anything too fancy. What am I missing?]]>
   </description>
   <pubDate>Mon, 06 Aug 2012 15:23:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=14143#14143</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Hi Guys,Any update on how to get...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=14140#14140</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> 1632<br /><strong>Posted:</strong> 05-Aug-2012 at 11:49pm<br /><br />Hi Guys,<div><br></div><div>Any update on how to get the connection string in the SERVER side?</div><div>I need to know the current connection string used by the EntityManager without checking on the EdmKeys cause I used DataSourceKeyResolver to compose it dynamically..</div><div>I'm about to run a native sql server commands on the server side..</div><div><br></div><div>Thanks,</div><div>Von</div>]]>
   </description>
   <pubDate>Sun, 05 Aug 2012 23:49:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=14140#14140</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Wait a minute, @teresap989! I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=8511#8511</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 14-Sep-2010 at 8:23pm<br /><br />Wait a minute, @teresap989! I read your request too fast. <DIV></DIV><DIV></DIV>&nbsp;<DIV>You wrote: "<EM>I see by debugging that the Connection String is deep down in the class heirarchy of EntityManager</EM>"</DIV><DIV>&nbsp;</DIV><DIV><strong>No it is not. You cannot get to the connection string from the EntityManager.</strong> </DIV><DIV>&nbsp;</DIV><DIV>I'll give you a big prize if you can find such a string from the EntityManager ... by reflection, debugging, or any other means ... because that would be a huge security hole. The connection string is not accessible from any client DevForce code.</DIV><DIV>&nbsp;</DIV><DIV>You will find the DataSourceKey. That is just a name ... a name for requesting access to a server-side data source with that key. The key does not itself contain any information that would be useful in accessing the database directly.</DIV><DIV>&nbsp;</DIV><DIV>Fortunately, I see that you are actually talking about writing server-side method (a "Remote Server Method") that makes use of ADO. That is ok.</DIV><DIV>&nbsp;</DIV><DIV>As I said ... tomorrow&nbsp;I'll show you how you can get the string in DevForce 2010 <strong>from server-side</strong> code.</DIV>]]>
   </description>
   <pubDate>Tue, 14 Sep 2010 20:23:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=8511#8511</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Yes ... you can get at the connection...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=8510#8510</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 14-Sep-2010 at 8:14pm<br /><br />Yes ... you can get at the connection string. It will be the Entity Framework connection string (see the Web.Config&nbsp;or the App.config in the EF model project) &nbsp;but you can figure out how to parse that and strip out the portion of it that you need to access the db directly.<DIV>&nbsp;</DIV><DIV>Please note that the string would only be accessible to server-side code. You wouldn't want your client application looking at the database connection string ... that's a security violation.</DIV><DIV>&nbsp;</DIV><DIV>Side-note: when you run 2-tier, your "client-side" and "server-side" are executing in the same process so of course you can access the string there. I'm talking about accessibility in n-tier deployments as would be required, for example, in a Silverlight application.</DIV><DIV>&nbsp;</DIV><DIV>Are you ready to learn how to get that string?</DIV><DIV>&nbsp;</DIV><DIV>You'll have to wait for tomorrow :-)&nbsp;&nbsp; I've run out of time this evening. But, trust me, you can get that string on the server.</DIV>]]>
   </description>
   <pubDate>Tue, 14 Sep 2010 20:14:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=8510#8510</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Sorry I haven&amp;#039;t checked in...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=7157#7157</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 05-Jun-2010 at 10:18am<br /><br />Sorry I haven't checked in on this thread in awhile. I had a feeling it was closed in the sense that you were satisfied with my answer about how to get the connection string and were sharing your regret that such things are necessary from time to time.<DIV>&nbsp;</DIV><DIV>Upon reflection, I'm not sure if I answered your question ... or if you thought there was something more we could or should do. If I hear from you, I'll know :-)</DIV>]]>
   </description>
   <pubDate>Sat, 05 Jun 2010 10:18:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=7157#7157</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Ward,  I would very much like...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6421#6421</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 26-Mar-2010 at 10:08am<br /><br />Ward, <DIV>I would very much like to avoid doing things like this. The sad fact is just that the LINQ to Entiyt Framwork is not powerfull enoug to perform many of my complex queries. Secondly although some of them I can do via LINQ it has revealed to be 10-100 times slower than going via RPC using old style DataReaders at the server side.<BR><BR>Anothe thing is also that quite often&nbsp;we need to perform quite many queryes on the server side before geting the end result valid for the UI. In that case it is more easy to do it all in one round trip to the server than doing all the LINQ-queries client side causing many round trips to the server. Maybe I'm wrong here, but then please tell me about a usable alternative.<BR></DIV>]]>
   </description>
   <pubDate>Fri, 26 Mar 2010 10:08:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6421#6421</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : No issue. You should be finegetting...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6420#6420</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 26-Mar-2010 at 9:54am<br /><br />No issue. You should be fine&nbsp;getting the connection string on the server and doing what you need with it. Maybe I was being a bit TOO controlling.<DIV>&nbsp;</DIV><DIV>In fact, in our DevForce 2010 release, AdoHelper will "disappear". </DIV><DIV>&nbsp;</DIV><DIV>You DO want to ensure that you're getting <U>the same&nbsp;connection string that DevForce is using</U>; that's a reason to go through the IdeaBladeConfig mechanism to retrieve it. </DIV><DIV>&nbsp;</DIV><DIV>Once you have the connection string, do what you what seem most appropriate: raw ADO, direct to Entity Framework, whatever.</DIV><DIV>&nbsp;</DIV><DIV>The key (pun intended) is to ensure that the connection string is accessible only on the server <strong>AND</strong> that your database interactions&nbsp;are consistent with&nbsp;application business logic. You don't want to bypass important business rules or actions&nbsp; that are inscribed in your code (e.g., auditing client queries). </DIV><DIV>&nbsp;</DIV><DIV>You&nbsp;want to preserve both Security&nbsp;and Data Integrity.</DIV><DIV>&nbsp;</DIV><DIV>But, as you observe, the client won't have access to your server side connection string.</DIV>]]>
   </description>
   <pubDate>Fri, 26 Mar 2010 09:54:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6420#6420</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Hi Ward,I think you are overseeing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6417#6417</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 26-Mar-2010 at 3:17am<br /><br /><DIV>Hi Ward,<BR>I think you are overseeing on4 important thing here.&nbsp; The code in the original message is an RPC method on the server, not on the client. So I'm retrieveing the connection string server side, not client side. So there should be no risk involved, is it??!!</DIV><DIV><BR>So the code is Server only and this method is accessed from the client by a InvokeServerMethodAsync(). The database connecton string is cracked server side only and never returned to the client. So I don't se there is any security issue here.<BR><BR>Regards</DIV><DIV>&nbsp; TJ</DIV>]]>
   </description>
   <pubDate>Fri, 26 Mar 2010 03:17:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6417#6417</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Thanks Ward! Just used this info...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6414#6414</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 25-Mar-2010 at 6:10pm<br /><br />Thanks Ward!&nbsp; Just used this info to help with writing a RPC.]]>
   </description>
   <pubDate>Thu, 25 Mar 2010 18:10:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6414#6414</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : It&amp;#039;s not supposed to be easy....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6154#6154</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 29-Jan-2010 at 7:44pm<br /><br />It's not supposed to be easy. One objective of frameworks like EF and DevForce is to insulate you from direct database access. If people start hacking away at the database directly, the app goes sideways fast. <DIV>&nbsp;</DIV><DIV>We're also supporting n-tier scenarios which means that the connection strings shouldn't be knowable on the client. Your approach will fail misearably if run on the client in an n-tier deployment (e.g., Silverlight) ... as will mine and as should everyone's. If you could find the connection string from the client, that would be a&nbsp;really bad security violation!</DIV><DIV>&nbsp;</DIV><DIV>Assuming you are running 2-tier or are performing your operation on the server, we know that you may have to get to the database directly. And so you can.</DIV><DIV>&nbsp;</DIV><DIV>Take a look at the <strong>NumericIdGenerator</strong> code sample which uses raw ADO to talk to a table of counters for generating entity ids. After install on my Windows 7 machine it is located here</DIV><DIV><DIV>&nbsp;</DIV><DIV><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 10pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-no-proof: yes">&nbsp; C:\Users\Public\Documents\DevForce\Learning Resources\040_BusObjPersistence\AddingDeleting\Snippets\NumericIdGenerator </SPAN></DIV><DIV><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 10pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-no-proof: yes"></SPAN>&nbsp;</DIV><DIV>You'd go this route if you were creating entity ids&nbsp;old school with a NextId table in your database instead of using autoincrement&nbsp;columns or Guids.<DIV><DIV>&nbsp;</DIV></DIV></DIV><DIV>Work your way quickly to the "<FONT size=2>AllocateMoreIds" method which takes a DateSourceKey. Inside it acquires an AdoHelper which is&nbsp;an easier way to talk to your database than raw ADO. Oh sure you can get the connection string from AdoHelper if you want.&nbsp;</FONT></DIV><DIV><FONT size=2>&nbsp;</DIV></DIV><DIV><DIV>I'm not saying it's pretty. But it does the job as&nbsp;IdeaBlade thinks you should approach it :-)</DIV><DIV>&nbsp;</DIV><DIV>======</DIV><DIV>&nbsp;</DIV></DIV><DIV>As you read the code you see that it creates an AdoHelper via a DataSourceKey and that has to be an&nbsp;Ideablade.Ado.RdbKey.&nbsp;DevForce supplies that key to the IdGenerator.&nbsp;You're going to need to get your own.</DIV><DIV>&nbsp;</DIV><DIV>RdbKeys don't fall off the tree. In fact, you have to construct yours from an EdmKey.</DIV><DIV>&nbsp;</DIV><DIV>An EdmKey, "Entity Data Model Key", describes a data source that you've modeled. In theory that source does not have to be a database. Of course it usually is and for the rest of this example we will assume that it is.</DIV><DIV>&nbsp;</DIV><DIV>How do you get an EdmKey? There are lots of ways.&nbsp;The way you did it with the DataSourceKeyResolver works. It just isn't obvious how it works.</DIV><DIV>&nbsp;</DIV><DIV>I think many will find it more obvious to start&nbsp;with&nbsp;name of the key you want.</DIV><DIV>&nbsp;</DIV><DIV>If you want to play along,&nbsp; remember<SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 10pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-no-proof: yes"><FONT size=3> to reference the little-used IdeaBlade.Ado and IdeaBlade.Edm assemblies; they are in the GAC and in the IdeaBlade assemblies folder like all the others.</FONT></SPAN></DIV><DIV>&nbsp;</DIV><DIV><strong>Getting the EdmKey name</strong></DIV><DIV>&nbsp;</DIV><DIV>You're golden if you know&nbsp;the name&nbsp;brute force. The default name from our Object Mapper&nbsp;is "Default" so you could write:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; var edmKeyName = "Default";</DIV><DIV>&nbsp;</DIV><DIV>If you aren't sure of the name but you know there is only one in your application try</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; var edmKeyName = IdeaBlade.Core.<FONT color=#2b91af>IdeaBladeConfig</FONT>.Instance.EdmKeys&#091;0&#093;.Name;</DIV><DIV>&nbsp;</DIV><DIV>That fishes the name from your in-memory IdeaBlade application configuration which is most likely derived from the XML in your app.config (or web.config in n-tier).</DIV><DIV>&nbsp;</DIV><DIV>If you have multiple EDM models (really? I want to meet you!) requiring multiple keys, then you have to know which EdmKey to use.&nbsp; If you happen to know an entity&nbsp;type that is mapped to the database you want, you can get the name from the type.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; var edmKeyName = IdeaBlade.EntityModel.<FONT color=#2b91af>EntityMetadata</FONT>.GetDataSourceKeyName(typeof(<EM>myEntityType</EM>));</DIV><DIV>&nbsp;</DIV><DIV>If you are using DataSourceKeyExtensions ... stop where you are and tell me.&nbsp;You have to toss in a wrinkle at this&nbsp;point in the&nbsp;recipe ... and I don't want to lose any more readers.</DIV><DIV>&nbsp;</DIV><DIV><strong>Get the EdmKey</strong></DIV><DIV>&nbsp;</DIV><DIV>Now that you know the edmKeyName, you can get an EdmKey.</DIV><DIV>&nbsp;</DIV><DIV><DIV>&nbsp; var edmKey = IdeaBlade.EntityModel.Edm.<FONT color=#2b91af>EdmKey</FONT>.LocateEdmKey(edmKeyName);</DIV><DIV>&nbsp;</DIV></DIV><DIV>You're almost there!</DIV><DIV>&nbsp;</DIV><DIV>You need an RdbKey ("Relational Database Key"). Remember that an EdmKey&nbsp;doesn't necessarily point to a database. You're going to have to ask it to&nbsp;make an RdbKey for you if it can. It will if it refers to a database; it won't if it can't.</DIV><DIV>&nbsp;</DIV><DIV>Ok ... if all you want is the database connection string, you can stop right now and get it from the edmKey. You found this out already. The phrase is "edmKey.DbConnectionString".</DIV><DIV>&nbsp;</DIV><DIV>But I want you to consider using AdoHelper. So we will proceed to manufacture an RdbKey like so:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; var rdbKey = edmKey.RdbKey as IdeaBlade.Ado.<FONT color=#2b91af>RdbKey</FONT>;</DIV><DIV>&nbsp;</DIV><DIV>Now you can write:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; var adoHelper = new IdeaBlade.Ado.<FONT color=#2b91af>AdoHelper</FONT>(rdbKey);</DIV><DIV>&nbsp;</DIV><DIV>===</DIV><DIV>Why is this "really ugly" as you say?</DIV><DIV>&nbsp;</DIV><DIV>I half explained at the top of this post but it bears repeating. The point of using infrastructure like DevForce and EntityFramework (and all of the others) is to decouple your application from the database.</DIV><DIV>&nbsp;</DIV><DIV>We make it possible for you to have one object model that is built from multiple datasources, some of them databases and some of them not. We make it possible for you to specify and dynamically swap database instances for different environments (dev / test / stage / production) or for multiple tenant applications or because one instance of your application will run against SQL Server and another against DB2 or Oracle ...</DIV><DIV>&nbsp;</DIV><DIV>... and you don't have to change your code.</DIV><DIV>&nbsp;</DIV><DIV>IF you start programming in a database-specific way, all our attempts at decoupling are for naught.</DIV><DIV>&nbsp;</DIV><DIV>When you have to reach the database directly, you certainly can. It just takes some effort to defeat the decoupling that usually works in your favor.</DIV><DIV>&nbsp;</DIV><DIV>I hope that both answers your question and explains why it seems so baroque.</DIV></FONT>]]>
   </description>
   <pubDate>Fri, 29 Jan 2010 19:44:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6154#6154</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Well I cracked it...although realy...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6151#6151</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 29-Jan-2010 at 6:51am<br /><br />Well I cracked it...although realy ugly:<DIV><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> dbConnectionString = ((IdeaBlade.EntityModel.Edm.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EdmKey</FONT></FONT><FONT size=2>)eMgr.DataSourceResolver.DataSourceKeys.ElementAt(0)).DbConnectionString;</P><DIV></DIV><DIV></DIV>Is there no way geting access directly to the Connectoin object that I can use directly by DB2Command?</FONT></DIV>]]>
   </description>
   <pubDate>Fri, 29 Jan 2010 06:51:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6151#6151</guid>
  </item> 
  <item>
   <title>Connection object or string in Entity Manager : Hi, Is there any way to access...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6150#6150</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 1632<br /><strong>Posted:</strong> 29-Jan-2010 at 6:33am<br /><br /><P>Hi,</P><DIV></DIV>Is there any way to access the Connection object directly from Entity Manager. I se by debugging that the Connection String is deep down in the class hiracy of EntityManager, but it is private there. Can I somehow get access to that string read only. I need this because I have a very complex business object where LINQ to Entities cant do what I need. Therefore I intend to access the database in this case with an old fashion DataReader (calling SQL queries or Stored Procedures) and using <FONT size=2>InvokeServerMethodAsync() to access it from the SL client. I'm using IBM Informix therefore I would like to do something like this on&nbsp;server side:<DIV></DIV><DIV></DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2><FONT size=2><P>&#091;</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>AllowRpc</FONT></FONT><FONT size=2>&#093;</P><DIV></FONT>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>static</FONT></FONT><FONT size=2>&nbsp;</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>SomeReturnStuff</FONT></FONT><FONT size=2> GetMenu(</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>IPrincipal</FONT></FONT><FONT size=2> pPrincipal,</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EntityManager</FONT></FONT><FONT size=2> eMgr,</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>params</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>Object</FONT></FONT><FONT size=2>&#091;&#093; args){</FONT></DIV><DIV><FONT size=2>&nbsp;&nbsp;&nbsp;string&nbsp;dbConnectString = eMgr.<FONT size=2>DataSourceResolver.GetTheDatabaseConnectionString(); //&nbsp;This call does not exist</FONT><BR>&nbsp;&nbsp; </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>DB2Connection</FONT></FONT><FONT size=2> con = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>DB2Connection</FONT></FONT><FONT size=2>(</FONT><FONT size=2><FONT size=2>dbConnectString </FONT></FONT><FONT size=2>);<BR>&nbsp;&nbsp; </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>DB2Command</FONT></FONT><FONT size=2> cmd = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>DB2Command</FONT></FONT><FONT size=2>();<BR>&nbsp;&nbsp; <FONT size=2>cmd.Connection = con;<BR>&nbsp;&nbsp; cmd.CommandType = System.Data.</FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>CommandType</FONT></FONT><FONT size=2>.Text;<BR>&nbsp;&nbsp; cmd.CommandText = </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"SELECT..."</FONT></FONT><FONT size=2>;<BR>&nbsp;&nbsp; .....<BR>&nbsp;&nbsp; return something;<BR>}</FONT></DIV></FONT></FONT>]]>
   </description>
   <pubDate>Fri, 29 Jan 2010 06:33:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1632&amp;PID=6150#6150</guid>
  </item> 
 </channel>
</rss>