electricsheep
electricsheep

Reputation: 5224

Tinyint as byte nhibernate

I have a table with a tinyint column in a SQL Server 2008 R2 database, which maps to a byte property in my POCO.

The problem is whenever I run a query with a where clause on the tinyint column using NHibernate, it results in the following sql...

and cast(table0_.TinyIntColumn as INT)=@p1 

I just want to know how to get rid of this behaviour, because although the query still works its annoying and unnecessary, so anyone know of any solutions or come across this before?

Thanks.

Upvotes: 0

Views: 919

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52725

This seems to be a bug in the LINQ provider.

Of the following queries:

session.CreateQuery("from Foo where TinyIntColumn = :b").SetParameter("b", 1)
session.QueryOver<Foo>().Where(x => x.TinyIntColumn == 1)
session.Query<Foo>().Where(x => x.TinyIntColumn == 1)

...Only the last one results in the behavior you are experiencing.

Please open an issue at https://nhibernate.jira.com/

Upvotes: 1

Related Questions