Dixin / EntityFramework.Functions

EntityFramework.Functions library implements Entity Framework code first support for stored procedures (with single result type, multiple result types, output parameter), table-valued functions (returning entity type, complex type), scalar-valued functions (composable, non-composable), aggregate functions, built-in functions, niladic functions, and model defined functions.
https://weblogs.asp.net/Dixin/EntityFramework.Functions
MIT License
79 stars 27 forks source link

Can I add a "function" which acts like "LIKE"? #20

Closed springy76 closed 7 years ago

springy76 commented 7 years ago

SQLite's full text search uses a custom keyword "MATCH" which acts like "LIKE".

Can any of the existing functions create custom SQL which takes a single parameter as input and will create SQL like WHERE ColumnName MATCH @p0?

Would be used like so: context.MySet.Where(row => CustomFunctions.Match(row.ColumnName, "string expression which should go to @p0") )

Dixin commented 7 years ago

No. This is not supported by EF, because MATCH/LIKE is not a function, it cannot be used as LIKE(expression, pattern).

For LIKE, it can be replaced by PATINDEX(pattern, expression) function call.