문제

From a ColumnSchema object in CodeSmith 6, I need to be able to generate a SQL Server table definition. I'm having trouble generating the types; I need to be able to generate the following types:

varchar(100)
varchar(MAX)
int
bit
etc...

But I can't find a property for this. Is there something in codesmith to extract this? I've been searching but can't find anything...

Thanks.

도움이 되었습니까?

해결책

You can easily create these values by having your template inherit SqlCodeTemplate. Then you would just pass the ColumnSchema object to the GetSqlParameterStatement method which will return this type information.

I'd highly recommend taking a look at the Database\DbSnapShot\TableSchema.cst and StoredProcedures\StoredProcedures.cst templates as they both show insight / or do what you are looking for.

Thanks

-Blake Niemyjski

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top