CreateTable() public méthode

public CreateTable ( string name, Action table ) : SchemaBuilder
name string
table Action
Résultat SchemaBuilder
Exemple #1
0
        public void EnsureMigrationRecordsExists()
        {
            try
            {
                Logger.Debug("DataMigrationManager", "Check the table MigrationRecords exists");
                //Check whether the table already existed
                _migrationRecordRepository.Fetch(m => true);
            }
            catch (Exception e)
            {
                Logger.Debug("DataMigrationManager", "MigrationRecords does not exist");
                SchemaBuilder builder = new SchemaBuilder(_interpreter);

                builder.CreateTable("MigrationRecords",
                                    t => t.Column <int>("Id", column => column.PrimaryKey().Identity())
                                    .Column <string>("Version", column => column.WithLength(16))
                                    .Column <string>("TableName"));
            }
        }
        public void EnsureMigrationRecordsExists()
        {
            try
            {
                Logger.Debug("DataMigrationManager", "Check the table MigrationRecords exists");
                //Check whether the table already existed
                _migrationRecordRepository.Fetch(m => true);
            }
            catch(Exception e)
            {
                Logger.Debug("DataMigrationManager", "MigrationRecords does not exist");
                SchemaBuilder builder = new SchemaBuilder(_interpreter);

                builder.CreateTable("MigrationRecords",
                    t => t.Column<int>("Id", column => column.PrimaryKey().Identity())
                          .Column<string>("Version", column => column.WithLength(16))
                          .Column<string>("TableName"));
            }
        }