-
Notifications
You must be signed in to change notification settings - Fork 226
Full control over the generated code
Simon Hughes edited this page Jan 27, 2021
·
20 revisions
You can specify the following:
- Which database you are reverse engineering: SqlServer, PostgreSQL, SqlCE. More to come.
- Ability to filter tables, columns, views, stored procedures, table valued functions and scalar valued functions to just the minimum set you require. This is key to having a fast EntityFramework.
- Create enumerations from database tables.
- Which {{mustache}} templates to use: Ef6, EfCore2, EfCore3, FileBased (your own templates).
- Generate separate files, or a single file.
- Ability to control exactly what is generated. Such as POCO classes, DB Context, DB Context interface, POCO Configuration/Mapping classes, Stored procedures and Enums. This is required for enterprise software where different parts of the configuration can exist in different folders or projects.
- Which name to give your DbContext class.
- Which name to give your DbContext interface.
- What namespace you would like to use.
- Generate FakeDbContext for easy unit testing.
- Generator type: Ef6, EfCore, Custom.
- Ability to control usage of mapping tables.
- Which connection string to use for reverse generator.
- Which connection string name to use from your app.config/web.config/appsettings.json.
- Additional base interfaces for your DB context interface. E.g. IDisposable
- Which base classes for the DB context. E.g. for ASP.NET Identity use
IdentityDbContext<ApplicationUser> - Ability to add a default (parameter-less) constructor to your DbContext.
- Customize the name of the configuration classes. "Configuration", "Mapping", "Map", etc. This is appended to the POCO class name to configure the mappings.
- Ability to make classes partial.
- Optionally use PascalCase. This will rename the tables & fields to use PascalCase. If not, then table & field names will be left alone.
- Ability to make use of C# 6 property initialisers to set defaults.
- Ability to marks all navigation properties as virtual or not, to support or disable EF Lazy Loading feature.
- Optionally include comments. This will add the non PascalCased names of fields, primary keys and foreign keys as comments.
- Optionally include extended properties as comments. You can also specify if they should appear in a summary block above the field, or at the end of the field. An extended property is the description field in a SQL Server database.
- Optionally include comments describing connection settings used to generate the files.
- Ability to disable geography types. This turns off use of DbGeography and DbGeometry as OData doesn't support entities with geometry/geography types.
- What the collection type for navigation properties. “List” (default), "ObservableCollection" for example.
- What nullable shorthand you prefer. T? or Nullable
- Ability to specify a default IDbContextFactory implementation for easy dependency injection.
- Ability to include the flag "OPTION (QUERYTRACEON 9481)" for use with SQL Server 2014 (SQL Server 2014 had a fault with its new query plan optimisation).
- Control the use of the [GeneratedCode] attribute.
- Control use of private setters for computed columns.
- Ability to specify additional namespaces to include in the generated code.
- Ability to suppress placing the generated code in a #region.
- Ability to suppress the writing of a namespace.
- Ability to suppress the writing of #pragma.
- Supports cross-database synonym tables.
- Supports multiple result sets from stored procedures.
- Control if the schema name is prepended to the table name. This stops name conflicts if the same table name is used in different schemas
- Ability to perform table renaming. Such as removing a prefix or certain characters from all the tables. Such as tblOrders to Orders, Shipments_AB to Shipments, etc.
- Ability to perform column renaming.
- Ability to perform stored procedure renaming.
- Supports English Pluralisation and the ability to provide your own custom Pluralisation service.
- Includes support for custom pluralisation dictionaries to override singular/pluralisation of words that are not support by the main pluralisation service.