-
Notifications
You must be signed in to change notification settings - Fork 226
Settings.ConfigurationClassName
The suffix appended to each entity name to make its Fluent API configuration class.
| Type | string |
| Default | "Configuration" |
| Applies to | EF 6 and EF Core |
| Databases | All |
In Database.tt? |
Yes |
Each entity gets a configuration class holding its table and column mapping. This names it: Product plus
"Configuration" gives ProductConfiguration.
public interface IMyDbContext : IDisposable
public class MyDbContext : DbContext, IMyDbContext
public class MyDbContextFactory : IDesignTimeDbContextFactory<MyDbContext>
public class Category
public class Product
public class sales_Order
public class CategoryConfiguration : IEntityTypeConfiguration<Category>
public class ProductConfiguration : IEntityTypeConfiguration<Product>
public class sales_OrderConfiguration : IEntityTypeConfiguration<sales_Order>Settings.ConfigurationClassName = "Map";public interface IMyDbContext : IDisposable
public class MyDbContext : DbContext, IMyDbContext
public class MyDbContextFactory : IDesignTimeDbContextFactory<MyDbContext>
public class Category
public class Product
public class sales_Order
public class CategoryMap : IEntityTypeConfiguration<Category>
public class ProductMap : IEntityTypeConfiguration<Product>
public class sales_OrderMap : IEntityTypeConfiguration<sales_Order>Match an existing convention. Map and Mapping are both common in codebases that started with EF 6's
EntityTypeConfiguration<T>, and matching means hand-written and generated configurations sit together
consistently.
Avoid a clash. If ProductConfiguration already means something in your domain - a configuration entity,
say - the generated class collides with it.
Leave it alone otherwise. Configuration matches EF Core's IEntityTypeConfiguration<T> naming and is
what most EF documentation uses.
Setting it to an empty string generates a class with the same name as the entity, which does not compile.
Renaming touches every configuration class, and any code that registers them individually rather than
through ApplyConfigurationsFromAssembly.
It has nothing to do with Settings.PocoConfigurationFolder, which is where the files go, or
Settings.PocoConfigurationNamespace, which is the using for them.
Generating the configuration classes at all is
Settings.ElementsToGenerate and Elements.PocoConfiguration. If you have
dropped that flag, this setting has nothing to name.
- Settings.ElementsToGenerate - whether the classes are generated
- Settings.PocoFolder and the folder settings - where they go
-
Settings.EntityClassesModifiers -
ConfigurationClassesModifierslives there - Settings Reference
- Settings A-Z - every setting, with a page each
- Common Settings Types Explained
- Settings Callbacks
- Settings runtime values and helpers
- Filtering
- Full Control Over the Generated Code
- Enum Generation from Table Data
- Owned Entities
- JSON column support
- Global Query Filters
- Extended Property Names Feature
- Partial Properties
- File-Scoped Namespaces
- Data Annotations
- Spatial Types
- HierarchyId
- RowVersion and TimeStamp columns
- Lazy Loading
- Stored proc result sets
- Custom File-Based Templates
- Extra entities via partial classes
- INotifyPropertyChanged
- Syntax colour for T4