﻿<?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 Generator - More Collections Magic</title><description>AsbjornM ,
  
There are levels of use in each platform. What I am showing here is meant for those that are already familiar with NHibernate and wants to take advantage of their knowledge in the best possible way.
  
For beginners ,there are numbers of avenues. There is a DNR TV episode that I did on NHibernate which may give you an idea about how to start, and there are numerous articles about it, including the book that you have mentioned.
  
The sample code that I have shown is using Active Record, which does give you an implementation of FindAll, FindOne, etc.
  
As for tools, you can check out Active Writer
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment10</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment10</guid><pubDate>Fri, 08 Jun 2007 16:18:04 GMT</pubDate></item><item><title>AsbjornM commented on NHibernate Query Generator - More Collections Magic</title><description>I like the ideas you show here, but how can an n00b get started on this?
  
I'm looking for starting points, and have tried the quickstart thingy for nhibernate so I have an class, mapping etc to get one row from an database.
  
But my "User" object does not have any FindOne method.., and I'm looking through the generated QueryBuilder.cs but cannot find anything that refers to my class, even if I fed it with my dll and mapping file.. 
  
Everything I read around on this things looks like it is suited for people who have been using nhiber etc for many years.. When I took up subsonic, that was very easy, generating classes with foreignkey support and everything.. but it lacks some serious functionality imho, like joins, and therefore I want to check out nhiber, but it gives me pain. so I was hoping the querygenerator and stuff could ease that, but not yet..
  
I even bought the book NHibernate in action from Kuate, but that is not easily grasped... yet..
  
And doesn't it exist any tool that can read the database, generate mappinfiles, and classes to avoid some of the DRY principles? at least for getting started, like reverseenginering in visio etc..so you don't need to type everything 3-4 times?
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment9</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment9</guid><pubDate>Fri, 08 Jun 2007 14:45:43 GMT</pubDate></item><item><title>Christian Crowhurst commented on NHibernate Query Generator - More Collections Magic</title><description>This was just what I was looking for when I emailed you recently asking whether NQG supports quering associations.
  
  
Thank you very much!
  
  
Christian
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment8</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment8</guid><pubDate>Thu, 07 Jun 2007 21:06:59 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Query Generator - More Collections Magic</title><description>Can we continue this discussion at &lt;rhino-tools-dev@googlegroups.com&gt;
  
I would like to get a full test case, one that I can run.
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment7</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment7</guid><pubDate>Thu, 07 Jun 2007 06:28:55 GMT</pubDate></item><item><title>AndyHItchman commented on NHibernate Query Generator - More Collections Magic</title><description>I love this syntax.
  
  
I tried to use the new With() to FetchMode.Eager a collection, but no luck (it was lazy). See my test for what I am hoping would work...
  
  
I took a look at the QueryBuilder and custom tool output and my head hurt, but what I was trying seemed to be within the realms of possibility.
  
  
Any tips?
  
  
  
-----------------------
  
        public void TestTraverseOperationsWithPreemptiveFetch()
  
        {
  
            DataAdapter&lt;Guid, Application&gt; appDa = new DataAdapter&lt;Guid, Application&gt;();
  
            Application application = null;
  
  
            using (UnitOfWork.Session)
  
            {
  
//                DetachedCriteria dc = DetachedCriteria.For&lt;Application&gt;();
  
//                dc.Add(Expression.Eq("Id", new Guid("{DD635128-387B-46de-A850-F1F59FB4167F}")))
  
//                    .SetFetchMode("Operations", FetchMode.Eager);
  
//                application = appDa.FindOne(dc);
  
  
                application = appDa.FindOne(
  
                    Where.Application.Id == new Guid("{DD635128-387B-46de-A850-F1F59FB4167F}") &amp;
  
                    Where.Application.Operations.With(FetchMode.Eager));
  
            }
  
  
            Assert.IsNotNull(application);
  
            Assert.AreEqual(new Guid("{DD635128-387B-46de-A850-F1F59FB4167F}"), application.Id);
  
            Assert.AreEqual(1, application.Operations.Count);
  
        }
  
-----------------------
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment6</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment6</guid><pubDate>Thu, 07 Jun 2007 06:26:16 GMT</pubDate></item><item><title>MarcelloP commented on NHibernate Query Generator - More Collections Magic</title><description>Ok, with the latest version now it works! ;)
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment5</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment5</guid><pubDate>Wed, 06 Jun 2007 14:18:14 GMT</pubDate></item><item><title>Jose commented on NHibernate Query Generator - More Collections Magic</title><description>Great job Ayende, but I think I have a problem. I'm using ActiveRecord, I have a class CentroRecolector wich have a collection of objects of type Instrumento, but NHQG does not generate the necesary code to be able to write Where.CentroRecolector.Instrumentos.With nor Where.CentroRecolector.Instrumentos.Exists
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment4</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment4</guid><pubDate>Wed, 06 Jun 2007 11:16:40 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Query Generator - More Collections Magic</title><description>I should be replaced when you run the code, can you check it?
  
Line #113, program.cs
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment3</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment3</guid><pubDate>Wed, 06 Jun 2007 09:38:09 GMT</pubDate></item><item><title>MarcelloP commented on NHibernate Query Generator - More Collections Magic</title><description>I've found a little bug, the QueryBuilder.cs file is generated with the literal "namespace" attached to the generated namespace declaration:
  
  
namespace QueryNamespace
  
{
  
    public partial class QueryBuilder&lt;T&gt;
  
.....
  
.....
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment2</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment2</guid><pubDate>Wed, 06 Jun 2007 09:23:20 GMT</pubDate></item><item><title>MarcelloP commented on NHibernate Query Generator - More Collections Magic</title><description>Wonderfull! Great Job Ayende!
</description><link>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment1</link><guid>http://ayende.com/2501/nhibernate-query-generator-more-collections-magic#comment1</guid><pubDate>Wed, 06 Jun 2007 08:56:49 GMT</pubDate></item></channel></rss>