﻿<?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 NHibernate – query only properties</title><description>Yes, it does.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment26</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment26</guid><pubDate>Thu, 23 Jul 2009 09:09:36 GMT</pubDate></item><item><title>Alexander Kovtik commented on NHibernate – query only properties</title><description>Does noop access strategy work with simple properties (not collections)? I can't get it working...
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment25</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment25</guid><pubDate>Mon, 20 Jul 2009 11:24:47 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – query only properties</title><description>Wayne,
  
Don't look at Blog.Posts, try to think about Blog.RecentPosts, or Blog.PostsByCurrentAuthor, or stuff like that.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment24</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment24</guid><pubDate>Thu, 18 Jun 2009 04:20:00 GMT</pubDate></item><item><title>Chris Nicola commented on NHibernate – query only properties</title><description>Ah I understand what you're saying now.  This is definitely a useful feature I can imagine a number of situations where I could use it.
  
  
I feel like I may have made a mistake with my bi-directional associations though.  I have a sort of three level tree of one-two many associations where I query the root entities and then load the collections.  
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment23</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment23</guid><pubDate>Wed, 17 Jun 2009 15:10:40 GMT</pubDate></item><item><title>Wayne Douglas commented on NHibernate – query only properties</title><description>I think of this as saying this:
  
  
 in the EM that we want to have a virtual property mapped one-to-many to another entity. The POCO has no concept of the relationship - only the entity model expressed through config?
  
  
I think I get all the concepts here and it's definitely very cool - what I'm struggling with - as were a couple others is why Blog.Posts is a bad idea - seems like the most natural thing in the world to me :s
  
  
Is this because, semantically, you think it's wrong to have this relationship?
  
  
Cheers
  
  
w://
  
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment22</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment22</guid><pubDate>Wed, 17 Jun 2009 13:10:12 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – query only properties</title><description>Chris,
  
That is why this is hidden very deeply inside NHibernate, where you don't usually see it.
  
From your perspective, you can treat POCO as the final model
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment21</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment21</guid><pubDate>Wed, 17 Jun 2009 10:20:43 GMT</pubDate></item><item><title>Chris Nicola commented on NHibernate – query only properties</title><description>Interesting, though I may be a bit confused as to the difference between the entity model and the POCO.  The POCO is the domain model I take it, but then what is the nature of the mapping from entities to POCOs?
  
  
Also, if I were creating a UI using MVVM does that mean I would have yet another mapping of the viewmodel to the POCOs.  Seems overkill perhaps, but it is more than likely I am just misunderstanding.  I just don't want to get into the mistake of creating redundant code.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment20</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment20</guid><pubDate>Wed, 17 Jun 2009 06:57:28 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – query only properties</title><description>That is one of them, for sure. There are also implications from the point of view of the domain model, but mostly it is because a lot of those associations just doesn't really make sense as an association on the objects
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment19</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment19</guid><pubDate>Mon, 15 Jun 2009 15:37:31 GMT</pubDate></item><item><title>Denis commented on NHibernate – query only properties</title><description>You say that "there are a few reasons" for not exposing Blog.Posts.
  
  
 I'm wondering whether one of this reasons is that such one-to-manymany relationships are "dangerous" with regard to performance. Hiding them can reduce the risk of developpers using them and forgetting what happens under the hood. Is it the case ?
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment18</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment18</guid><pubDate>Mon, 15 Jun 2009 13:17:47 GMT</pubDate></item><item><title>Hendry Luk commented on NHibernate – query only properties</title><description>@Krzysztof,
  
It "could" work in strong type criteria, eg NHQG. Doubt it's there though atm.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment17</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment17</guid><pubDate>Fri, 12 Jun 2009 05:07:10 GMT</pubDate></item><item><title>Paul Batum commented on NHibernate – query only properties</title><description>Hmm, I didn't know you could do that. Not sure how we'll support this one in Fluent NHibernate...
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment16</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment16</guid><pubDate>Thu, 11 Jun 2009 11:59:32 GMT</pubDate></item><item><title>Frans Bouma commented on NHibernate – query only properties</title><description>I really don't understand why anyone would want to add query predicates to a mapping file in XML and use that in a string based query in C#. If something will become a maintenance nightmare this is probably it. 
  
  
Not having a field mapped onto a relationship is not that uncommon, but mainly in o/r mapper frameworks which do reverse relationship maintenance (i.e. myOrder.Customer = myCustomer; also adds myOrder to myCustomer.Orders), as you sometimes don't want the PK side to know about all the FK sides it has, for example because it's kept in memory and could lead to problems. 
  
  
As the other side of the relationship does have a field mapped (Post.Blog), isn't that enough to query? 
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment15</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment15</guid><pubDate>Thu, 11 Jun 2009 08:27:32 GMT</pubDate></item><item><title>Gerke Geurts commented on NHibernate – query only properties</title><description>@Michael Teper: If query implementation is the responsibility of a repository/query service, just like the mapping definition, then I don't see any design conflicts.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment14</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment14</guid><pubDate>Thu, 11 Jun 2009 08:23:16 GMT</pubDate></item><item><title>Richard Dingwall commented on NHibernate – query only properties</title><description>Hmm check that. Noop'd version is not working either.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment13</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment13</guid><pubDate>Thu, 11 Jun 2009 03:23:01 GMT</pubDate></item><item><title>Michael Teper commented on NHibernate – query only properties</title><description>Hmm, that's really interesting, but only as a curiosity. It actually looks like an antipattern to me because the mapping, which is supposed to be an implementation detail is now required to understand query syntax, in addition to the POCO model.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment12</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment12</guid><pubDate>Thu, 11 Jun 2009 03:17:02 GMT</pubDate></item><item><title>Richard Dingwall commented on NHibernate – query only properties</title><description>I didn't know  this was possible either, very cool. It looks like it works for version columns too (who cares abouts optimistic locking implementation in the domain model).
  
  
I even tried it on an ID column (value type in domain, but has an ID in the legacy relational schema), but that failed with this exception:
  
  
NHibernate.HibernateException : identifier of an instance of SMS.Domain.Osm.CoreCompetencyRequirements was altered from 12189 to 
  
  
:O might log a bug report
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment11</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment11</guid><pubDate>Thu, 11 Jun 2009 03:14:21 GMT</pubDate></item><item><title>Min Han commented on NHibernate – query only properties</title><description>These recent posts on NHibernate are really interesting. I would have no idea how I would have come upon this particular gem without this post.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment10</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment10</guid><pubDate>Wed, 10 Jun 2009 23:38:19 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – query only properties</title><description>Yes, it should
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment9</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment9</guid><pubDate>Wed, 10 Jun 2009 23:31:17 GMT</pubDate></item><item><title>Jose commented on NHibernate – query only properties</title><description>is this working?
  
  
select b.Id, 
  
b.Name, 
  
size(b.RecentPosts) 
  
from Blog b 
  
where size(b.RecentPosts) &gt; 5
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment8</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment8</guid><pubDate>Wed, 10 Jun 2009 23:25:16 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate – query only properties</title><description>Yes, that was a typo.
  
And there are a few reasons, most of them relating to the fact that you don't want to have highly connect object models, or that if you would try to create those associations, you would have association explosion
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment7</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment7</guid><pubDate>Wed, 10 Jun 2009 22:54:32 GMT</pubDate></item><item><title>Stephen commented on NHibernate – query only properties</title><description>I guess technically you could have entity types and linq against them.. very hacky though..
  
  
Ayende you say: "In our domain model, we don’t want to have a Blog.Posts collection, we want to only have a Blog.Post."
  
  
Did you mean Post.Blog? otherwise I don't follow..
  
  
And can you explain why you wouldn't want Blog.Posts on the poco? just the example scenario, or good practice? is this related to aggregate roots?
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment6</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment6</guid><pubDate>Wed, 10 Jun 2009 21:49:43 GMT</pubDate></item><item><title>Gunnar Liljas commented on NHibernate – query only properties</title><description>It can be implemented with LINQ if you're not afraid of exposing primary and foreign keys as properties. Not beautiful, but it's actually just a bit of noise.
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment5</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment5</guid><pubDate>Wed, 10 Jun 2009 21:34:58 GMT</pubDate></item><item><title>Shane Courtrille commented on NHibernate – query only properties</title><description>The world would benefit greatly from a series titled..
  
  
"Things you didn't know about NHibernate"
  
  
This is awesome :D
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment4</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment4</guid><pubDate>Wed, 10 Jun 2009 21:30:20 GMT</pubDate></item><item><title>Krzysztof Kozmic commented on NHibernate – query only properties</title><description>I imagine using this this will be tricky to implement with LINQ (or strongly named criteria) which assume that Entity Model == POCO model
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment3</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment3</guid><pubDate>Wed, 10 Jun 2009 20:09:08 GMT</pubDate></item><item><title>Dave the Ninja commented on NHibernate – query only properties</title><description>@Benny - neither did I!!!
  
  
@Ayende - Time to refactor some code written last night to do this very thing - time to remove the noisey POCO collection reference!
  
  
CHEERS!!!
  
  
Ninja 
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment2</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment2</guid><pubDate>Wed, 10 Jun 2009 19:17:42 GMT</pubDate></item><item><title>Benny Michielsen commented on NHibernate – query only properties</title><description>I had no idea this was possible, keep 'em coming!
</description><link>http://ayende.com/4054/nhibernate-query-only-properties#comment1</link><guid>http://ayende.com/4054/nhibernate-query-only-properties#comment1</guid><pubDate>Wed, 10 Jun 2009 18:36:00 GMT</pubDate></item></channel></rss>