<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Extending Linq.</title>
	<atom:link href="http://peteohanlon.wordpress.com/2008/01/04/extending-linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/</link>
	<description>Confessions of a WPF lover</description>
	<lastBuildDate>Sat, 14 Nov 2009 07:45:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: peteohanlon</title>
		<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-53</link>
		<dc:creator>peteohanlon</dc:creator>
		<pubDate>Sat, 31 May 2008 18:37:05 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-53</guid>
		<description>Jammer - don&#039;t worry about it; we all have those doh moments.</description>
		<content:encoded><![CDATA[<p>Jammer &#8211; don&#8217;t worry about it; we all have those doh moments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jammer</title>
		<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-52</link>
		<dc:creator>Jammer</dc:creator>
		<pubDate>Fri, 30 May 2008 22:12:01 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-52</guid>
		<description>Ok ... scratch that ... what a complete dunce!!!  I was using an s instead of an S in my namespace name!!!!

HOW stupid can I get????</description>
		<content:encoded><![CDATA[<p>Ok &#8230; scratch that &#8230; what a complete dunce!!!  I was using an s instead of an S in my namespace name!!!!</p>
<p>HOW stupid can I get????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jammer</title>
		<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-51</link>
		<dc:creator>Jammer</dc:creator>
		<pubDate>Fri, 30 May 2008 22:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-51</guid>
		<description>Hi Pete,

I&#039;ve just finally gotten around to testing this.  Have you looked at using this with SQLCE?  I&#039;m just trying out your class but things aren&#039;t working ...

public DataSet GetDataSet()
{
    IQueryable q = GetAllQuery();
    return q.ToDataSet(context.GetCommand(GetAllQuery()), null, &quot;MyTable&quot;);
} 

I&#039;m not seeing ToDataSet hanging off the q variable.

strange ...</description>
		<content:encoded><![CDATA[<p>Hi Pete,</p>
<p>I&#8217;ve just finally gotten around to testing this.  Have you looked at using this with SQLCE?  I&#8217;m just trying out your class but things aren&#8217;t working &#8230;</p>
<p>public DataSet GetDataSet()<br />
{<br />
    IQueryable q = GetAllQuery();<br />
    return q.ToDataSet(context.GetCommand(GetAllQuery()), null, &#8220;MyTable&#8221;);<br />
} </p>
<p>I&#8217;m not seeing ToDataSet hanging off the q variable.</p>
<p>strange &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ramanathan</title>
		<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-48</link>
		<dc:creator>ramanathan</dc:creator>
		<pubDate>Sat, 26 Apr 2008 12:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-48</guid>
		<description>Pl.help for vb.net 

Tried it with this code not able to convert into data table


Dim q As IQueryable(Of Account) = From c In db.Accounts Select c
        Dim hg As New LinqDataExtensions
        Dim t As DataTable = hg.ToDataTable(q, Nothing, &quot;Account&quot;)
        DataGridView1.DataSource = t &#039;(From c In db.Accounts Select c).ToList



    Public Class LinqDataExtensions

        Public Shared Function ToDataTable(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal tableName As String) As DataTable

            &#039; 
            &#039; Add the ability to return a DataTable based on a particular query
            &#039; to a queryable object.
            &#039; 
            &#039; The IQueryable object to extend.
            &#039; The query to execute.
            &#039; The name of the datatable to be added.
            &#039; The populated DataTable.

            If query Is Nothing Then Throw New ArgumentException(&quot;query&quot;)
            Dim cmd As SqlCommand = CType(query, SqlCommand)
            Dim adapter As SqlDataAdapter = New SqlDataAdapter()
            adapter.SelectCommand = cmd
            Dim dt As DataTable = New DataTable(tableName)
            Try
                cmd.Connection.Open()
                adapter.Fill(dt)
            Catch ex As Exception
                Throw New ArgumentException(&quot;query&quot;)
            Finally
                cmd.Connection.Close()
            End Try
            Return dt
        End Function

        &#039; 
        &#039; Add the ability to return a DataSet based on a particular query
        &#039; to a queryable object.
        &#039; 
        &#039; The IQueryable object to extend.
        &#039; The query to execute.
        &#039; The name of the DataTable to be added.
        &#039; The populated dataset.

        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal tableName As String) As DataSet
            If query Is Nothing Then Throw New ArgumentException(&quot;query&quot;)
            Return ToDataSet(extenderItem, query, Nothing, tableName)
        End Function

        &#039; 
        &#039; Add the ability to return a dataset based on a particular query
        &#039; to a queryable object.
        &#039; 
        &#039; The IQueryable object to extend.
        &#039; A generic dictionary containing the
        &#039; query to execute along with the name of the table to add it to.
        &#039; The populated dataset.

        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As Dictionary(Of String, DbCommand)) As DataSet
            If query Is Nothing Then Throw New ArgumentException(&quot;query&quot;)
            If query.Count = 0 Then Throw New ArgumentException(&quot;query&quot;)
            Return ToDataSet(extenderItem, query, Nothing)
        End Function

        &#039; 
        &#039; Add the ability to return a dataset based on a particular query   &#039; to a queryable object.
        &#039; 
        &#039; The IQueryable object to extend.
        &#039; A generic dictionary containing the
        &#039; query to execute along with the name of the table to add it to.
        &#039; An optional DataSet. This allows application
        &#039; to add multiple tables to the dataset.
        &#039; The populated dataset.

        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As Dictionary(Of String, DbCommand), ByVal _dataSet As DataSet) As DataSet
            If query Is Nothing Then Throw New ArgumentException(&quot;query&quot;)
            If query.Count = 0 Then Throw New ArgumentException(&quot;query&quot;)
            If _dataSet Is Nothing Then _dataSet = New DataSet
            For Each kvp As KeyValuePair(Of String, DbCommand) In query
                _dataSet = LinqDataExtensions.ToDataSet(extenderItem, kvp.Value, _dataSet, kvp.Key)
            Next
            Return _dataSet
        End Function

        &#039; 
        &#039; Add the ability to return a dataset based on a particular
        &#039; query to a queryable object.
        &#039; 
        &#039; The IQueryable object to extend.
        &#039; The query to execute.
        &#039; An optional DataSet. This allows
        &#039; application to add multiple tables to the dataset.
        &#039; The name of the DataTable to be added.
        &#039; The populated dataset.

        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal _dataSet As DataSet, ByVal tableName As String) As DataSet
            If query Is Nothing Then Throw New ArgumentException(&quot;query&quot;)
            If _dataSet Is Nothing Then
                _dataSet = New DataSet
                Dim tbl As DataTable = LinqDataExtensions.ToDataTable(extenderItem, query, tableName)
                If tbl IsNot Nothing Then
                    If _dataSet.Tables.Contains(tableName) Then
                        _dataSet.Tables.Remove(tableName)
                        _dataSet.Tables.Add(tbl)
                    End If
                    Return _dataSet
                End If
            End If
            Return Nothing
        End Function
    End Class</description>
		<content:encoded><![CDATA[<p>Pl.help for vb.net </p>
<p>Tried it with this code not able to convert into data table</p>
<p>Dim q As IQueryable(Of Account) = From c In db.Accounts Select c<br />
        Dim hg As New LinqDataExtensions<br />
        Dim t As DataTable = hg.ToDataTable(q, Nothing, &#8220;Account&#8221;)<br />
        DataGridView1.DataSource = t &#8216;(From c In db.Accounts Select c).ToList</p>
<p>    Public Class LinqDataExtensions</p>
<p>        Public Shared Function ToDataTable(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal tableName As String) As DataTable</p>
<p>            &#8216;<br />
            &#8216; Add the ability to return a DataTable based on a particular query<br />
            &#8216; to a queryable object.<br />
            &#8216;<br />
            &#8216; The IQueryable object to extend.<br />
            &#8216; The query to execute.<br />
            &#8216; The name of the datatable to be added.<br />
            &#8216; The populated DataTable.</p>
<p>            If query Is Nothing Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            Dim cmd As SqlCommand = CType(query, SqlCommand)<br />
            Dim adapter As SqlDataAdapter = New SqlDataAdapter()<br />
            adapter.SelectCommand = cmd<br />
            Dim dt As DataTable = New DataTable(tableName)<br />
            Try<br />
                cmd.Connection.Open()<br />
                adapter.Fill(dt)<br />
            Catch ex As Exception<br />
                Throw New ArgumentException(&#8220;query&#8221;)<br />
            Finally<br />
                cmd.Connection.Close()<br />
            End Try<br />
            Return dt<br />
        End Function</p>
<p>        &#8216;<br />
        &#8216; Add the ability to return a DataSet based on a particular query<br />
        &#8216; to a queryable object.<br />
        &#8216;<br />
        &#8216; The IQueryable object to extend.<br />
        &#8216; The query to execute.<br />
        &#8216; The name of the DataTable to be added.<br />
        &#8216; The populated dataset.</p>
<p>        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal tableName As String) As DataSet<br />
            If query Is Nothing Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            Return ToDataSet(extenderItem, query, Nothing, tableName)<br />
        End Function</p>
<p>        &#8216;<br />
        &#8216; Add the ability to return a dataset based on a particular query<br />
        &#8216; to a queryable object.<br />
        &#8216;<br />
        &#8216; The IQueryable object to extend.<br />
        &#8216; A generic dictionary containing the<br />
        &#8216; query to execute along with the name of the table to add it to.<br />
        &#8216; The populated dataset.</p>
<p>        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As Dictionary(Of String, DbCommand)) As DataSet<br />
            If query Is Nothing Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            If query.Count = 0 Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            Return ToDataSet(extenderItem, query, Nothing)<br />
        End Function</p>
<p>        &#8216;<br />
        &#8216; Add the ability to return a dataset based on a particular query   &#8216; to a queryable object.<br />
        &#8216;<br />
        &#8216; The IQueryable object to extend.<br />
        &#8216; A generic dictionary containing the<br />
        &#8216; query to execute along with the name of the table to add it to.<br />
        &#8216; An optional DataSet. This allows application<br />
        &#8216; to add multiple tables to the dataset.<br />
        &#8216; The populated dataset.</p>
<p>        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As Dictionary(Of String, DbCommand), ByVal _dataSet As DataSet) As DataSet<br />
            If query Is Nothing Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            If query.Count = 0 Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            If _dataSet Is Nothing Then _dataSet = New DataSet<br />
            For Each kvp As KeyValuePair(Of String, DbCommand) In query<br />
                _dataSet = LinqDataExtensions.ToDataSet(extenderItem, kvp.Value, _dataSet, kvp.Key)<br />
            Next<br />
            Return _dataSet<br />
        End Function</p>
<p>        &#8216;<br />
        &#8216; Add the ability to return a dataset based on a particular<br />
        &#8216; query to a queryable object.<br />
        &#8216;<br />
        &#8216; The IQueryable object to extend.<br />
        &#8216; The query to execute.<br />
        &#8216; An optional DataSet. This allows<br />
        &#8216; application to add multiple tables to the dataset.<br />
        &#8216; The name of the DataTable to be added.<br />
        &#8216; The populated dataset.</p>
<p>        Public Shared Function ToDataSet(ByVal extenderItem As IQueryable, ByVal query As DbCommand, ByVal _dataSet As DataSet, ByVal tableName As String) As DataSet<br />
            If query Is Nothing Then Throw New ArgumentException(&#8220;query&#8221;)<br />
            If _dataSet Is Nothing Then<br />
                _dataSet = New DataSet<br />
                Dim tbl As DataTable = LinqDataExtensions.ToDataTable(extenderItem, query, tableName)<br />
                If tbl IsNot Nothing Then<br />
                    If _dataSet.Tables.Contains(tableName) Then<br />
                        _dataSet.Tables.Remove(tableName)<br />
                        _dataSet.Tables.Add(tbl)<br />
                    End If<br />
                    Return _dataSet<br />
                End If<br />
            End If<br />
            Return Nothing<br />
        End Function<br />
    End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jammer</title>
		<link>http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-36</link>
		<dc:creator>Jammer</dc:creator>
		<pubDate>Wed, 26 Mar 2008 10:32:01 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/04/extending-linq/#comment-36</guid>
		<description>Brilliant!  Thanks Pete!</description>
		<content:encoded><![CDATA[<p>Brilliant!  Thanks Pete!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
