<?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/"
		>
<channel>
	<title>Comments for Damian Brady&#039;s Blog</title>
	<atom:link href="http://blog.damianbrady.com.au/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.damianbrady.com.au</link>
	<description>ramblings of an early-30s IT professional / volleyball junkie / semi-professional drinker</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:12:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Damian Brady</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-60417</link>
		<dc:creator>Damian Brady</dc:creator>
		<pubDate>Fri, 03 Feb 2012 01:12:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-60417</guid>
		<description>Yes, I&#039;m back in Brissy!
Posting the slides slipped my mind actually. I will set myself a reminder to do it today.</description>
		<content:encoded><![CDATA[<p>Yes, I&#8217;m back in Brissy!<br />
Posting the slides slipped my mind actually. I will set myself a reminder to do it today.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Rob</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-60416</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Fri, 03 Feb 2012 01:04:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-60416</guid>
		<description>Hey Damian, just wondering if you&#039;re back in Brissy yet and can post the slides? Thanks.</description>
		<content:encoded><![CDATA[<p>Hey Damian, just wondering if you&#8217;re back in Brissy yet and can post the slides? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Rob</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-59418</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 23 Jan 2012 22:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-59418</guid>
		<description>No worries, a hot topic so I&#039;m sure you&#039;ll be asked to present it a few more times around the traps. Thanks Damian.</description>
		<content:encoded><![CDATA[<p>No worries, a hot topic so I&#8217;m sure you&#8217;ll be asked to present it a few more times around the traps. Thanks Damian.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Damian Brady</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-59413</link>
		<dc:creator>Damian Brady</dc:creator>
		<pubDate>Mon, 23 Jan 2012 21:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-59413</guid>
		<description>Unfortunately no, it wasn&#039;t recorded. I will post the slides though when I get back to Brissy.
With any luck that won&#039;t be the last time I do it, so maybe next time!</description>
		<content:encoded><![CDATA[<p>Unfortunately no, it wasn&#8217;t recorded. I will post the slides though when I get back to Brissy.<br />
With any luck that won&#8217;t be the last time I do it, so maybe next time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Rob</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-59361</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Mon, 23 Jan 2012 03:12:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-59361</guid>
		<description>Can&#039;t make it unfortunately - is the presentation being recorded and/or are you going to post your presentation here afterwards?</description>
		<content:encoded><![CDATA[<p>Can&#8217;t make it unfortunately &#8211; is the presentation being recorded and/or are you going to post your presentation here afterwards?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Speaking at the Vic.Net User Group by Thomas James</title>
		<link>http://blog.damianbrady.com.au/2012/01/17/speaking-at-the-vic-net-user-group/comment-page-1/#comment-58885</link>
		<dc:creator>Thomas James</dc:creator>
		<pubDate>Wed, 18 Jan 2012 02:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=505#comment-58885</guid>
		<description>Looking forward to it given I missed it at DDD.</description>
		<content:encoded><![CDATA[<p>Looking forward to it given I missed it at DDD.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Generics for Lookup Tables in Entity Framework by Damian Brady</title>
		<link>http://blog.damianbrady.com.au/2011/08/16/using-generics-for-lookup-tables-in-entity-framework/comment-page-1/#comment-51179</link>
		<dc:creator>Damian Brady</dc:creator>
		<pubDate>Fri, 11 Nov 2011 01:00:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=458#comment-51179</guid>
		<description>Hi Eric,

Good question.  You could sort the records when they come back of course, but if you wanted to do it inside the method, there are probably a few options.

I haven&#039;t tested these, but:

1) You could overload the GetLookup method to accept an expression parameter you can use for sorting inside the method.

e.g.
public IEnumerable&lt;T&gt; GetLookup&lt;T&gt;(Expression&lt;Func&lt;T, int&gt;&gt; sortSelector) where T : System.Data.Objects.DataClasses.EntityObject {
...
return ((IQueryable&lt;T&gt;)query).OrderBy&lt;T,int&gt;(sortSelector).ToList();
}

Then just call it with:
var states = repository.GetLookup&lt;StateProvince&gt;(x =&gt; x.StateId);

Of course you&#039;d need an overload for each data type you&#039;d want to be able to sort on - the one above is for an int.

Or
2) You could return an IQueryable&lt;T&gt; instead of an IEnumerable&lt;T&gt; which would allow you to sort it at the calling end before resolving it.

e.g.
return query.AsQueryable();
instead of
return query.ToList();</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>Good question.  You could sort the records when they come back of course, but if you wanted to do it inside the method, there are probably a few options.</p>
<p>I haven&#8217;t tested these, but:</p>
<p>1) You could overload the GetLookup method to accept an expression parameter you can use for sorting inside the method.</p>
<p>e.g.<br />
public IEnumerable<t> GetLookup</t><t>(Expression<func <T, int>> sortSelector) where T : System.Data.Objects.DataClasses.EntityObject {<br />
&#8230;<br />
return ((IQueryable<t>)query).OrderBy</t><t ,int>(sortSelector).ToList();<br />
}</t></func></t></p>
<p>Then just call it with:<br />
var states = repository.GetLookup<stateprovince>(x => x.StateId);</stateprovince></p>
<p>Of course you&#8217;d need an overload for each data type you&#8217;d want to be able to sort on &#8211; the one above is for an int.</p>
<p>Or<br />
2) You could return an IQueryable<t> instead of an IEnumerable</t><t> which would allow you to sort it at the calling end before resolving it.</t></p>
<p>e.g.<br />
return query.AsQueryable();<br />
instead of<br />
return query.ToList();</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Generics for Lookup Tables in Entity Framework by Eric</title>
		<link>http://blog.damianbrady.com.au/2011/08/16/using-generics-for-lookup-tables-in-entity-framework/comment-page-1/#comment-51174</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Thu, 10 Nov 2011 23:50:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=458#comment-51174</guid>
		<description>Damian thanks for the code, very helpful.  Any idea on how to include a sort in there?  Thanks</description>
		<content:encoded><![CDATA[<p>Damian thanks for the code, very helpful.  Any idea on how to include a sort in there?  Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Generics for Lookup Tables in Entity Framework by Damian Brady</title>
		<link>http://blog.damianbrady.com.au/2011/08/16/using-generics-for-lookup-tables-in-entity-framework/comment-page-1/#comment-49477</link>
		<dc:creator>Damian Brady</dc:creator>
		<pubDate>Fri, 21 Oct 2011 23:25:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=458#comment-49477</guid>
		<description>There is probably an equivalent object that you should use to restrict the type instead of EntityObject.

The danger with leaving this out is someone could call the method with any type. Of course they&#039;d get an exception, but it&#039;s best to avoid letting them do it in the first place. An error at compile time is much better than an error at runtime.</description>
		<content:encoded><![CDATA[<p>There is probably an equivalent object that you should use to restrict the type instead of EntityObject.</p>
<p>The danger with leaving this out is someone could call the method with any type. Of course they&#8217;d get an exception, but it&#8217;s best to avoid letting them do it in the first place. An error at compile time is much better than an error at runtime.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using Generics for Lookup Tables in Entity Framework by nate</title>
		<link>http://blog.damianbrady.com.au/2011/08/16/using-generics-for-lookup-tables-in-entity-framework/comment-page-1/#comment-49456</link>
		<dc:creator>nate</dc:creator>
		<pubDate>Fri, 21 Oct 2011 15:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.damianbrady.com.au/?p=458#comment-49456</guid>
		<description>I got it working. I did not need the following line--&gt;. where T : System.Data.Objects.DataClasses.EntityObject</description>
		<content:encoded><![CDATA[<p>I got it working. I did not need the following line&#8211;&gt;. where T : System.Data.Objects.DataClasses.EntityObject</p>
]]></content:encoded>
	</item>
</channel>
</rss>

