﻿<?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>Tim Scott commented on StoryVerse (and very cool search technique)</title><description>First, thanks for the kind comments.
  
  
This pattern has been evolving.   It began in a prior (non ActiveRecord) project.  In that version we passed our custom criteria object into a repository method which then built HQL and passed it on to our data gateway.
  
  
The newer approach, reflected in StoryVerse, is nice for a couple of reasons.  First, it uses strongly typed ICriteria instead of HQL.  Also, it's nice to encapsulate the creation of Nhib criteria inside the custom criteria class.  Thus the class could be easily extended to support other gateway implementations.  For example, you could add a ToSql() method or perhaps something like ToLinqQuery() ???
  
  
Recently we have improved on this pattern by coupling custom criteria objects with Dto objects.  We added a property to the criteria class, ReturnType, with values of "Entity" and "Dto."  When the return type is Dto, we use AliasToBeanResultTransformer to automagically return a list of Dtos instead of root entities.
  
  
I was planning to write an article soon that demonstates this newest rendition of the pattern.  However, we're having a problem that appears to be an NHibernate bug, described here: http://forum.hibernate.org/viewtopic.php?t=973951&amp;highlight=alias
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment7</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment7</guid><pubDate>Mon, 28 May 2007 16:09:54 GMT</pubDate></item><item><title>F&amp;#225;bio Batista commented on StoryVerse (and very cool search technique)</title><description>Way cool! I already used [DataBind] to fill some DTO, but never though on using it to fill a clever object that can generate a Criteria ;)
  
  
Very good SOC.
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment6</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment6</guid><pubDate>Sun, 27 May 2007 23:11:46 GMT</pubDate></item><item><title>Ayende Rahien commented on StoryVerse (and very cool search technique)</title><description>ProjectSearchCriteria is a class that has properties such as From, To, UserName, etc.
  
The coolness factor is that they are filled automagically by the [DataBind] property.
  
Since the properties setter build the criteria directly, this means that the whole complexity of the search form was reduce to a very small problem of just executing the criteria.
  
A very easy way to handle the problem
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment5</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment5</guid><pubDate>Sun, 27 May 2007 15:09:46 GMT</pubDate></item><item><title>Roy Osherove commented on StoryVerse (and very cool search technique)</title><description>Care to elaborate to the coolness of this?
  
Not everyone understands what's going on in that piece of code.
  
  
Roy.
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment4</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment4</guid><pubDate>Sun, 27 May 2007 14:55:19 GMT</pubDate></item><item><title>Tim Haines commented on StoryVerse (and very cool search technique)</title><description>done.
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment3</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment3</guid><pubDate>Sun, 27 May 2007 10:08:00 GMT</pubDate></item><item><title>Ayende Rahien commented on StoryVerse (and very cool search technique)</title><description>It is a wiki, create an account and do it  :-)
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment2</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment2</guid><pubDate>Sun, 27 May 2007 09:59:23 GMT</pubDate></item><item><title>Tim Haines commented on StoryVerse (and very cool search technique)</title><description>Sounds like a great thing to link to from http://using.castleproject.org.
</description><link>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment1</link><guid>http://ayende.com/2442/storyverse-and-very-cool-search-technique#comment1</guid><pubDate>Sun, 27 May 2007 09:55:24 GMT</pubDate></item></channel></rss>