-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make TableSelectionSetExtension implementation case insensitive - Fix R# warnings - Update test to work with case-insensitive table name
- Loading branch information
Showing
3 changed files
with
15 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 12 additions & 11 deletions
23
src/EntityFramework.MicrosoftSqlServer.Design/SqlServerTableSelectionSetExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
// 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.Linq; | ||
using JetBrains.Annotations; | ||
|
||
namespace Microsoft.Data.Entity.Scaffolding | ||
{ | ||
internal static class SqlServerTableSelectionSetExtensions | ||
{ | ||
public static bool Allows(this TableSelectionSet _tableSelectionSet, [NotNull] string schemaName, [NotNull] string tableName) | ||
public static bool Allows(this TableSelectionSet tableSelectionSet, [NotNull] string schemaName, [NotNull] string tableName) | ||
{ | ||
if (_tableSelectionSet == null | ||
|| (_tableSelectionSet.Schemas.Count == 0 | ||
&& _tableSelectionSet.Tables.Count == 0)) | ||
if ((tableSelectionSet == null) | ||
|| ((tableSelectionSet.Schemas.Count == 0) | ||
&& (tableSelectionSet.Tables.Count == 0))) | ||
{ | ||
return true; | ||
} | ||
|
||
if (_tableSelectionSet.Schemas.Contains(schemaName)) | ||
if (tableSelectionSet.Schemas.Contains(schemaName)) | ||
{ | ||
return true; | ||
} | ||
|
||
return _tableSelectionSet.Tables.Contains($"{schemaName}.{tableName}") | ||
|| _tableSelectionSet.Tables.Contains($"[{schemaName}].[{tableName}]") | ||
|| _tableSelectionSet.Tables.Contains($"{schemaName}.[{tableName}]") | ||
|| _tableSelectionSet.Tables.Contains($"[{schemaName}].{tableName}") | ||
|| _tableSelectionSet.Tables.Contains($"{tableName}") | ||
|| _tableSelectionSet.Tables.Contains($"[{tableName}]"); | ||
return tableSelectionSet.Tables.Contains($"{schemaName}.{tableName}", StringComparer.OrdinalIgnoreCase) | ||
|| tableSelectionSet.Tables.Contains($"[{schemaName}].[{tableName}]", StringComparer.OrdinalIgnoreCase) | ||
|| tableSelectionSet.Tables.Contains($"{schemaName}.[{tableName}]", StringComparer.OrdinalIgnoreCase) | ||
|| tableSelectionSet.Tables.Contains($"[{schemaName}].{tableName}", StringComparer.OrdinalIgnoreCase) | ||
|| tableSelectionSet.Tables.Contains($"{tableName}", StringComparer.OrdinalIgnoreCase) | ||
|| tableSelectionSet.Tables.Contains($"[{tableName}]", StringComparer.OrdinalIgnoreCase); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters