Linq query with boolean implemeted as IUserType fails

Description

Boolean values are mapped as implementation of IUserType. The type implementation writes -1 for true values and 0 for false values
to database but allows to use bool properties in the application.
The query:

fails with the following exception:

NHibernate.QueryException: Unable to render boolean literal value [.Where[Core.Test.Domain.Test]
(NHibernate.Linq.NhQueryable`1[Core.Test.Domain.Test], Quote((c, ) => (c.Active)), )]
---> System.InvalidCastException: Das Objekt des Typs "NHibernate.Type.CustomType" kann nicht
in Typ "NHibernate.Type.BooleanType" umgewandelt werden.

A query using QueryOver :

succeeds and produces the correct SQL:

NHibernate: SELECT this_.TEST_ID as TEST1_14_0_, this_.DESCRIPTION as DESCRIPT2_14_0_, this_.ACTIVE as ACTIVE14_0_,
this_.CAT_ID as CAT4_14_0_ FROM T_TEST this_ WHERE this_.ACTIVE = @p0;@p0 = -1 [Type: Int16 (0)]

An complete example with failing test can be found here https://github.com/Belvasis/NHTests

P.S.: Since this is my first issue entry here, i hope that the description and form is correct.

Environment

None

Assignee

Alex Zaytsev

Reporter

Volker Röppischer

Components

Fix versions

Affects versions

Priority

Minor
Configure