tghamm / dynamic-linq-query-builder

A truly generic and dynamic linq query builder to compliment jQuery QueryBuilder and other dynamic linq query generation needs
MIT License
262 stars 110 forks source link

Added support for contains in dictionary #118

Closed Ilanlido closed 1 year ago

Ilanlido commented 1 year ago

Instead of always checking if the key is inside the dictionary to allow "not" operators for example, dictionary.field not equal x when the field does not exist should return true (mongo supports this by default) in Memory filter rule should check with not_contains to avoid KeyNotFound exception

Ilanlido commented 1 year ago

I've checked against Mongo settings LinqProvider V2 and apparently .toString() are not supported in mongo in this version. i might change the ".toString()" we are doing to casting of string.. what do you think?

tghamm commented 1 year ago

Hi @Ilanlido can you elaborate a little on your second comment?

Ilanlido commented 1 year ago

Yes @tghamm Mongo currently supports two versions of Linq provider versions 2 and 3 which can be controlled by the client https://mongodb.github.io/mongo-csharp-driver/2.14/reference/driver/crud/linq3/ recently the default has changed to version 3. All queries that perform .ToString() are not supported in version 2, meaning that if the user uses linq v2 version a lot of queries won't work :( as for this PR everything works on version3. but i'm thinking maybe to add an additional PR or just in my Fork version a toggle to use casting to string instead of .ToString()

tghamm commented 1 year ago

@Ilanlido thanks I see, looks like 2.19 was the first release to support LINQ3 as the proper provider. Hmm. Given that's the direction they are going, and it's latent support in other ORMs like EF, seems like the need for it is a bit temporary. That said, if you wanted to try adding a feature flag, and we can get it to pass all all the feature and integration tests, I'm not opposed to including it. Mongo isn't a case I have a grasp on how many users need, so as long as it doesn't conflict with base functionality or conflict with the other ORM support which is widely used, you're welcome to take a crack at it. Thoughts?

Ilanlido commented 1 year ago

Alright, thanks. for now, this PR can be merged and released (if approved). I'll think about the options i have, i might just update my code to use the latest linq version

tghamm commented 1 year ago

Thanks, ill merge it now and put out a release a little later today!