Skip to content

Commit

Permalink
Add [NotParameterized] to Contains's argument
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslevesque committed Mar 17, 2020
1 parent 9219ff4 commit 90fb90f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static bool Contains(
[CanBeNull] this DbFunctions _,
[NotNull] string propertyReference,
[NotNull] string searchCondition,
int languageTerm)
[NotParameterized] int languageTerm)
=> ContainsCore(propertyReference, searchCondition, languageTerm);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,22 @@ FROM [Employees] AS [e]
WHERE CONTAINS([e].[Title], N'President', LANGUAGE 1033)");
}

[ConditionalFact]
[SqlServerCondition(SqlServerCondition.SupportsFullTextSearch)]
public void Contains_with_non_literal_language_term()
{
int language = 1033;
using var context = CreateContext();
var result = context.Employees.SingleOrDefault(c => EF.Functions.Contains(c.Title, "President", language));

Assert.Equal(2u, result.EmployeeID);

AssertSql(
@"SELECT TOP(2) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title]
FROM [Employees] AS [e]
WHERE CONTAINS([e].[Title], N'President', LANGUAGE 1033)");
}

[ConditionalFact]
[SqlServerCondition(SqlServerCondition.SupportsFullTextSearch)]
public async Task Contains_with_logical_operator()
Expand Down

0 comments on commit 90fb90f

Please sign in to comment.