terrajobst / nquery-vnext

A Roslyn inspired rewrite of NQuery
MIT License
72 stars 16 forks source link

Nullable Properties give some issues #23

Open StevenThuriot opened 5 years ago

StevenThuriot commented 5 years ago

Hi!

I've run into an issue when querying some data that has nullable fields and/or DateTimes. I'm not sure if I'm doing something wrong, or are they just not supported at this time?

Just using a simple query like this:

Select Name, NullableDate
 from ClassesWithNullable
 where COALESCE(NullableDate, #0001-01-01#) >= #2018-01-01#

I've made a small unit test in a fork that reproduces the issue at hand, and made some changes that makes everything work. It'd be cool if you could take a look and throw your thoughts about it my way.

You can find the changes here StevenThuriot/nquery-vnext@1a53a02

As a final thought, it would be really useful to be able to add BinaryOperatorSignatures of our own. Currently the BinaryOperator class is readonly and internal and we can only add such methods by adding implicit or explicit operator methods . While this is completely fine in most cases, the types aren't always our own and we can't add them this way. e.g. Nullables; Since they're sealed, I tried to replicate their behavior but of course this completely messes up the flow of NQuery ( IsNullableOfT and GetNullableType ) . Even after changing all those methods and keeping NQuery happy, of course the expression trees wouldn't have it when throwing around null and this new type, so it was just a major headache and I started on making the changes in the commit above instead.

Of course, I'm more than willing to make the changes and write some unit tests for them and send in a pull request; But I'd like your thoughts on the matter first before putting in the work.

Thanks! Steven