lfaldanam / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

Repository.GetByProperties(...) does not handle null values properly. #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Put some data in the database with null for a nullable column.
2. Query by properties with the value as null
3. Note that the appropriate results are not returned.

What is the expected output? What do you see instead?
I expect the rows with the property set as null to be returned.

For example (somewhat psuedo),

Dictionary propetyCriteria = new Dictionary();

propertyCriteria.Add("Column1", "Value1")
propertyCiriteria.Add("Column2", null)

Repository<SomeClass> repo = new Repository()l

repo.GetByProperties(propertyCriteria);

With a table SomeClass with columns filled as

Column1   Column2
"Value1"    NULL

I would expect 1 row to be returned, but no rows are returned.

I think that GetByProperties needs to check if the value is null and add an
Expression.IsNull instead of a Expression.Eq

Original issue reported on code.google.com by davi...@yahoo.com on 7 Jan 2009 at 5:33

GoogleCodeExporter commented 9 years ago
Thanks for reporting this!

Original comment by wmccaffe...@gmail.com on 12 Jan 2009 at 4:43