Add support of Interpolated strings.#530
Add support of Interpolated strings.#530StefH merged 3 commits intozzzprojects:masterfrom yangzhongke:main
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. |
|
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:
