diegohb
diegohb

Reputation: 1887

Does EdmFunction work in EF4.3 code-first (no edmx model)

ref: How to create like '234%4' or %2324%335% in EntityFramework

Does the solution using [EdmFunction] work for esql + EF4.3 code-first (where there is no .edmx file) by simply implementing the function? then would it be available in esql, ie: "it.UserName.Like('_user%')" ?

Upvotes: 1

Views: 553

Answers (2)

Scott Stafford
Scott Stafford

Reputation: 44786

Then, as now, you can use .StartsWith or .Contains which map to LIKE:

it.UserName.StartsWith("_user")

will translate to

UserName LIKE '_user%'

(and secretly apply your case insensitive collations and such, causing Contains to deviate from an accurate mapping to the local functionality.)

Upvotes: 0

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364329

No. EdmFunction attribute and its functionality is currently dependent on EDMX mapping file.

Upvotes: 2

Related Questions