mirror of
https://github.com/fergalmoran/EFCore.NamingConventions.git
synced 2025-12-22 09:38:21 +00:00
@@ -3,7 +3,7 @@ using Xunit;
|
||||
|
||||
namespace EFCore.Naming.Test
|
||||
{
|
||||
public class LowerNamingTest
|
||||
public class LowerCaseNamingTest
|
||||
{
|
||||
[Fact]
|
||||
public void Table_name_is_rewritten()
|
||||
@@ -3,7 +3,7 @@ using Xunit;
|
||||
|
||||
namespace EFCore.Naming.Test
|
||||
{
|
||||
public class SnakeNamingTest
|
||||
public class SnakeCaseNamingTest
|
||||
{
|
||||
[Fact]
|
||||
public void Table_name_is_rewritten()
|
||||
@@ -7,11 +7,11 @@ namespace EFCore.NamingConventions.Internal
|
||||
class LowerCaseNameRewriter : NameRewriterBase
|
||||
{
|
||||
public override void ProcessEntityTypeAdded(
|
||||
IConventionEntityTypeBuilder entityTypeBuilder,
|
||||
IConventionContext<IConventionEntityTypeBuilder> context)
|
||||
=> entityTypeBuilder.ToTable(
|
||||
entityTypeBuilder.Metadata.GetTableName().ToLowerInvariant(),
|
||||
entityTypeBuilder.Metadata.GetSchema());
|
||||
IConventionEntityTypeBuilder entityTypeBuilder,
|
||||
IConventionContext<IConventionEntityTypeBuilder> context)
|
||||
=> entityTypeBuilder.ToTable(
|
||||
entityTypeBuilder.Metadata.GetTableName().ToLowerInvariant(),
|
||||
entityTypeBuilder.Metadata.GetSchema());
|
||||
|
||||
public override void ProcessPropertyAdded(
|
||||
IConventionPropertyBuilder propertyBuilder,
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
None,
|
||||
SnakeCase,
|
||||
AllLowerCase,
|
||||
LowerCase
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace EFCore.NamingConventions.Internal
|
||||
NameRewriterBase nameRewriter = namingStyle switch
|
||||
{
|
||||
NamingConvention.SnakeCase => new SnakeCaseNameRewriter(),
|
||||
NamingConvention.AllLowerCase => new LowerCaseNameRewriter(),
|
||||
NamingConvention.LowerCase => new LowerCaseNameRewriter(),
|
||||
_ => throw new NotImplementedException("Unhandled enum value: " + namingStyle)
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace EFCore.NamingConventions.Internal
|
||||
public virtual NamingConventionsOptionsExtension WithLowerCaseNamingConvention()
|
||||
{
|
||||
var clone = Clone();
|
||||
clone._namingConvention = NamingConvention.AllLowerCase;
|
||||
clone._namingConvention = NamingConvention.LowerCase;
|
||||
return clone;
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ namespace EFCore.NamingConventions.Internal
|
||||
=> _logFragment ??= Extension._namingConvention switch
|
||||
{
|
||||
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 void PopulateDebugInfo(IDictionary<string, string> debugInfo)
|
||||
=> debugInfo["Naming:" + nameof(NamingConventionsOptionsExtension)]
|
||||
=> debugInfo["Naming:UseNamingConvention"]
|
||||
= Extension._namingConvention.GetHashCode().ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user