﻿<?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>Chris Tavares commented on Making the complex trivial: Rich Domain Querying</title><description>Then the JSON serializer is busted.
  
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment19</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment19</guid><pubDate>Thu, 30 Oct 2008 21:01:51 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>Chris,
  
It _works_.
  
  
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment18</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment18</guid><pubDate>Mon, 27 Oct 2008 06:09:31 GMT</pubDate></item><item><title>Chris Tavares commented on Making the complex trivial: Rich Domain Querying</title><description>Just a minor nit to pick - your JSON is invalid. You're required to quote all strings, including the ones on the left of the ':' characters.
  
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment17</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment17</guid><pubDate>Mon, 27 Oct 2008 05:16:40 GMT</pubDate></item><item><title>Neil commented on Making the complex trivial: Rich Domain Querying</title><description>Hi Oren,
  
  
I'm sure I saw some code like this in a pub recently :)
  
  
Thanks for putting it up on the blog.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment16</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment16</guid><pubDate>Thu, 23 Oct 2008 10:39:32 GMT</pubDate></item><item><title>JP commented on Making the complex trivial: Rich Domain Querying</title><description>Thanks!
  
  
You're the man.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment15</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment15</guid><pubDate>Tue, 21 Oct 2008 10:32:32 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>It is something like:
  
  
public T[] FindAll(AbstractSearchFilter filter)
  
{
  
            var dc = DetachedCriteria.For
&lt;t();
  
            filter.Apply(dc);
  
           return        dc.GetExecutableSession(session).List
&lt;t();
  
}
&gt;</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment14</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment14</guid><pubDate>Sun, 19 Oct 2008 14:45:52 GMT</pubDate></item><item><title>JP commented on Making the complex trivial: Rich Domain Querying</title><description>I'm just not getting what you intend to do in the FindAll method. You receive an AbstractSearchFilter as a parameter but I cannot understand what you do in the method's body :)
  
  
Can you please reply how you think this method should behave?
  
  
Thanks
  
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment13</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment13</guid><pubDate>Sun, 19 Oct 2008 14:16:41 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>Please ask in nh users group
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment12</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment12</guid><pubDate>Sun, 19 Oct 2008 11:52:48 GMT</pubDate></item><item><title>JP commented on Making the complex trivial: Rich Domain Querying</title><description>Can you please show an example using the code above?
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment11</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment11</guid><pubDate>Sun, 19 Oct 2008 11:27:35 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>JP,
  
You are using CreateCriteria to do this
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment10</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment10</guid><pubDate>Sun, 19 Oct 2008 11:22:55 GMT</pubDate></item><item><title>JP commented on Making the complex trivial: Rich Domain Querying</title><description>Sorry my ignorance but how do you pass the list of actions to a single detachedcriteria? In other words, if you have a repository which accepts a single detachedcriteria, how do you merge them all to a single one?
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment9</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment9</guid><pubDate>Sun, 19 Oct 2008 11:07:59 GMT</pubDate></item><item><title>Grimace of Despair commented on Making the complex trivial: Rich Domain Querying</title><description>I smell a NHQG update + revival :)
  
  
(I know, I know, ... I'm free to send a patch :P )
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment8</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment8</guid><pubDate>Fri, 17 Oct 2008 23:34:35 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>MD,
  
What do you mean safe? 
  
From SQL injection perspective, NH ensure that this is not a problem.
  
From optimization perspective, your filter model ensure that you don't allow truly bad things happening.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment7</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment7</guid><pubDate>Fri, 17 Oct 2008 20:07:16 GMT</pubDate></item><item><title>MD commented on Making the complex trivial: Rich Domain Querying</title><description>It is cool indeed, but is it safe to build the search criteria on the client?
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment6</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment6</guid><pubDate>Fri, 17 Oct 2008 18:26:44 GMT</pubDate></item><item><title>pete w commented on Making the complex trivial: Rich Domain Querying</title><description>I've done this kind of thing before, both in and out of NHibernate. I have found to to be quite useful.
  
  
What I would love to see is a technology that provides a sql server reporting services interface, but works with business objects and not sql, to me this would be a killer app.
  
  
All too often, we create applications with rich business objects, only to write sql-based reports, to me, it makes more sens to re-use these object for reporting
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment5</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment5</guid><pubDate>Thu, 16 Oct 2008 18:24:35 GMT</pubDate></item><item><title>Ayende Rahien commented on Making the complex trivial: Rich Domain Querying</title><description>Dennis,
  
You missed the point of complexity, it is not in the actual querying. It is the query building part that is hard.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment4</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment4</guid><pubDate>Thu, 16 Oct 2008 16:11:04 GMT</pubDate></item><item><title>Demis commented on Making the complex trivial: Rich Domain Querying</title><description>hmmm. This just seems like a lot of effort for something Linq would excel at.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment3</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment3</guid><pubDate>Thu, 16 Oct 2008 10:02:26 GMT</pubDate></item><item><title>Ken Egozi commented on Making the complex trivial: Rich Domain Querying</title><description>Cool thing.  Never used JSON serialisation for that, usually I'll send the query in Form/Querystring and use the [DataBind] power to get the filter.
  
My only problem with it, is that the filters (which are domain related) become way too aware of NH imo. I don't like my IReopsitory methods to accept NH based things as parameters
  
  
What I do is to have the Filter as a an anaemic NH-free class, located within the Domain.
  
in the domain implementation assembly (where the NH stuff goes) I'd declare a type inheriting from DetachedCriteria, that accepts the filter in the constructor.
  
  
  
	public class ModuleSearchCriteria : DetachedCriteria
  
		{
  
			private readonly ModuleSpecification specification;
  
			/// 
&lt;summary  
			/// Creates a new 
&lt;see	 out of a 
  
			/// 
&lt;see  
			/// 
&gt;  
		public ModuleSearchCriteria(ModuleSpecification specification) 
  
			: base(typeof(Module), "module")
  
{ 
  
    // manipulating the criteria by the filter
  
}
  
  
  
That way it's also easy to de-serialise a filter to a view (say for the sake of pre-populating a search screen), using the filter, keeping the view free from NH dependant objects
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment2</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment2</guid><pubDate>Thu, 16 Oct 2008 08:18:39 GMT</pubDate></item><item><title>Brian Chavez commented on Making the complex trivial: Rich Domain Querying</title><description>I did something similar to this in a recent project using JSON to serialize search criterias.
  
  
Except, I didn't put the criteria building in the property setters.  They're like SearchDTO objects.  The DAOs themselves take care of translating the filter objects into their respective DetachedCriterias to avoid SearchObjects and UI dependent on NHibernate.dll.
</description><link>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment1</link><guid>http://ayende.com/3653/making-the-complex-trivial-rich-domain-querying#comment1</guid><pubDate>Wed, 15 Oct 2008 22:48:01 GMT</pubDate></item></channel></rss>