﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Querying Is A Business Concern: Sample</title><description>No problem.
  
I am glad to know that we agree with each other.
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment10</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment10</guid><pubDate>Tue, 13 Mar 2007 23:32:36 GMT</pubDate></item><item><title>Derick Bailey commented on Querying Is A Business Concern: Sample</title><description>This turned out to be a semantic misunderstanding on my part, not a design or implementation difference. My appologies for the misunderstanding.
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment9</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment9</guid><pubDate>Tue, 13 Mar 2007 23:30:56 GMT</pubDate></item><item><title>Dim Blog As New ThoughtStream(me) commented on Querying Is A Business Concern: Sample</title><description>Ayende Makes The Statement that Querying Is A Business Concern. I have often made this same statement...
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment8</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment8</guid><pubDate>Tue, 13 Mar 2007 16:24:40 GMT</pubDate></item><item><title>Ayende Rahien commented on Querying Is A Business Concern: Sample</title><description>Did notice that the query is in the authorization service?
  
The only logic in the IsAllowed() method is in the query, so to test that I need a DB anyway.
  
If I don't want that, I can mock the authorization service directly.
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment7</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment7</guid><pubDate>Tue, 13 Mar 2007 13:33:37 GMT</pubDate></item><item><title>Derick Bailey commented on Querying Is A Business Concern: Sample</title><description>Ayende,
  
  
The code that you post in your comment is what I would consider to be the mechanics - the service portion of the call - and should be hidden behind an interface. My basic reasoning for making this statement is encapsulation - to allow the mechanics of the query to change, without the semantics of the call changing. 
  
  
This becomes even more important in unit testing. If I am going to test the CRUD permissions of a Controller for a screen, I need to be able to mock the CRUD call to return an expected result, without having the real permission store set up and connected.
  
  
public interface IPermissionService
  
{
  
  
  public ICollection&lt;Permission&gt; GetPermissions();
  
  
}
  
  
  
public class PermissionService: IPermissionService
  
{
  
  
  public ICollection&lt;Permission&gt; GetPermissions()
  
  {
  
    return Repository&lt;Permission&gt;.FindAll("query", parameters);
  
  }
  
  
}
  
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment6</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment6</guid><pubDate>Tue, 13 Mar 2007 13:20:26 GMT</pubDate></item><item><title>Ayende Rahien commented on Querying Is A Business Concern: Sample</title><description>@Derick,
  
Can you define what is a query mechanics in this case?
  
  
The code that I am using is:
  
  
ICollection&lt;Permission&gt; permissions = Repository&lt;Permission&gt;.FindAll("query", parameters);
  
return permissions.Count != 0
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment5</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment5</guid><pubDate>Tue, 13 Mar 2007 05:11:57 GMT</pubDate></item><item><title>Ayende Rahien commented on Querying Is A Business Concern: Sample</title><description>@SteveG,
  
Just the first query is using Linq, the other two are HQL queries.
  
There are no real trade offs between the two queries, except for efficiencies.
  
  
Yes, you can cache this query
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment4</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment4</guid><pubDate>Tue, 13 Mar 2007 05:10:03 GMT</pubDate></item><item><title>Richard LOPES commented on Querying Is A Business Concern: Sample</title><description>I very much agree with the architecture proposed by Derick.
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment3</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment3</guid><pubDate>Tue, 13 Mar 2007 04:41:01 GMT</pubDate></item><item><title>Derick Bailey commented on Querying Is A Business Concern: Sample</title><description>shouldn't the "process" of obtaining the permissions be the business logic, but the actual query mechanics be service logic? I believe there is a distinct difference between the two, although the implementation may join them via interface vs. implementation.
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment2</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment2</guid><pubDate>Tue, 13 Mar 2007 01:52:29 GMT</pubDate></item><item><title>SteveG commented on Querying Is A Business Concern: Sample</title><description>Ayende,
  
  
Although it might be inefficient, is there a tradeoff here depending on the situation?
  
  
I wonder as well, does this Linq query get cached ?
  
  
I do however agree with your comments, this is very much business logic!
</description><link>http://ayende.com/2205/querying-is-a-business-concern-sample#comment1</link><guid>http://ayende.com/2205/querying-is-a-business-concern-sample#comment1</guid><pubDate>Tue, 13 Mar 2007 00:01:44 GMT</pubDate></item></channel></rss>