Skip to content

Instantly share code, notes, and snippets.

View thomasw-mitutoyo-ctl's full-sized avatar

Thomas Weller thomasw-mitutoyo-ctl

View GitHub Profile
@thomasw-mitutoyo-ctl
thomasw-mitutoyo-ctl / gist:9dc43e0ec0d41af970d3a5c755c1cb74
Last active April 26, 2018 14:53 — forked from pdwetz/gist:5368441
Outputs a POCO for a given MySql table. Based on http://stackoverflow.com/a/13918084/21865 with changes for ShaoLinq.
select 'replacewithtablename' into @table;
select 'replacewithdatabasename' into @schema;
select GROUP_CONCAT(r.x SEPARATOR '\n') from
(
select '[DataAccessObject]'as x,'grp'as grp union
select concat('public abstract class ',@table,'{') as x, 'grp' as grp
union
select concat('[PersistedMember]\npublic abstract ',tps.dest,IF(tps.dest = 'string', ' ', IF(is_nullable = 'NO', ' ', '? ')), REPLACE(column_name, ' ', ''),' {get;set;}'), 'grp'