Search code examples
entity-frameworkodatacalculated-columns

OData filter on computed value


I have a Person with a name, split into FirstName and LastName. I need to filter by FullName which is First- and Last-Name combined.

How will I be able to filter that?

~/odata/people?$filter=...

Keep in mind I need to be able to filter a person named FirstName=Foo, LastName=Bar by the following:

  • foo bar
  • foo
  • bar
  • oo ba

If this isn't possible directly in the query. Then I've been looking at DelegateDecompiler, though I haven't been able to make it work just yet. So also looking for advice on that approach is a good choice.


Solution

  • http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html check build in functions, contains(concat(concat(FirstName,' '), LastName), 'foo bar')

    :)