I have an extension method defined as follows:
public static bool Like(this string input, string pattern)
//This will only throw an exception if method is called outside of a Linq query
throw new NotImplementedException();
When called in a Linq-to-Entities predicate, this method resolves to the following function defined in my EF6 model (edmx file):
<Function Name="StringLike" ReturnType="Boolean">
<Parameter Name="input" Type="String" />
<Parameter Name="pattern" Type="String" />
input LIKE pattern
I am wondering how this function is resolved when called via Effort in a unit test. There are no exceptions thrown, however, the behavior is inconsistent with how it works when using a "real" SQL database context. Namely, the following test does not
return the correct results:
var singleCharWildcardEndMatches = TestDbContext.UserProfile.Where(a => a.FirstName.Like("FirstName_"));
The line above actually produces the same results as Like("FirstName%") produces. I would expect the single underscore to match exactly one character, i.e. FirstName9 would match, FirstName987 would not.
Am I correct in assuming there is no actual SQL being performed by effort? If so, what is being done behind the scenes when my extension method is called? What level of support does Effort have for model-defined DbFunctions?