private static string GenerateDataType(Column column)
        {
            var sqlGenerator = new SqlServerMigrationOperationSqlGenerator(new SqlServerTypeMapper())
            {
                Database = new DatabaseModel()
            };

            sqlGenerator.Database.AddTable(column.Table);
            return(sqlGenerator.GenerateDataType(column.Table.Name, column));
        }
Пример #2
0
        public void GenerateDataType_for_string_key()
        {
            var sqlGenerator = new SqlServerMigrationOperationSqlGenerator(new SqlServerTypeMapper());

            var column = new Column("Username", typeof(string));
            var table  = new Table("dbo.Users");

            table.PrimaryKey = new PrimaryKey("PK_Users", new List <Column>()
            {
                column
            }.AsReadOnly());
            table.AddColumn(column);

            Assert.Equal("nvarchar(128)", sqlGenerator.GenerateDataType(column));
        }
 private static string GenerateDataType(Column column)
 {
     var sqlGenerator = new SqlServerMigrationOperationSqlGenerator(new SqlServerTypeMapper()) { Database = new DatabaseModel() };
     sqlGenerator.Database.AddTable(column.Table);
     return sqlGenerator.GenerateDataType(column.Table.Name, column);
 }