mirror of
https://github.com/fergalmoran/EFCore.NamingConventions.git
synced 2025-12-22 09:38:21 +00:00
File-scoped namespaces
This commit is contained in:
@@ -14,8 +14,8 @@ using Microsoft.EntityFrameworkCore.TestUtilities;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
|
||||
namespace EFCore.NamingConventions.Test
|
||||
{
|
||||
namespace EFCore.NamingConventions.Test;
|
||||
|
||||
public class NameRewritingConventionTest
|
||||
{
|
||||
[Fact]
|
||||
@@ -562,4 +562,3 @@ namespace EFCore.NamingConventions.Test
|
||||
public int OwnedProperty { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ using System.Globalization;
|
||||
using EFCore.NamingConventions.Internal;
|
||||
using Xunit;
|
||||
|
||||
namespace EFCore.NamingConventions.Test
|
||||
{
|
||||
namespace EFCore.NamingConventions.Test;
|
||||
|
||||
public class RewriterTest
|
||||
{
|
||||
[Fact]
|
||||
@@ -31,4 +31,3 @@ namespace EFCore.NamingConventions.Test
|
||||
=> Assert.Equal("FULLNAME",
|
||||
new UpperCaseNameRewriter(CultureInfo.InvariantCulture).RewriteName("FullName"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ using Microsoft.EntityFrameworkCore.Sqlite.Diagnostics.Internal;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Microsoft.EntityFrameworkCore.TestUtilities
|
||||
{
|
||||
namespace Microsoft.EntityFrameworkCore.TestUtilities;
|
||||
|
||||
public class SqliteTestHelpers : TestHelpers
|
||||
{
|
||||
protected SqliteTestHelpers()
|
||||
@@ -27,4 +27,3 @@ namespace Microsoft.EntityFrameworkCore.TestUtilities
|
||||
public override LoggingDefinitions LoggingDefinitions { get; } = new SqliteLoggingDefinitions();
|
||||
#pragma warning restore EF1001
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Microsoft.EntityFrameworkCore
|
||||
{
|
||||
namespace Microsoft.EntityFrameworkCore;
|
||||
|
||||
[DebuggerStepThrough]
|
||||
internal static class Check
|
||||
{
|
||||
@@ -107,4 +107,3 @@ namespace Microsoft.EntityFrameworkCore
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace JetBrains.Annotations
|
||||
{
|
||||
namespace JetBrains.Annotations;
|
||||
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter |
|
||||
AttributeTargets.Property | AttributeTargets.Delegate |
|
||||
@@ -105,4 +105,3 @@ namespace JetBrains.Annotations
|
||||
Members = 2,
|
||||
WithMembers = Itself | Members
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class CamelCaseNameRewriter : INameRewriter
|
||||
{
|
||||
private readonly CultureInfo _culture;
|
||||
@@ -11,4 +11,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
public string RewriteName(string name) =>
|
||||
string.IsNullOrEmpty(name) ? name: char.ToLower(name[0], _culture) + name.Substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public interface INameRewriter
|
||||
{
|
||||
string RewriteName(string name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class LowerCaseNameRewriter : INameRewriter
|
||||
{
|
||||
private readonly CultureInfo _culture;
|
||||
@@ -9,4 +9,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
public LowerCaseNameRewriter(CultureInfo culture) => _culture = culture;
|
||||
public string RewriteName(string name) => name.ToLower(_culture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class NameRewritingConvention :
|
||||
IEntityTypeAddedConvention,
|
||||
IEntityTypeAnnotationChangedConvention,
|
||||
@@ -279,4 +279,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public enum NamingConvention
|
||||
{
|
||||
None,
|
||||
@@ -9,4 +9,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
UpperCase,
|
||||
UpperSnakeCase
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class NamingConventionSetPlugin : IConventionSetPlugin
|
||||
{
|
||||
private readonly IDbContextOptions _options;
|
||||
@@ -45,4 +45,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
return conventionSet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class NamingConventionsOptionsExtension : IDbContextOptionsExtension
|
||||
{
|
||||
private DbContextOptionsExtensionInfo _info;
|
||||
@@ -146,4 +146,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class SnakeCaseNameRewriter : INameRewriter
|
||||
{
|
||||
private readonly CultureInfo _culture;
|
||||
@@ -72,4 +72,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class UpperCaseNameRewriter : INameRewriter
|
||||
{
|
||||
private readonly CultureInfo _culture;
|
||||
@@ -9,4 +9,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
public UpperCaseNameRewriter(CultureInfo culture) => _culture = culture;
|
||||
public string RewriteName(string name) => name.ToUpper(_culture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace EFCore.NamingConventions.Internal
|
||||
{
|
||||
namespace EFCore.NamingConventions.Internal;
|
||||
|
||||
public class UpperSnakeCaseNameRewriter : SnakeCaseNameRewriter
|
||||
{
|
||||
private readonly CultureInfo _culture;
|
||||
@@ -10,4 +10,3 @@ namespace EFCore.NamingConventions.Internal
|
||||
|
||||
public override string RewriteName(string name) => base.RewriteName(name).ToUpper(_culture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using JetBrains.Annotations;
|
||||
using EFCore.NamingConventions.Internal;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Microsoft.EntityFrameworkCore
|
||||
{
|
||||
namespace Microsoft.EntityFrameworkCore;
|
||||
|
||||
public static class NamingConventionsExtensions
|
||||
{
|
||||
public static DbContextOptionsBuilder UseSnakeCaseNamingConvention(
|
||||
@@ -103,4 +103,3 @@ namespace Microsoft.EntityFrameworkCore
|
||||
where TContext : DbContext
|
||||
=> (DbContextOptionsBuilder<TContext>)UseCamelCaseNamingConvention((DbContextOptionsBuilder)optionsBuilder, culture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using EFCore.NamingConventions.Internal;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Microsoft.Extensions.DependencyInjection
|
||||
{
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
|
||||
/// </summary>
|
||||
@@ -39,4 +39,3 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
return serviceCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user