Entity Developer offers a console application ed.exe. This application can:
• | generate model from a database (all schemas/tables or only specified ones) |
• | generate code for the model |
• | generate script for creating a database, based on the model |
• | generate script, updating database from model |
The application is located (by default) in the %Program Files%\Devart\Entity Developer\Console folder. The installer adds this folder to your PATH environment variable, so you can call it from any folder without specifying the full path to it.
![console](console.png)
Here are the main console Entity Developer parameters:
Initializes a new model settings (.edps) file.
Parameter
|
Meaning
|
--SettingsFile
|
.edps file name.
|
--Templates
|
Required. One template name or comma-separated list of template names. You can find the list of available predefined templates here: Model Template Types. Just add " C#" or " Visual Basic" (without quotes) after the template names from the list to specify the language.
|
--Open
|
Open model settings file after creation using default application.
|
Examples:
ed Init-Settings --SettingsFile "d:\Project\Model.edps" --Templates "EF Core C#" --Open
ed Init-Settings --SettingsFile "d:\Project\Model.edps" --Templates "NHibernate Visual Basic"
Notes
After executing this command, you need to edit the result .edps file. In this file:
• | You must specify the Provider and ConnectionString parameters. |
• | You may edit the ModelSettings attributes: TargetFramework, ORM version, etc. |
• | You may modify DatabaseFirstNamingRules |
• | You may modify property values for added code generation templates |
etc. After editing this file, you may use it for the ed Create-Model command by specifying it in the --SettingsFile parameter.
|
Creates model from database.
Parameter
|
Meaning
|
--ModelFile
|
.Model file name.
|
--SettingsFile
|
Model settings (.edps) file name. Your can specify Provider name, Connection string, Templates and many other options in edps file. Edps file can be created by Init-Settings command.
|
--Templates
|
One template name or colon-separated list of template names. You can find the list of available predefined templates here: Model Template Types. Just add " C#" or " Visual Basic" (without quotes) after the template names from the list to specify the language.
|
--Provider
|
Provider invariant name.
|
--Connection
|
Connection string.
|
--Schemas
|
One schema name or comma-separated list of schema names to include in the model. If this parameter is omitted, all schemas are included.
|
--Tables
|
One table name or comma-separated list of table names to include in the model. If this parameter is omitted, all tables are included.
|
--Views
|
One view name or comma-separated list of view names to include in the model. If this parameter is omitted, all views are included.
|
--Functions
|
One stored function name or comma-separated list of function names to include in the model. If this parameter is omitted, all functions are included.
|
--Procedures
|
One stored procedure name or comma-separated list of procedure names to include in the model. If this parameter is omitted, all procedures are included.
|
--Execute
|
Allows obtaining the metadata of stored procedure or function result by executing stored procedures and functions while generating model, and this may cause database damage. If this parameter is omitted, no stored routines are executed.
|
--ContextNamespace
|
A namespace to use for the Context class.
|
--DefaultNamespace
|
A namespace to use for all the generated classes by default: entities, complex types, context (if ContextNamespace is not set separately).
|
--Force
|
Overwrite existing model file.
|
--Verbose
|
Displays detailed information about actions performed by the command.
|
Examples:
ed Create-Model --SettingsFile "d:\Project\Model.edps" --Schemas dbo --Tables "Orders", "Order Details" --Verbose
ed Create-Model --Provider System.Data.SqlClient --Connection "Data Source=***;User Id=***;Password=***;Database=***;" --Templates "EF Core C#" --Schemas dbo --ModelFile "d:\Project\Model.efml" --Tables "Orders", "Order Details" --Verbose
Notes
You need to specify either the --SettingsFile parameter or --Provider, --Connection, and --Templates. If the --SettingsFile parameter is specified, the --ModelFile parameter is not required - the model file will be named as the settings file. Otherwise, it is strongly recommended to specify the --ModelFile parameter.
|
Applies all enabled model templates and generates code. This command is usually used after the user modified template settings in a .edps file or edited the model (class or property names).
Parameter
|
Meaning
|
--ModelFile
|
Model file name.
|
|
Validates model. Checks for errors and warnings.
Parameter
|
Meaning
|
--ModelFile
|
Model file name.
|
|
Generates a DDL script, creating database from model, and saves it to the specified file.
Parameter
|
Meaning
|
--ModelFile
|
Model file name.
|
--ScriptFile
|
Script file name.
|
--Open
|
Open script file after creation using default application.
|
Notes
If the --ScriptFile parameter is not set, Entity Developer generates .sql file with the same name as the model. You can specify not only sql file extension, but any extension in the --ScriptFile parameter.
|
Generates a DDL script, updating database based on model changes, and saves it to the specified file.
Parameter
|
Meaning
|
--ModelFile
|
Model file name.
|
--ScriptFile
|
Script file name.
|
--Open
|
Open script file after creation using default application.
|
|