-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating Parameterized SQL #185
Conversation
Converting constant expressions to the wrapped ones will enable the generated SQL is to be parameterized as proposed in the following blog post. https://github.com/graeme-hill/gblog/blob/master/source_content/articles/2014.139_entity-framework-dynamic-queries-and-parameterization.mkd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments, please take a look.
} | ||
} | ||
|
||
public static MemberExpression WrappedConstant<TValue>(TValue value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be private
} | ||
} | ||
|
||
public static MemberExpression WrappedConstant<TValue>(TValue value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment here how this is working. (Maybe add the link to that article, or maybe better to also add the article as file to this git.
Hi, I have the same requirement and I very glad there is already a fix. Many thanks! Can you tell me if this will be included in the next release? |
There are some code review comments and 3 unit-tests fail. |
Hi Stef,
It seems I need to change the test itself. Shall I do it?
…On Tue, Oct 23, 2018 at 9:02 AM Stef Heyenrath ***@***.***> wrote:
Hello @sspekinc <https://github.com/sspekinc> and @Jo1nes
<https://github.com/Jo1nes>,
There are some code review comments and 3 unit-tests fail.
See
https://ci.appveyor.com/project/StefH/system-linq-dynamic-core/build/1.0.8.576
for more details.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APOVTtfx6jA9rWYolga8Y9jEtAFwRFuPks5unrD3gaJpZM4VZqFT>
.
|
Co-Authored-By: sspekinc <[email protected]>
Co-Authored-By: sspekinc <[email protected]>
Co-Authored-By: sspekinc <[email protected]>
Merging with current
Mergin with current
{ | ||
expression = WrappedConstant((string)constantExpression.Value); | ||
} | ||
else if (constantExpression.Type == typeof(Int64)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a check for unsigned long, int and short here.
Also char, bool, byte, sbyte, float, decimal and double.
Also DateTimeOffset, TimeSpan.
Double check the file PredefinedTypesHelper
, this file has some lists of types which you can use.
Update DynamicExpressionParserTests.cs
Codecov Report
@@ Coverage Diff @@
## master #185 +/- ##
==========================================
- Coverage 82.49% 82.09% -0.41%
==========================================
Files 37 39 +2
Lines 3702 3809 +107
Branches 508 529 +21
==========================================
+ Hits 3054 3127 +73
- Misses 501 535 +34
Partials 147 147
Continue to review full report at Codecov.
|
I've refactored some code.
So it seems the code is not working ? |
Refactor and move some classes
Seems good. What's next? |
@sspekinc Looks good. one thing I was thinking : do we want this to be default behaviour? Or make this configurable using settings? |
I think it should be the default behavior but it would be good to be able to turn it off through ParsingConfig. |
Added config setting. Closing this PR ; somehow I need to use my own PR for merging... |
Converting constant expressions to the wrapped ones will enable the generated SQL is to be parameterized as proposed in the following blog post.
https://github.com/graeme-hill/gblog/blob/master/source_content/articles/2014.139_entity-framework-dynamic-queries-and-parameterization.mkd