Skip to content

Instantly share code, notes, and snippets.

@rippo
Created June 27, 2017 13:27
Show Gist options
  • Save rippo/3cd8691f9c6ad9c95674b8fedb7ee8bd to your computer and use it in GitHub Desktop.
Save rippo/3cd8691f9c6ad9c95674b8fedb7ee8bd to your computer and use it in GitHub Desktop.
select concat('public ',tps.dest,' ',column_name,'{get;set;}') as code
from information_schema.columns c
join(
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime' union all
select 'text' ,'string' union all
select 'bit' ,'int' union all
select 'bigint' ,'int' union all
select 'int' ,'int' union all
select 'double' ,'double' union all
select 'decimal' ,'decimal' union all
select 'date' ,'DateTime' union all
select 'tinyint' ,'bool'
) tps on c.data_type like tps.orign
where table_schema='lm3online' and table_name='lm3archiveframeworktwin'
order by c.ordinal_position;
select concat('Property(x => x.',column_name,');') as code
from information_schema.columns c
join(
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime' union all
select 'text' ,'string' union all
select 'bit' ,'int' union all
select 'bigint' ,'int' union all
select 'int' ,'int' union all
select 'double' ,'double' union all
select 'decimal' ,'decimal' union all
select 'date' ,'DateTime' union all
select 'tinyint' ,'bool'
) tps on c.data_type like tps.orign
where table_schema='lm3online' and table_name='lm3archiveframeworktwin'
order by c.ordinal_position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment