Entity Framework 6 Code First - Map Function Or StoredProc to primative type

时间:2018-08-22 13:40:32

标签: c# entity-framework-6 iqueryable

I am looking to implement something like the following"

string searchValue = "Jun";
var users = context.Users
             .Where(x => x.BirthDate.SomeWhackySqlFunction(searchTerm))
             .ToList();

where SomeWhackySqlFunction maps to a function or storedProc with in sql server that has 2 parameters:

  • value: DateTime (in the sample code above it would be the value of birthDate).
  • searchTerm: string

This is to get around limitations with EF , alternatively if I Could extend the DbFunctions or SqlFunctions class, this could also do the trick.

0 个答案:

没有答案