codesmithtools / Templates

CodeSmith Generator Templates
http://www.codesmithtools.com/product/generator
54 stars 35 forks source link

SQL Server User Defined Type problem #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In SQL Server 2008 create a user defined data type
2. create a table with a column of defined type
3. use the QuickStart.cst file to generate a quick start application.
4. click on the table to view its details.

What is the expected output? What do you see instead?
I expected to see the details of the table. What I got instead was the 
following error: The specified type '<user defined data type>' is not a 
valid provider type. 

What version of the product are you using?
CodeSmith 5.0.3 revision 575, VS 2008 SP1, SQL Server 2008

Please provide any additional information below.

This issue was previously reported on the codeplex site as Issue #3547, 
dated Feb. 2, 2008.

 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 

Original issue reported on code.google.com by kuwan...@gmail.com on 6 Dec 2008 at 1:25

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 28 Jan 2009 at 5:06

GoogleCodeExporter commented 9 years ago
Hello,

Could you please try reproducing this with CodeSmith 5.0.5 as we have made 
changes to
how UDT's are handled.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 30 Jan 2009 at 6:15

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 21 Apr 2009 at 3:57

GoogleCodeExporter commented 9 years ago
Hello,

Please try this in the latest version of CodeSmith and PLINQO. If you are still
experiencing these issues, then please reopen this issue.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 2 Jul 2009 at 4:23

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 7 Oct 2009 at 3:52