-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Add support of Interpolated strings. #530
Conversation
Hello @yangzhongke, thank you for your contribution. However, I thought that this functionality would be integrated in the current code, and not creating new extension methods. Can you change your PR? |
If there are two overloaded methods as below:
Due to the deliberate decision by the Microsoft , The code Where($"Id={id}") will invoke Where(string predicate,params object[] args) instead of Where(FormattableString predicate), which lead to my decision to create new method names, like WhereInterpolated instead of using Where. |
Can't you just add a new method like? Existing... public static IQueryable Where([NotNull] this IQueryable source, [NotNull] ParsingConfig config, [NotNull] string predicate, params object[] args) New... public static IQueryable Where([NotNull] this IQueryable source, [NotNull] ParsingConfig config, [NotNull] FormattableString predicate) |
I can. But where($" id={id}") will invoke the "string predicate" version instead of "FormattableString" version. |
Even EF Core created two methods to execute sql statements, ExecuteSqlRaw(string version) and ExecuteSqlInterpolated(FormatableString version). So I reckon that the two different methods solution, Where and WhereInterpolated , is a tradeoff. |
src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore3/EFDynamicQueryable_FS_Extensions.cs
Outdated
Show resolved
Hide resolved
Agree with the renaming. |
@yangzhongke |
…rmattableStringExtensions.cs and DynamicQueryable_FormattableString_Extensions.cs --> DynamicQueryableWithFormattableStringExtensions.cs
I have renamed those two files and committed the changes. |
Add support of Interpolated strings.
see #527
I have added two test cases: QueryableTests.FormattableString.cs and EntitiesTests.FormattableString.cs. All the tests are passed: