martinjw / dbschemareader

Read database metadata (from SqlServer/Oracle/MySql/SQLite/PostgreSql/DB2 etc) into one simple model
Microsoft Public License
293 stars 128 forks source link

Script User Defined Types #171

Closed whibdev closed 1 year ago

whibdev commented 1 year ago

I'm able to see properties of UserDefinedTables and UserDataTypes, but I haven't been able to find methods to generate creation scripts; is this available?

martinjw commented 1 year ago

You need the migrationGenerator. But I'll add an extension method which does this to types and tables

            var ddlGeneratorFactory = new DdlGeneratorFactory(sqlType);
            var migrationGenerator = ddlGeneratorFactory.MigrationGenerator();
            return migrationGenerator.AddUserDataType(udt);
martinjw commented 1 year ago

In 2.9.1