Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Ordinal to {Starts,Ends}With #18873

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/EFCore.Design/Design/Internal/NamespaceComparer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.EntityFrameworkCore.Design.Internal
Expand All @@ -13,8 +14,8 @@ public class NamespaceComparer : IComparer<string>
/// <inheritdoc />
public virtual int Compare(string x, string y)
{
var xSystemNamespace = x != null && (string.Equals(x, "System") || x.StartsWith("System."));
var ySystemNamespace = y != null && (string.Equals(y, "System") || y.StartsWith("System."));
var xSystemNamespace = x != null && (x == "System" || x.StartsWith("System.", StringComparison.Ordinal));
var ySystemNamespace = y != null && (y == "System" || y.StartsWith("System.", StringComparison.Ordinal));

return xSystemNamespace && !ySystemNamespace
? -1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Text;
using JetBrains.Annotations;
Expand Down Expand Up @@ -57,7 +58,7 @@ public RelationalSqlGenerationHelper([NotNull] RelationalSqlGenerationHelperDepe
/// A valid name based on the candidate name.
/// </returns>
public virtual string GenerateParameterName(string name)
=> name.StartsWith("@")
=> name.StartsWith("@", StringComparison.Ordinal)
? name
: "@" + name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private Expression PushdownMember(
{
var selector = sourceMethodCallExpression.Arguments[1].UnwrapLambdaFromQuote();
var selectorBody = selector.Body;
var memberAccessExpression = createSelector(selectorBody, methodCallExpression.Method.Name.EndsWith("OrDefault"));
var memberAccessExpression = createSelector(selectorBody, methodCallExpression.Method.Name.EndsWith("OrDefault", StringComparison.Ordinal));

source = Expression.Call(
QueryableMethods.Select.MakeGenericMethod(
Expand All @@ -143,7 +143,7 @@ private Expression PushdownMember(
else
{
var parameter = Expression.Parameter(queryableType, "s");
var memberAccessExpression = createSelector(parameter, methodCallExpression.Method.Name.EndsWith("OrDefault"));
var memberAccessExpression = createSelector(parameter, methodCallExpression.Method.Name.EndsWith("OrDefault", StringComparison.Ordinal));

source = Expression.Call(
QueryableMethods.Select.MakeGenericMethod(queryableType, memberAccessExpression.Type),
Expand Down