dotConnect for MySQL allows configuring creating and deleting database objects in the CreateDatabase() and DeleteDatabase() methods. These customizations are rather useful for the Code First approach. You can tweak the behaviour of the methods using the MySqlEntityProviderConfig.DatabaseScript.Schema, MySqlEntityProviderConfig.DatabaseScript.Table, and MySqlEntityProviderConfig.DatabaseScript.ForeignKey classes.
DeleteDatabaseBehaviour. This enumeration determines the behavior of the DeleteDatabase() function.
Schema - entire schema, containing model objects, (database) is created/deleted. If the model contains objects from other schemas, these schemas (databases) will be created/deleted as well.
Database - the database (schema), specified in the connection string, is deleted when calling DeleteDatabase(). When calling CreateDatabase(), dotConnect for MySQL tries to create the database. When using DeleteDatabaseBehaviour.Database option, you can specify a non-existent database in the connection string and create this database after connecting.
Note that if there are model objects, mapped to database objects in other schemas, these schemas are created/deleted only when using the following database initialization strategies: CreateDatabaseIfNotExists, DropCreateDatabaseIfModelChanges, DropCreateDatabaseAlways or when explicitly using the CreateDatabase()/DeleteDatabase() methods of the ObjectContext class or the Database class that is used with DbContext instead of using a database initialization strategy. If you use the MigrateDatabaseToLatestVersion database initialization strategy, you need to generate a code-based migration and add SQL commands for creating/deleting necessary schemas using the Sql() method of the DbMigration class.
StorageEngine. This property determines the MySQL storage engine used for the table when creating it using Code First or Code First Migrations. This property can have the following values: