Hi All,
I have been doing some performance analysis on an application I am working on. The application is web-based (asp.net) using an old version of NHibernate (1.0) on MSSQL Server (2005).
Running profiler against the application seems to show something a little odd, in that we seem to be querying objects twice, once as a direct query and once wrapped in sp_executesql. for example:
SELECT col1, col2 FROM TABLE exec sp_executesql N'SELECT col1, col2 FROM TABLE'
Looking at the stats within profiler I can see they are distinct events (the select is recorded as event 45 - SP:StmtCompleted whilst the call to sp_executesql is recorded as event 10 - RPC:Completed).
I have not worked with NHibernate too much before this, but I cannot imagine this is normal behavior. Am I either mis-reading the profile trace (in which case how should I interpret the above), or is there a good reason for this?
If the above is as bad as I think, is there a way to switch this behavior off?
Thanks