I need some help as can't really explain this one. We have a semi complex nhibernate query:
var query = _tyreRepository.Session.QueryOver<Tyre>(() => tyreAlias)
.JoinQueryOver<Pattern>(() => tyreAlias.Pattern, () => patternAlias)
.JoinQueryOver<Brand>(() => patternAlias.Brand, () => brandAlias)
.JoinQueryOver<RimSize>(() => tyreAlias.RimSize, () => rimSizeAlias)
.JoinQueryOver(() => tyreAlias.SpeedIndex,
() => speedIndexAlias, JoinType.LeftOuterJoin);
Which works fine in Visual Studio 2012, we recently upgraded to Visual 2015 and now this query doesn't work; when you use a where on the speed index:
query.Where(() => speedIndexAlias.SpeedKm >= speedKms);
The query works fine otherwise.
Spent a long time debugging rolling back code nothing worked. Then we got the same project complied it in visual studio 2012 works fine. We can't work out why when we compile the project in visual studio 2015 this query no longer works (with no changes at all to the query).
I really like all the new language changes in 2015 but our website breaks when we compile our code in visual studio 2015...
Ok I did find a solution. You need to upgrade nhibernate to the latest version due to an issue with the C# Roslyn compiler in visual studio 2015. Unfortunately doesn't look like older versions of nhibernate have a fix for this at all.
https://nhibernate.jira.com/browse/NH-3795
So if you want to use visual studio 2015 and you use nhibernate you have to upgrade nhibernate currently. Must be build 4.04.4000 which I can confirm does work with fluent 2.0.3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With