When you work with ORM like nhibernate, having a tool like nhprof is the key of success. But even with NHProfiler you could not prevent people of doing wrong stuff because they do not use it . I have a simple scenario, a developer changed a method on the server lazily fetching a property of [...]
Continue reading about Unit test NHibernate query to verify N+1
Another advantage of storing properties of entities into a state object based on a Dictionary, is the ability to easily serialize objects in custom formats. As an example I create an XML serializer that is capable to serialize an entity in a custom XML format. I used this simple serializer to create a NHibernate User [...]
1: DateAdd(dd, T.AnalysisFrequence, :refdate) Quite often I use SQLite to create Unit Tests of NH queries with a fast In-Memory database, and then run the queries against a standard Sql Server database. Today I have this problem, an HQL query uses the DateAdd Sql Server function 1: DateDiff(dd, T.AnalysisFrequence, :refdate) In this query with the [...]
Continue reading about Use SQLite to test NH–DateAdd function
Some time ago I blogged about a technique to use SqLite in Unit testing when you have nhibernate mapping that targets Sql Server tables in a schema different from dbo. The problem was: if you specify the schema name in the mapping of a class, then you are not able to execute the test in [...]
Continue reading about Using schema with NHibernate and SqlLite
In a previous post I described a technique to insert query hints into NHibernate query with the use of comments. Testing this code in a real project lead to a strange exception when I issue queries with ICriteria The query should start with ‘SELECT’ or ‘SELECT DISTINCT’ This happens because ICriteria queries inserts comments inside [...]





