Search code examples
castle-activerecordcastle

Can I access generated query without executing it?


I know how to enable debugging so all queries that get run appear in my console. Is there any way to simply output the generated query without executing it?


Solution

  • Nope, you can't. NHibernate wouldn't know what to return as a result of the query method if it didn't execute the actual SQL against an actual database. For example:

    Client[] = Client.FindAll();
    

    The method has to return some collection of clients, and if ActiveRecord/NHibernate didn't send the SQL to the database it wouldn't know what to return.