Quickly Create C# Models From MS Sql Query

Check this out! Got large database tables? have to create a model? done, just change the datatypes to the correct datatypes in the c# model and the below code will do the rest

SELECT 'public', DATA_TYPE, COLUMN_NAME, '{ get; set; }'
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'MyTableName'

Leave a Reply

Your email address will not be published. Required fields are marked *