As described on the Dixin Blog
I am trying to create this inline function:
public static class BuiltInFunctions
{
[Function(FunctionType.BuiltInFunction, "CONVERT")]
public static string ConvertToInt(this string type, string value) => Function.CallNotSupported<string>();
}
And I use it like:
Query().Where(x => "int".ConvertToInt(x.MyNVarcharColumn) ...
But the generated SQL looks like this:
SELECT [columns] FROM [table] WHERE (CONVERT(N'int', 'ValueOfMyNVarcharColumn')) ...
When something like
SELECT [columns] FROM [table] WHERE (CONVERT(int, MyNVarcharColumn)) ...
or
SELECT [columns] FROM [table] WHERE (CONVERT(int, 'ValueOfMyNVarcharColumn')) ...
What can I do to get the expected result?
Important here is how to generate typename parameters for native SQL functions.
source
share