jessyhoule icon

Entity Framework / Create Map Code from SQL DB Columns

jessyhoule | PRO | 12/26/14 01:06:24 AM UTC | 0 ⭐ | 294 👁️ | Never ⏰ | []
C# |

360 B

|

None

|

0 👍

/

0 👎

select pname + prequire + pmax + ';' from
(
select 'Property(e => e.' + name + ').HasColumnName("'+ name +'")' as pname,
case isnullable
       when 0 then '.IsRequired()'
       else '' end as prequire,
case xtype
       when 167 then '.HasMaxLength(' + CAST(length as varchar(50)) +')'
       else '' end as pmax
from syscolumns where id = 1331807777
) a

Comments