<?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"
	>
<channel>
	<title>Comments for Craig Stuntz's Weblog</title>
	<atom:link href="http://blogs.teamb.com/craigstuntz/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.teamb.com/craigstuntz</link>
	<description>C# • Delphi • Entity Framework • Functional Programming • InterBase • MVC • .NET • Web</description>
	<pubDate>Tue, 16 Mar 2010 17:41:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>Comment on Don&#8217;t Depend Upon the ASP.NET Membership Tables by Asad Ali Butt</title>
		<link>http://blogs.teamb.com/craigstuntz/2010/03/05/38558/#comment-15030</link>
		<dc:creator>Asad Ali Butt</dc:creator>
		<pubDate>Mon, 15 Mar 2010 23:05:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38558#comment-15030</guid>
		<description>Really something we do not take into account, while we implement authentication modules. Thanks for highlighting the facts. do appriciate</description>
		<content:encoded><![CDATA[<p>Really something we do not take into account, while we implement authentication modules. Thanks for highlighting the facts. do appriciate</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on join in LINQ to SQL and LINQ to Entities Considered Messy, Redundant by AL</title>
		<link>http://blogs.teamb.com/craigstuntz/2010/01/13/38525/#comment-14793</link>
		<dc:creator>AL</dc:creator>
		<pubDate>Thu, 04 Mar 2010 11:12:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38525#comment-14793</guid>
		<description>Thank you for your informative response.
I asked you for a query to left join Customers and Orders and you gave it.

Simply adding DefaultIfEmpty() to the inner join syntax does the trick, although you spent so much time deprecating it in the original article.

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; My goal is to get LINQ users to think in terms of object graphs rather than relational sets. It's a critical difference which many miss because LINQ looks so much like SQL. But if &lt;/em&gt;your&lt;em&gt; goal is to throw the results into a visual control designed for a relational set, then there's nothing particularly wrong with it.&lt;/em&gt;&lt;/blockquote&gt;

I find it quite reasonable to want a result set that looks like 

select t1.ContactName, t2.Freight from Customers t1
left join Orders t2 on t1.CustomerID = t2.CustomerID</description>
		<content:encoded><![CDATA[<p>Thank you for your informative response.<br />
I asked you for a query to left join Customers and Orders and you gave it.</p>
<p>Simply adding DefaultIfEmpty() to the inner join syntax does the trick, although you spent so much time deprecating it in the original article.</p>
<blockquote><p><em><strong>Response:</strong> My goal is to get LINQ users to think in terms of object graphs rather than relational sets. It&#8217;s a critical difference which many miss because LINQ looks so much like SQL. But if </em>your<em> goal is to throw the results into a visual control designed for a relational set, then there&#8217;s nothing particularly wrong with it.</em></p></blockquote>
<p>I find it quite reasonable to want a result set that looks like </p>
<p>select t1.ContactName, t2.Freight from Customers t1<br />
left join Orders t2 on t1.CustomerID = t2.CustomerID</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on join in LINQ to SQL and LINQ to Entities Considered Messy, Redundant by AL</title>
		<link>http://blogs.teamb.com/craigstuntz/2010/01/13/38525/#comment-14724</link>
		<dc:creator>AL</dc:creator>
		<pubDate>Tue, 02 Mar 2010 23:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38525#comment-14724</guid>
		<description>Aren't we cheating somewhat here ?

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; I don't think so, but then again, my goal is not to "immediately chuck the result set into a DataGridView." Yours might be, which is fine, but that just means your needs are different than mine. As for how to meet your needs, read on...&lt;/em&gt;&lt;/blockquote&gt;

In the self referencing Table Employees the field ReportsTo is nullable and actually contains nulls.
It is unusual for a foreign key to be nullable between 2 SEPARATE tables.
Try left joining Customers and Orders.
Although CustomerID in Orders is nullable, there are no Orders without a CustomerID.

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; Not in the data delivered with Northwind, no, but it's certainly possible.&lt;/em&gt;&lt;/blockquote&gt;

If Orders is the left table, an inner join and an outer join produce the same result anyway, and yield only those customers who have placed orders.
If Customer is the left table, the fields of Customer.Order are inaccesible.

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; That is wrong, on several counts. First, the property is &lt;code&gt;Order&lt;b&gt;s&lt;/b&gt;&lt;/code&gt;, not &lt;code&gt;Order&lt;/code&gt;. It's 1..*, not 1..1. Second, you certainly can use the properties of &lt;code&gt;Orders&lt;/code&gt; in a query. The following query works fine, for example:&lt;/em&gt;
&lt;code&gt;            var q = from c in context.Customers
                    from o in c.Orders
                    select new
                    {
                        Name = c.ContactName,
                        Freight = o.Freight
                    };&lt;/code&gt;&lt;/blockquote&gt;

It requires a nested foreach to convert the result set to a List. 

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt;No. What I &lt;/em&gt;think&lt;em&gt; you're trying to say is "I don't know how to convert the result to a "flattened, SQL-like" tabular result set instead of an "object-like," hierarchical tree of customers and orders without a nested foreach (or a &lt;code&gt;join&lt;/code&gt;). But it's quite possible. I've already shown the "inner join" version above. Here's the "left join" version: &lt;/em&gt;
&lt;code&gt;            var q = from c in context.Customers
                    from o in c.Orders.DefaultIfEmpty()
                    select new
                    {
                        Name = c.ContactName,
                        Freight = o.Freight
                    };&lt;/code&gt;&lt;/blockquote&gt;

I wouldn't describe this as an improvement over 'join' where I can immediately chuck the result set into a DataGridView.

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt;See the query above. This isn't how I'd do it, because most use cases of such tabular result forms tend to want to group them back into hierarchies anyway (think of every reporting tool ever created). But it's certainly possible. And again, the &lt;code&gt;join&lt;/code&gt; is just noise. The association properties make it redundant and messy.&lt;/em&gt;&lt;/blockquote&gt;

Maybe you have an elegant solution to left joining Customers with Orders, i.e showing ALL Customers with or without Order details ?</description>
		<content:encoded><![CDATA[<p>Aren&#8217;t we cheating somewhat here ?</p>
<blockquote><p><em><strong>Response:</strong> I don&#8217;t think so, but then again, my goal is not to "immediately chuck the result set into a DataGridView." Yours might be, which is fine, but that just means your needs are different than mine. As for how to meet your needs, read on&#8230;</em></p></blockquote>
<p>In the self referencing Table Employees the field ReportsTo is nullable and actually contains nulls.<br />
It is unusual for a foreign key to be nullable between 2 SEPARATE tables.<br />
Try left joining Customers and Orders.<br />
Although CustomerID in Orders is nullable, there are no Orders without a CustomerID.</p>
<blockquote><p><em><strong>Response:</strong> Not in the data delivered with Northwind, no, but it&#8217;s certainly possible.</em></p></blockquote>
<p>If Orders is the left table, an inner join and an outer join produce the same result anyway, and yield only those customers who have placed orders.<br />
If Customer is the left table, the fields of Customer.Order are inaccesible.</p>
<blockquote><p><em><strong>Response:</strong> That is wrong, on several counts. First, the property is <code>Order<b>s</b></code>, not <code>Order</code>. It&#8217;s 1..*, not 1..1. Second, you certainly can use the properties of <code>Orders</code> in a query. The following query works fine, for example:</em><br />
<code>            var q = from c in context.Customers<br />
                    from o in c.Orders<br />
                    select new<br />
                    {<br />
                        Name = c.ContactName,<br />
                        Freight = o.Freight<br />
                    };</code></p></blockquote>
<p>It requires a nested foreach to convert the result set to a List. </p>
<blockquote><p><em><strong>Response:</strong>No. What I </em>think<em> you&#8217;re trying to say is "I don&#8217;t know how to convert the result to a "flattened, SQL-like" tabular result set instead of an "object-like," hierarchical tree of customers and orders without a nested foreach (or a <code>join</code>). But it&#8217;s quite possible. I&#8217;ve already shown the "inner join" version above. Here&#8217;s the "left join" version: </em><br />
<code>            var q = from c in context.Customers<br />
                    from o in c.Orders.DefaultIfEmpty()<br />
                    select new<br />
                    {<br />
                        Name = c.ContactName,<br />
                        Freight = o.Freight<br />
                    };</code></p></blockquote>
<p>I wouldn&#8217;t describe this as an improvement over &#8216;join&#8217; where I can immediately chuck the result set into a DataGridView.</p>
<blockquote><p><em><strong>Response:</strong>See the query above. This isn&#8217;t how I&#8217;d do it, because most use cases of such tabular result forms tend to want to group them back into hierarchies anyway (think of every reporting tool ever created). But it&#8217;s certainly possible. And again, the <code>join</code> is just noise. The association properties make it redundant and messy.</em></p></blockquote>
<p>Maybe you have an elegant solution to left joining Customers with Orders, i.e showing ALL Customers with or without Order details ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Generics, Commas, and Semicolons by Surendran Bangalore</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-13935</link>
		<dc:creator>Surendran Bangalore</dc:creator>
		<pubDate>Fri, 05 Feb 2010 08:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-13935</guid>
		<description>With reg. to my post above. 

I think, the angle brackets (for generics code my my pasted code) is being removed while rendering html (I mean I pasted the full code but found that the "" are not coming.
Pasting the line again below,

"TPair= class   // declares TPair type with two type parameters"</description>
		<content:encoded><![CDATA[<p>With reg. to my post above. </p>
<p>I think, the angle brackets (for generics code my my pasted code) is being removed while rendering html (I mean I pasted the full code but found that the "" are not coming.<br />
Pasting the line again below,</p>
<p>"TPair= class   // declares TPair type with two type parameters"</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Generics, Commas, and Semicolons by Surendran Bangalore</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/02/09/38000/#comment-13934</link>
		<dc:creator>Surendran Bangalore</dc:creator>
		<pubDate>Fri, 05 Feb 2010 08:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38000#comment-13934</guid>
		<description>One question in Delphi 2010, the help section mentions only commas (not semi colons) at the declaration section I am pasting the link and code section also.

Am I missing anything? Could you please explain reg. the discrepancy?

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; Because the comma and the semicolon mean different things. Read Rudy's comment above (plus the discussions which follow); does that explain it for you?&lt;/em&gt;&lt;/blockquote&gt;

Delphi 2010 help section
=================
ms-help://embarcadero.rs2010/rad/Overview_of_Generics.html

Code Example
==========
&lt;code&gt;type
  TPair= class&#60;TKey; TValue&#62;   // declares TPair type with two type parameters

  private
    FKey: TKey;
    FValue: TValue;
  public
    function GetKey: TKey;
    procedure SetKey(Key: TKey);
    function GetValue: TValue;
    procedure SetValue(Value: TValue);
    property Key: TKey read GetKey write SetKey;
    property Value: TValue read GetValue write SetValue;
  end;

type
  TSIPair = TPair; // declares instantiated type
  TSSPair = TPair;  // declares with other data types
  TISPair = TPair;
  TIIPair = TPair;
  TSXPair = TPair;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>One question in Delphi 2010, the help section mentions only commas (not semi colons) at the declaration section I am pasting the link and code section also.</p>
<p>Am I missing anything? Could you please explain reg. the discrepancy?</p>
<blockquote><p><em><strong>Response:</strong> Because the comma and the semicolon mean different things. Read Rudy&#8217;s comment above (plus the discussions which follow); does that explain it for you?</em></p></blockquote>
<p>Delphi 2010 help section<br />
=================<br />
ms-help://embarcadero.rs2010/rad/Overview_of_Generics.html</p>
<p>Code Example<br />
==========<br />
<code>type<br />
  TPair= class&lt;TKey; TValue&gt;   // declares TPair type with two type parameters</p>
<p>  private<br />
    FKey: TKey;<br />
    FValue: TValue;<br />
  public<br />
    function GetKey: TKey;<br />
    procedure SetKey(Key: TKey);<br />
    function GetValue: TValue;<br />
    procedure SetValue(Value: TValue);<br />
    property Key: TKey read GetKey write SetKey;<br />
    property Value: TValue read GetValue write SetValue;<br />
  end;</p>
<p>type<br />
  TSIPair = TPair; // declares instantiated type<br />
  TSSPair = TPair;  // declares with other data types<br />
  TISPair = TPair;<br />
  TIIPair = TPair;<br />
  TSXPair = TPair;</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using jqGrid with ASP.NET MVC: Search and Formatting by Eran</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/04/27/38243/#comment-13735</link>
		<dc:creator>Eran</dc:creator>
		<pubDate>Sun, 31 Jan 2010 18:32:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38243#comment-13735</guid>
		<description>anyone got it working with nhibernate.linq provider?</description>
		<content:encoded><![CDATA[<p>anyone got it working with nhibernate.linq provider?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on join in LINQ to SQL and LINQ to Entities Considered Messy, Redundant by chris</title>
		<link>http://blogs.teamb.com/craigstuntz/2010/01/13/38525/#comment-13674</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Fri, 29 Jan 2010 15:58:39 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38525#comment-13674</guid>
		<description>Craig - 

I think a lot of people have missed the significance of:

from s in context.Employees
  from e in s.Employees 

as a way of doing joins.  Once you understand what you're looking at, it's obvious and makes perfect sense.   It might make sense to highlight this in a future post.  And again, thanks for the SO help.</description>
		<content:encoded><![CDATA[<p>Craig - </p>
<p>I think a lot of people have missed the significance of:</p>
<p>from s in context.Employees<br />
  from e in s.Employees </p>
<p>as a way of doing joins.  Once you understand what you&#8217;re looking at, it&#8217;s obvious and makes perfect sense.   It might make sense to highlight this in a future post.  And again, thanks for the SO help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on "My Application Dies on Server 2003" by Udi</title>
		<link>http://blogs.teamb.com/craigstuntz/2007/11/27/37772/#comment-13613</link>
		<dc:creator>Udi</dc:creator>
		<pubDate>Wed, 27 Jan 2010 13:38:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/2007/11/27/37772#comment-13613</guid>
		<description>My App. (Written with Delphi2010) dies few seconds after it starts.
I'm trying to run it on Windows 2003 Server ( NOT the R2 )  with SP2.

I've tried to disable the DEP (Changing the Boot.ini value from /noexecute=OptOut to AlwaysOff
But no sign that it helped.

Any other idea ?

Thanks,Udi

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response: &lt;/strong&gt;Yes, &lt;a href="http://blogs.teamb.com/craigstuntz/2008/02/15/37791/" title="Why an App Might Disappear Without Notice" rel="nofollow"&gt;several other ideas&lt;/a&gt;.&lt;/em&gt;&lt;/blockquote&gt;

</description>
		<content:encoded><![CDATA[<p>My App. (Written with Delphi2010) dies few seconds after it starts.<br />
I&#8217;m trying to run it on Windows 2003 Server ( NOT the R2 )  with SP2.</p>
<p>I&#8217;ve tried to disable the DEP (Changing the Boot.ini value from /noexecute=OptOut to AlwaysOff<br />
But no sign that it helped.</p>
<p>Any other idea ?</p>
<p>Thanks,Udi</p>
<blockquote><p><em><strong>Response: </strong>Yes, <a href="http://blogs.teamb.com/craigstuntz/2008/02/15/37791/" title="Why an App Might Disappear Without Notice" rel="nofollow">several other ideas</a>.</em></p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Customizing jQuery Validation by Teguh Eko Budiarto</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/01/15/37923/#comment-13611</link>
		<dc:creator>Teguh Eko Budiarto</dc:creator>
		<pubDate>Wed, 27 Jan 2010 10:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=37923#comment-13611</guid>
		<description>I was trying to create multi step form using tab approach, and need to validate each step without actually submitting the form.
This is exactly the remedy of my problem. Extending the required method to work only for the page that the user is in. THANK YOU!!!</description>
		<content:encoded><![CDATA[<p>I was trying to create multi step form using tab approach, and need to validate each step without actually submitting the form.<br />
This is exactly the remedy of my problem. Extending the required method to work only for the page that the user is in. THANK YOU!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Projecting Onto a Presentation Model with the Entity Framework and ASP.NET MVC by NW</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/12/31/38500/#comment-13591</link>
		<dc:creator>NW</dc:creator>
		<pubDate>Tue, 26 Jan 2010 20:30:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38500#comment-13591</guid>
		<description>I'm having an issue trying to project on to a presentation model where a parent object has a list of references to child objects. Let's say I have a Parent entity and a Child entity, and in the storage model, each Child has a reference to a single parent. In my presentation model, I want a PresentationParent to have a List. I'm trying to construct this with a query like so:

&lt;code&gt;from p in entities.Parent 
select new PresentationParent { 
    ID = p.ID, 
    Name = p.Name, 
    Age = p.Age, 
    Children = (from c in p.Children 
                select new PresentationChild { 
                    ID = c.ID, 
                    Name = c.Name, 
                    Age = c.Age 
                }).ToList() 
} &lt;/code&gt;

I get an exception at runtime when I try to enumerate the results that LINQ to Entities "doesn't recognize" the ToList() method. It works fine if I'm using LINQ to SQL. Is there a way to do this using LINQ to Entities?

&lt;blockquote&gt;&lt;em&gt;&lt;strong&gt;Response:&lt;/strong&gt; Your &lt;code&gt;ToList&lt;/code&gt; is in the wrong place. Try: &lt;/em&gt;

&lt;code&gt;from p in entities.Parent 
select new PresentationParent { 
    ID = p.ID, 
    Name = p.Name, 
    Age = p.Age, 
    Children = (from c in p.Children 
                select new PresentationChild { 
                    ID = c.ID, 
                    Name = c.Name, 
                    Age = c.Age 
                })
    }).ToList();
&lt;/code&gt;&lt;/blockquote&gt;

</description>
		<content:encoded><![CDATA[<p>I&#8217;m having an issue trying to project on to a presentation model where a parent object has a list of references to child objects. Let&#8217;s say I have a Parent entity and a Child entity, and in the storage model, each Child has a reference to a single parent. In my presentation model, I want a PresentationParent to have a List. I&#8217;m trying to construct this with a query like so:</p>
<p><code>from p in entities.Parent<br />
select new PresentationParent {<br />
    ID = p.ID,<br />
    Name = p.Name,<br />
    Age = p.Age,<br />
    Children = (from c in p.Children<br />
                select new PresentationChild {<br />
                    ID = c.ID,<br />
                    Name = c.Name,<br />
                    Age = c.Age<br />
                }).ToList()<br />
} </code></p>
<p>I get an exception at runtime when I try to enumerate the results that LINQ to Entities "doesn&#8217;t recognize" the ToList() method. It works fine if I&#8217;m using LINQ to SQL. Is there a way to do this using LINQ to Entities?</p>
<blockquote><p><em><strong>Response:</strong> Your <code>ToList</code> is in the wrong place. Try: </em></p>
<p><code>from p in entities.Parent<br />
select new PresentationParent {<br />
    ID = p.ID,<br />
    Name = p.Name,<br />
    Age = p.Age,<br />
    Children = (from c in p.Children<br />
                select new PresentationChild {<br />
                    ID = c.ID,<br />
                    Name = c.Name,<br />
                    Age = c.Age<br />
                })<br />
    }).ToList();<br />
</code></p></blockquote>
]]></content:encoded>
	</item>
</channel>
</rss>
