<?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 : Typeless PassthruEsqlQuery?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Typeless PassthruEsqlQuery?</description>
  <pubDate>Mon, 13 Apr 2026 12:29:16 -700</pubDate>
  <lastBuildDate>Fri, 18 Mar 2011 12:17:25 -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=2560</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>Typeless PassthruEsqlQuery? : Thanks - that should be very helpful!...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10205#10205</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 2560<br /><strong>Posted:</strong> 18-Mar-2011 at 12:17pm<br /><br /><div><br></div>Thanks - that should be very helpful!<div><br></div>]]>
   </description>
   <pubDate>Fri, 18 Mar 2011 12:17:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10205#10205</guid>
  </item> 
  <item>
   <title>Typeless PassthruEsqlQuery? :  Hi chuckc;Unfortunately, there...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10199#10199</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> 2560<br /><strong>Posted:</strong> 17-Mar-2011 at 3:43pm<br /><br />Hi chuckc;<div><br></div><div>Unfortunately, there is currently no ADO.Net helper in DevForce and we don't have any examples on our code samples either. I have opened a feature request to add more documentation and code samples regarding this.<div><br></div><div>Fortunately, to do raw ADO.Net with DevForce is pretty simple and below is a code snippet showing you how to do it.</div></div><div><br></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><table width="99%"><tr><td><pre class="BBcode"></span></div><div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;public void UsingRawAdoWithDF() {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;string dsKeyName = "NorthwindIBEntityManager";</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//Extract EdmKey</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;EdmKey edmKey = GetEdmKey(dsKeyName);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//Create raw ADO.Net Db connection using EdmKey</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;System.Data.IDbConnection aConnection = CreateDbConnection(edmKey);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//Execute some Sql commands</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;ExecuteSqlCommand(aConnection);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;private EdmKey GetEdmKey(string dsKeyName) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;var mgr = new NorthwindIBEntityManager();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;EdmKey testEdmKey = EdmKey.LocateEdmKey(dsKeyName);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;var dataSourceKey = mgr.DataSourceResolver.GetDataSourceKey(dsKeyName);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//If this is done on the client, it will return a ClientEdmKey</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//If this is done on the server, it will return an EdmKey</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;//Ideally, you want to do this on the server</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;ClientEdmKey clientEdmKey = (ClientEdmKey)dataSourceKey;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;EdmKey edmKey = new EdmKey(clientEdmKey);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;return edmKey;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;private System.Data.Common.DbConnection CreateDbConnection(EdmKey edmKey) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;var providerName = edmKey.DbProviderName;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;var connectionString = edmKey.DbConnectionString;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;var providerFactory = System.Data.Common.DbProviderFactories.GetFactory(providerName);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;System.Data.Common.DbConnection connection = providerFactory.CreateConnection();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;connection.ConnectionString = connectionString;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;return connection;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;private void ExecuteSqlCommand(System.Data.IDbConnection aConnection) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;const String sqlSelect = "select UserName from dbo.&#091;User&#093; where FirstName = 'Admin'";</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;const String sqlUpdate = "update dbo.&#091;User&#093; set UserName={0} where FirstName = 'Admin'";</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;aConnection.Open();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;using (aConnection) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.Data.IDbCommand aCommand = CreateDbCommand(aConnection);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;aCommand.CommandText = sqlSelect;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.Data.IDataReader aDataReader = aCommand.ExecuteReader();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (!aDataReader.Read()) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw new IdeaBladeException("Unable to locate record");</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Object tmp = aDataReader.GetValue(0);</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;aDataReader.Close();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;//Execute sqlUpdate</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;aCommand.CommandText = String.Format(sqlUpdate, "'adminxxx'");</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int numOfRowsAffected = aCommand.ExecuteNonQuery();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;private System.Data.Common.DbCommand CreateDbCommand(System.Data.IDbConnection connection) {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;if (connection.State != System.Data.ConnectionState.Open) connection.Open();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;System.Data.IDbCommand command = connection.CreateCommand();</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;try {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return (System.Data.Common.DbCommand)command;</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;} catch {</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;throw new IdeaBladeException("Unable to cast a DbCommand object from an IDbCommand for current connection");</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp; &nbsp;}</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px;">&nbsp;&nbsp; &nbsp;}</span></div></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "></pre></td></tr></table></span></div>]]>
   </description>
   <pubDate>Thu, 17 Mar 2011 15:43:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10199#10199</guid>
  </item> 
  <item>
   <title>Typeless PassthruEsqlQuery? : Dang.Any suggestions or examples...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10188#10188</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 2560<br /><strong>Posted:</strong> 16-Mar-2011 at 6:54pm<br /><br />Dang.<div><br></div><div>Any suggestions or examples on how best to approach mixing ADO.Net with DevForce? &nbsp;How to deal with connectionstrings? &nbsp;Is there any ADO.Net helper stuff baked into DevForce?</div><div><br></div><div>Thanks!</div>]]>
   </description>
   <pubDate>Wed, 16 Mar 2011 18:54:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10188#10188</guid>
  </item> 
  <item>
   <title>Typeless PassthruEsqlQuery? : Hi chuckc;Unfortunately, PassthruEsqlQuery...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10186#10186</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> 2560<br /><strong>Posted:</strong> 16-Mar-2011 at 4:30pm<br /><br />Hi chuckc;<div><br></div><div>Unfortunately, PassthruEsqlQuery requires a typed entity and PassthruEsqlQuerySurrogate is an internal class to help with the serialization so it won't be useful in this case.</div><div><br></div><div>The best suggestion I can give at this time, is to use a combination of <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/POCOs" target="_blank">DevForce POCOs</a> with raw ADO.NET within your query and save logic.</div><div><br></div><div>Hope this helps.</div>]]>
   </description>
   <pubDate>Wed, 16 Mar 2011 16:30:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10186#10186</guid>
  </item> 
  <item>
   <title>Typeless PassthruEsqlQuery? : I am implementing an audit history...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10178#10178</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 2560<br /><strong>Posted:</strong> 15-Mar-2011 at 7:49pm<br /><br /><div>I am implementing an audit history using "shadow" tables - i.e. separate tables that mirror a primary table but with additional tracking columns for modifying user, datetime of change, etc. &nbsp;I would like to avoid creating and maintaining classes for these shadow tables, since they will be identical to the primary table except for an additional column or two. &nbsp;With that in mind, how can I use DevForce to work with these shadow tables? &nbsp;</div><div><br></div><div>Is it possible to somehow return a dataset using PassthruEsqlQuery instead of a typed entity collection? &nbsp;I could then use that dataset to populate new primary entities with values from the shadow tables.</div><div><br></div><div>Might PassthruEsqlQuerySurrogate be of use? &nbsp;It looks intriguing, but I can find no documentation on it.</div><div><br></div><div>Recommendations?&nbsp;</div><div><br></div><div>Thanks!</div><div><br></div>]]>
   </description>
   <pubDate>Tue, 15 Mar 2011 19:49:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2560&amp;PID=10178#10178</guid>
  </item> 
 </channel>
</rss>