Fixup to new lower case convention

See c8ac73cd9a
This commit is contained in:
Shay Rojansky
2020-01-16 20:53:22 +01:00
parent c8ac73cd9a
commit 2967e28968
6 changed files with 12 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ using Xunit;
namespace EFCore.Naming.Test namespace EFCore.Naming.Test
{ {
public class LowerNamingTest public class LowerCaseNamingTest
{ {
[Fact] [Fact]
public void Table_name_is_rewritten() public void Table_name_is_rewritten()

View File

@@ -3,7 +3,7 @@ using Xunit;
namespace EFCore.Naming.Test namespace EFCore.Naming.Test
{ {
public class SnakeNamingTest public class SnakeCaseNamingTest
{ {
[Fact] [Fact]
public void Table_name_is_rewritten() public void Table_name_is_rewritten()

View File

@@ -7,11 +7,11 @@ namespace EFCore.NamingConventions.Internal
class LowerCaseNameRewriter : NameRewriterBase class LowerCaseNameRewriter : NameRewriterBase
{ {
public override void ProcessEntityTypeAdded( public override void ProcessEntityTypeAdded(
IConventionEntityTypeBuilder entityTypeBuilder, IConventionEntityTypeBuilder entityTypeBuilder,
IConventionContext<IConventionEntityTypeBuilder> context) IConventionContext<IConventionEntityTypeBuilder> context)
=> entityTypeBuilder.ToTable( => entityTypeBuilder.ToTable(
entityTypeBuilder.Metadata.GetTableName().ToLowerInvariant(), entityTypeBuilder.Metadata.GetTableName().ToLowerInvariant(),
entityTypeBuilder.Metadata.GetSchema()); entityTypeBuilder.Metadata.GetSchema());
public override void ProcessPropertyAdded( public override void ProcessPropertyAdded(
IConventionPropertyBuilder propertyBuilder, IConventionPropertyBuilder propertyBuilder,

View File

@@ -4,6 +4,6 @@ namespace EFCore.NamingConventions.Internal
{ {
None, None,
SnakeCase, SnakeCase,
AllLowerCase, LowerCase
} }
} }

View File

@@ -22,7 +22,7 @@ namespace EFCore.NamingConventions.Internal
NameRewriterBase nameRewriter = namingStyle switch NameRewriterBase nameRewriter = namingStyle switch
{ {
NamingConvention.SnakeCase => new SnakeCaseNameRewriter(), NamingConvention.SnakeCase => new SnakeCaseNameRewriter(),
NamingConvention.AllLowerCase => new LowerCaseNameRewriter(), NamingConvention.LowerCase => new LowerCaseNameRewriter(),
_ => throw new NotImplementedException("Unhandled enum value: " + namingStyle) _ => throw new NotImplementedException("Unhandled enum value: " + namingStyle)
}; };

View File

@@ -40,7 +40,7 @@ namespace EFCore.NamingConventions.Internal
public virtual NamingConventionsOptionsExtension WithLowerCaseNamingConvention() public virtual NamingConventionsOptionsExtension WithLowerCaseNamingConvention()
{ {
var clone = Clone(); var clone = Clone();
clone._namingConvention = NamingConvention.AllLowerCase; clone._namingConvention = NamingConvention.LowerCase;
return clone; return clone;
} }
@@ -64,14 +64,14 @@ namespace EFCore.NamingConventions.Internal
=> _logFragment ??= Extension._namingConvention switch => _logFragment ??= Extension._namingConvention switch
{ {
NamingConvention.SnakeCase => "using snake-case naming ", NamingConvention.SnakeCase => "using snake-case naming ",
NamingConvention.AllLowerCase => "using lower case naming", NamingConvention.LowerCase => "using lower case naming",
_ => "" _ => ""
}; };
public override long GetServiceProviderHashCode() => Extension._namingConvention.GetHashCode(); public override long GetServiceProviderHashCode() => Extension._namingConvention.GetHashCode();
public override void PopulateDebugInfo(IDictionary<string, string> debugInfo) public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
=> debugInfo["Naming:" + nameof(NamingConventionsOptionsExtension)] => debugInfo["Naming:UseNamingConvention"]
= Extension._namingConvention.GetHashCode().ToString(CultureInfo.InvariantCulture); = Extension._namingConvention.GetHashCode().ToString(CultureInfo.InvariantCulture);
} }
} }