Arcturus.Repository.EntityFrameworkCore.NamingConvention
2026.3.15.316
dotnet add package Arcturus.Repository.EntityFrameworkCore.NamingConvention --version 2026.3.15.316
NuGet\Install-Package Arcturus.Repository.EntityFrameworkCore.NamingConvention -Version 2026.3.15.316
<PackageReference Include="Arcturus.Repository.EntityFrameworkCore.NamingConvention" Version="2026.3.15.316" />
<PackageVersion Include="Arcturus.Repository.EntityFrameworkCore.NamingConvention" Version="2026.3.15.316" />
<PackageReference Include="Arcturus.Repository.EntityFrameworkCore.NamingConvention" />
paket add Arcturus.Repository.EntityFrameworkCore.NamingConvention --version 2026.3.15.316
#r "nuget: Arcturus.Repository.EntityFrameworkCore.NamingConvention, 2026.3.15.316"
#:package Arcturus.Repository.EntityFrameworkCore.NamingConvention@2026.3.15.316
#addin nuget:?package=Arcturus.Repository.EntityFrameworkCore.NamingConvention&version=2026.3.15.316
#tool nuget:?package=Arcturus.Repository.EntityFrameworkCore.NamingConvention&version=2026.3.15.316
Arcturus.Repository.EntityFrameworkCore.NamingConvention
Arcturus.Repository.EntityFrameworkCore.NamingConvention is a .NET library that provides automatic naming convention transformations for Entity Framework Core database objects. It enables developers to apply consistent naming standards to tables, columns, keys, indexes, and constraints, ensuring compatibility with database conventions such as snake_case for PostgreSQL or other organizational standards.
Installation
Install the package via NuGet Package Manager or the .NET CLI:
dotnet add package Arcturus.Repository.EntityFrameworkCore.NamingConvention
Or, using the Package Manager Console:
Install-Package Arcturus.Repository.EntityFrameworkCore.NamingConvention
Prerequisites
- .NET 9 or later
- Entity Framework Core 9.0 or later
Features
- Automatic Name Rewriting: Transforms all database identifiers (tables, columns, keys, indexes, constraints) according to the selected naming convention.
- Multiple Naming Strategies:
- SnakeCase: Converts names to snake_case format (e.g.,
UserAccount?user_account) - LowerCase: Converts names to lowercase format (e.g.,
UserAccount?useraccount) - UpperCase: Converts names to uppercase format (e.g.,
UserAccount?USERACCOUNT) - UpperSnakeCase: Converts names to upper snake_case format (e.g.,
UserAccount?USER_ACCOUNT) - CamelCase: Converts names to camelCase format (e.g.,
UserAccount?userAccount)
- SnakeCase: Converts names to snake_case format (e.g.,
- Culture-Aware Transformations: Support for culture-specific case conversions.
- Comprehensive Coverage: Handles all EF Core database objects including:
- Entity tables and views
- Properties and columns
- Primary keys and foreign keys
- Indexes and constraints
- Complex types and JSON columns
- Owned entities and table splitting scenarios
- TPH/TPT/TPC Support: Works seamlessly with all Entity Framework Core inheritance mapping strategies (Table-Per-Hierarchy, Table-Per-Type, Table-Per-Concrete-Type).
- Convention-Based: Integrates with EF Core's convention system for automatic application during model building.
- Extensible: Implement custom naming strategies using the
INamingStrategyinterface. - .NET 9 & .NET 10 Compatible: Optimized for modern .NET platforms with support for the latest EF Core features.
Usage
Basic Configuration
Configure the naming convention in your DbContext options:
using Arcturus.Repository.EntityFrameworkCore.NamingConvention;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder
.UseNpgsql("your-connection-string")
.UseNamingConvention(NamingConvention.SnakeCase);
}
}
Using with Dependency Injection
In your application startup or service configuration:
services.AddDbContext<ApplicationDbContext>(options =>
{
options
.UseNpgsql(connectionString)
.UseNamingConvention(NamingConvention.SnakeCase);
});
Specify Culture
You can specify a culture for case conversions:
using System.Globalization;
optionsBuilder
.UseNpgsql(connectionString)
.UseNamingConvention(NamingConvention.SnakeCase, CultureInfo.InvariantCulture);
Available Naming Conventions
// Snake case: user_account, order_detail
.UseNamingConvention(NamingConvention.SnakeCase)
// Lower case: useraccount, orderdetail
.UseNamingConvention(NamingConvention.LowerCase)
// Upper case: USERACCOUNT, ORDERDETAIL
.UseNamingConvention(NamingConvention.UpperCase)
// Upper snake case: USER_ACCOUNT, ORDER_DETAIL
.UseNamingConvention(NamingConvention.UpperSnakeCase)
// Camel case: userAccount, orderDetail
.UseNamingConvention(NamingConvention.CamelCase)
Examples
Example 1: PostgreSQL with Snake Case
PostgreSQL typically uses snake_case for identifiers:
public class User
{
public int UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime CreatedAt { get; set; }
}
// With SnakeCase naming convention, the table and columns are mapped as:
// Table: "user"
// Columns: "user_id", "first_name", "last_name", "created_at"
Example 2: Complex Types and JSON
The naming convention applies to complex types and JSON columns:
public class Order
{
public int OrderId { get; set; }
public Address ShippingAddress { get; set; } // Complex type
}
public class Address
{
public string StreetName { get; set; }
public string CityName { get; set; }
}
// With SnakeCase, JSON column mapping becomes:
// Table: "order"
// Columns: "order_id", "shipping_address" (JSON column)
// JSON properties: "street_name", "city_name"
Example 3: Custom Naming Strategy
Implement your own naming strategy:
using Arcturus.Repository.EntityFrameworkCore.NamingConvention.Abstracts;
public class CustomNamingStrategy : INamingStrategy
{
public string ApplyNaming(string name)
{
// Your custom transformation logic
return "tbl_" + name.ToLowerInvariant();
}
}
Known Limitations
- TPC Hierarchies: Index and foreign key names on parent types in TPC (Table-Per-Concrete-Type) hierarchies cannot be rewritten individually per child table due to EF Core limitations. The convention clears these names to allow EF to generate unique names per table.
- TPT Primary Keys: Primary key naming is not fully supported in TPT (Table-Per-Type) hierarchies due to EF Core limitations (see dotnet/efcore#23444).
Compatibility Notes
.NET 9 vs .NET 10
The library includes specific handling for differences between EF Core 9 and EF Core 10:
- EF Core 9: Uses direct annotation setting for complex type container columns
- EF Core 10: Uses builder pattern methods for setting container column names
The package automatically detects the target framework and applies the appropriate implementation.
Documentation
For detailed documentation, visit Arcturus Wiki.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter issues or have questions, please file an issue on the GitHub Issues page.
Related Packages
- Arcturus.Repository.EntityFrameworkCore - Generic repository pattern for EF Core
- Arcturus.Repository.EntityFrameworkCore.PostgresSql - PostgreSQL-specific extensions for EF Core
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.4)
-
net9.0
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.3.15.316 | 86 | 3/15/2026 |
| 2026.3.12.308 | 88 | 3/12/2026 |
| 2026.3.11.295 | 87 | 3/11/2026 |
| 2026.3.11.291 | 84 | 3/11/2026 |
| 2026.3.9.275 | 77 | 3/9/2026 |
| 2026.3.9.271 | 78 | 3/9/2026 |
| 2026.3.9.269 | 78 | 3/9/2026 |
| 2026.3.7.268 | 81 | 3/7/2026 |
| 2026.2.26.266 | 95 | 2/26/2026 |
| 2026.2.25.258 | 88 | 2/25/2026 |
| 2026.2.25.257 | 85 | 2/25/2026 |
| 2026.2.25.256 | 82 | 2/25/2026 |
| 2026.2.25.255 | 86 | 2/25/2026 |
| 2026.2.25.253 | 80 | 2/25/2026 |
| 2026.2.25.252 | 83 | 2/25/2026 |
| 2026.2.23.242 | 89 | 2/23/2026 |
| 2026.2.5.233 | 99 | 2/5/2026 |
| 2026.1.15.222 | 96 | 1/15/2026 |
| 2026.1.15.220 | 98 | 1/15/2026 |