Hi
I got a quest from one of my colleague at work why only Equals in
Linq-implemenation is working for string.
I downloaded the latest NH from git today and create some new test in the
NHibernate.Test.Linq.WhereTests
Following test is working
[Test]
public void WhereWithConstantStringEqualExpression()
{
var query = (from user in db.Users
where user.Name.Equals("ayende")
select user).ToList();
Assert.AreEqual(1, query.Count);
}
Added another test that not is working
[Test]
public void WhereWithConstantIntEqualExpression()
{
var query = (from user in db.Users
where user.Id.Equals(-0)
select user).ToList();
Assert.AreEqual(0, query.Count);
}
Started and find why that not was working and find that the
NHibernate.Linq.Functions.EqualsGenerator only is adding Equals-method for
string-type.
Is there any reason to only allowing that for string and not for all simple
standard types (short, int, long, Guid, bool) as default or is it only that
not anyone have implemented it?
Should I fix it in my project only or should I open a jira-issue and make a
pull-request for the change also?
// Patric