dapper-repositories icon indicating copy to clipboard operation
dapper-repositories copied to clipboard

Support for .Equals() and .Any() | .All()

Open hmm1995 opened this issue 4 years ago • 5 comments

Eg: var options = new[] {"opt1","opt2"}; //List/array strings

var results = _repository.FindAll( x=> x.property1.Equals(val1) && options.Any( sVals => x.property2.StartsWith(sVals));

I know that "==" is the same as .Equals () and I am currently using it, but I would like to know if it can be used in the future.

Thank you very much and excellent library

hmm1995 avatar Mar 02 '20 11:03 hmm1995

I can take a look for nexts relases, but atm i'll be focused on nested joins and others improvements

pvictorlv avatar Mar 02 '20 14:03 pvictorlv

Hi Paulo, I'm calling your library from a vb.net proyect. When I have an string comparision I get this exception: "System.InvalidCastException: Unable to cast object of type 'System.Linq.Expressions.MethodCallExpressionN' to type 'System.Linq.Expressions.MemberExpression'" This is because vb.net always wraps expression into Operators.CompareString(x.MyPropertyString, "stringValue", true) So I have no choice, I need to use string.Equals but I get an exception saying that Equals is not supported. Are you planning to release this enhancement soon?

lucaszacutti avatar Mar 12 '20 15:03 lucaszacutti

I can take a look, but atm i'm busy with GroupBy and other some features

pvictorlv avatar Mar 12 '20 15:03 pvictorlv

I have attached a zip file with proposed changes to support Equals expression

SqlGenerator.GetQueryProperties.zip

Thanks,

lucaszacutti avatar Mar 12 '20 22:03 lucaszacutti

Equals is done. I just need time to research abou ANY and ALL

pvictorlv avatar Mar 25 '20 04:03 pvictorlv

Equals implemented. Can create separate tickets for Any and All if it still need. Closed!

phnx47 avatar Mar 29 '23 03:03 phnx47