1

Closed

SQL Server User Defined Type problem

description

I am new to CodeSmith so the terminology may be wrong...
 
I use CodeSmith 4.1, VS2008 RTM and the 2008-01-15 release of PLINQO.
 
It seams that the dbml.cst template handles user defined SQL types incorrectly. The following is from a dbml.cst generated dbml file. The Type is set to DateTime but the DbType is set to the user defined SQL type LastUpdated.
 
<Column Name="LastUpdated" Member="LastUpdated" Storage="_lastUpdated" Type="DateTime" DbType="LastUpdated NOT NULL" CanBeNull="false" />
 
The LastUpdate type is defined like this:
 
CREATE TYPE [dbo].[LastUpdated] FROM [datetime] NULL
 
When an entity is generated the LastUpdated property will get the following attribute:
 
[Column(Name="LastUpdated", Storage="_lastUpdated", DbType="LastUpdated NOT NULL", CanBeNull=false)]
 
and that will lead to runtime errors (DbType should be DbType="DateTime NOT NULL").
 
A dbml file generated by the default designer (using drag and drop from the server explorer) will use the underlying SQL type and look like this:
 
<Column Name="LastUpdated" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
 
I think the dbml.cst template must be updated to use the underlying SQL type.
 
Best regards,
 
Tomas Sondén
Closed Jun 9, 2011 at 9:57 PM by blake05
Please log all issues on our new issue tracker (http://code.google.com/p/codesmith/)

comments