<?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 on: Actually Querying with the Specification Pattern</title>
	<atom:link href="http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/</link>
	<description>Thoughts while working and playing as a Software Developer</description>
	<lastBuildDate>Thu, 11 Apr 2013 16:53:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Hosting company</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-322</link>
		<dc:creator>Hosting company</dc:creator>
		<pubDate>Fri, 03 Feb 2012 09:59:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-322</guid>
		<description>Very good programming language....Its a valuable things..</description>
		<content:encoded><![CDATA[<p>Very good programming language&#8230;.Its a valuable things..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hosting server</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-318</link>
		<dc:creator>hosting server</dc:creator>
		<pubDate>Wed, 11 Jan 2012 09:11:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-318</guid>
		<description>Most of the people looking for this kind of valuable tips.</description>
		<content:encoded><![CDATA[<p>Most of the people looking for this kind of valuable tips.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: web hosting companies</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-317</link>
		<dc:creator>web hosting companies</dc:creator>
		<pubDate>Tue, 10 Jan 2012 11:52:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-317</guid>
		<description>Your thoughts are also very good and i am very inspired from your post</description>
		<content:encoded><![CDATA[<p>Your thoughts are also very good and i am very inspired from your post</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hosting server</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-316</link>
		<dc:creator>hosting server</dc:creator>
		<pubDate>Thu, 05 Jan 2012 10:31:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-316</guid>
		<description>Above the Query is excellent written skills.I enjoyed to visit this kind of valuable tips.</description>
		<content:encoded><![CDATA[<p>Above the Query is excellent written skills.I enjoyed to visit this kind of valuable tips.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-134</link>
		<dc:creator>Paco</dc:creator>
		<pubDate>Wed, 16 Sep 2009 22:08:54 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-134</guid>
		<description>In that case, I would still go for the AreSatisfiedBy approach instead of the method in repository approach, because that decouples the specification form the type of collection to satisfy on. When the repository pattern is interpreted as &quot;Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.&quot; the repository should be an IEnumerable&lt;T&gt; and not have a method that returns an IEnumerable&lt;T&gt;

public interface IRepository&lt;T&gt; : IEnumerable&lt;T&gt;
{
}

The specification can be used as 
IEnumerable&lt;MyType&gt; result = new MySpecification().AreSatisfiedBy(repository)

instead of IEnumerable&lt;MyType&gt; result = repository.Get(new MySpecification());

there is nothing wrong with a Get method in the repository that has a specification as argument, but with the &quot;repository is a collection&quot; approach, the repository interface can be substituded by any other collection interface in both tests and the real code.</description>
		<content:encoded><![CDATA[<p>In that case, I would still go for the AreSatisfiedBy approach instead of the method in repository approach, because that decouples the specification form the type of collection to satisfy on. When the repository pattern is interpreted as &#8220;Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.&#8221; the repository should be an IEnumerable<t> and not have a method that returns an IEnumerable</t><t></p>
<p>public interface IRepository</t><t> : IEnumerable</t><t><br />
{<br />
}</p>
<p>The specification can be used as<br />
IEnumerable<mytype> result = new MySpecification().AreSatisfiedBy(repository)</p>
<p>instead of IEnumerable</mytype><mytype> result = repository.Get(new MySpecification());</p>
<p>there is nothing wrong with a Get method in the repository that has a specification as argument, but with the &#8220;repository is a collection&#8221; approach, the repository interface can be substituded by any other collection interface in both tests and the real code.</mytype></t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Missal</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-133</link>
		<dc:creator>Chris Missal</dc:creator>
		<pubDate>Wed, 16 Sep 2009 19:08:26 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-133</guid>
		<description>@Paco

 When I ask a repository for something, I&#039;m not concerned whether it&#039;s getting me data from an in memory collection or a database. I just want to know that it holds what I&#039;m looking for, whatever the implementation may be.</description>
		<content:encoded><![CDATA[<p>@Paco</p>
<p> When I ask a repository for something, I&#8217;m not concerned whether it&#8217;s getting me data from an in memory collection or a database. I just want to know that it holds what I&#8217;m looking for, whatever the implementation may be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paco</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-132</link>
		<dc:creator>Paco</dc:creator>
		<pubDate>Wed, 16 Sep 2009 18:44:43 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-132</guid>
		<description>&quot;this was set up for in memory collections&quot; -&gt; Why do you call it repository? It&#039;s a confusing term to use for an in-memory collection.

Why don&#039;t you put the list option in separate repository classes instead of in the specification?
ISpecification&lt;T&gt;
{
  bool IsSatisfiedBy(T entity);
  IEnumerable&lt;T&gt; AreSatisfiedBy(IEnumerable&lt;T&gt; entities);
}</description>
		<content:encoded><![CDATA[<p>&#8220;this was set up for in memory collections&#8221; -> Why do you call it repository? It&#8217;s a confusing term to use for an in-memory collection.</p>
<p>Why don&#8217;t you put the list option in separate repository classes instead of in the specification?<br />
ISpecification<t><br />
{<br />
  bool IsSatisfiedBy(T entity);<br />
  IEnumerable</t><t> AreSatisfiedBy(IEnumerable</t><t> entities);<br />
}</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Missal</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-131</link>
		<dc:creator>Chris Missal</dc:creator>
		<pubDate>Wed, 16 Sep 2009 14:52:44 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-131</guid>
		<description>@Ryan
Testing or other, this was set up for in memory collections. When making any kind of remote call, you&#039;re right. I suppose you could argue that showing code like this could lead to those bad practices of pulling an entire data set (or using Linq to SQL) ;)

@Jeremy

Good point, I believe you&#039;re correct. I only used the yield to take advantage of deferred execution.</description>
		<content:encoded><![CDATA[<p>@Ryan<br />
Testing or other, this was set up for in memory collections. When making any kind of remote call, you&#8217;re right. I suppose you could argue that showing code like this could lead to those bad practices of pulling an entire data set (or using Linq to SQL) ;)</p>
<p>@Jeremy</p>
<p>Good point, I believe you&#8217;re correct. I only used the yield to take advantage of deferred execution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Wiebe</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-130</link>
		<dc:creator>Jeremy Wiebe</dc:creator>
		<pubDate>Wed, 16 Sep 2009 14:35:29 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-130</guid>
		<description>Great examples, Chris. 

I&#039;m wondering though, why do you need the &#039;foreach&#039; in the last example?   Couldn&#039;t you just return:

return GetAllEntities().Where(specification.IsSatisfiedBy);

Does the yield buy you anything that I&#039;m missing?</description>
		<content:encoded><![CDATA[<p>Great examples, Chris. </p>
<p>I&#8217;m wondering though, why do you need the &#8216;foreach&#8217; in the last example?   Couldn&#8217;t you just return:</p>
<p>return GetAllEntities().Where(specification.IsSatisfiedBy);</p>
<p>Does the yield buy you anything that I&#8217;m missing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Riley</title>
		<link>http://lostechies.com/chrismissal/2009/09/16/actually-querying-with-the-specification-pattern/#comment-129</link>
		<dc:creator>Ryan Riley</dc:creator>
		<pubDate>Wed, 16 Sep 2009 14:28:51 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chrismissal/archive/2009/09/16/actually-querying-with-the-specification-pattern.aspx#comment-129</guid>
		<description>While the abstract repository implementation works well for testing, I hope everyone will keep in mind that pulling back an entire table in something like LINQ to SQL will cause a large performance hit. If you would like to see an example of specifications used in filtering results from the database, check out &lt;a href=&quot;http://iridescence.no/post/Linq-the-Specification-Pattern-and-Encapsulation.aspx&quot;&gt;Linq, the Specification Pattern and Encapsulation&lt;/a&gt; (&lt;a href=&quot;http://iridescence.no/post/DataContext-Repository-Pattern-Example-Code.aspx&quot;&gt;code&lt;/a&gt;).</description>
		<content:encoded><![CDATA[<p>While the abstract repository implementation works well for testing, I hope everyone will keep in mind that pulling back an entire table in something like LINQ to SQL will cause a large performance hit. If you would like to see an example of specifications used in filtering results from the database, check out <a href="http://iridescence.no/post/Linq-the-Specification-Pattern-and-Encapsulation.aspx">Linq, the Specification Pattern and Encapsulation</a> (<a href="http://iridescence.no/post/DataContext-Repository-Pattern-Example-Code.aspx">code</a>).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
