Page 1 of 1
Using Registered Function for SQLite regexp operator in EF query
Posted: Thu 04 Jul 2019 10:04
by klosels
I know that it's possible to register arbitrary functions with SQLite using the SQLiteConnection.RegisterFunction method and already used them successfully in pure SQL statements.
Is it also possible to use a registered function, specifically for the REGEXP SQLite operator, in a LINQ to Entities query?
I.e. how would I write the query on the db Set, e.g.:
Code: Select all
var doubleNamePersons = db.Set<Person>().Where(p => [b]p.LastName ...???... regexp(".*-..*")[/b]);
Thanks for any advice...
Re: Using Registered Function for SQLite regexp operator in EF query
Posted: Mon 08 Jul 2019 18:21
by Shalex
Re: Using Registered Function for SQLite regexp operator in EF query
Posted: Tue 09 Jul 2019 15:26
by klosels
I thoroughly read the
referred topic, but I still don't see how to approach the issue.
I already know:
- *how to register a custom function.
*that I can then use it in a plain SQL query.
*that registering as "regexp" will map it to the SQLite REGEXP operator (still in plain SQL)
but that doesn't yet help to use the function in LINQ to Entities because
- *the approach in the topic linked further on applies to collating functions specific to a column, but there's no similar configuration option in SQLiteEntityProviderConfig
*and no Regexp method exists in SqlFunctions which would map to REGEXP operator either
Re: Using Registered Function for SQLite regexp operator in EF query
Posted: Mon 15 Jul 2019 18:57
by Shalex
You are working with EF6, aren't you?
We will investigate the possibility of using REGEXP operator in EF query and notify you about the result.
Re: Using Registered Function for SQLite regexp operator in EF query
Posted: Tue 13 Aug 2019 16:29
by klosels
Sorry for the slow reply - yes, we're using EF 6.2
Hoping you'll find a way to support this as we'll probably need it soon and where we have no workaround.