SqlMetal, Sql Server 2008 database, Table with HierachyID, dal cs file is created sometimes ?
- by judek.mp
I have 2 databases with a 2 tables with HierachyID fields.
For one database I can get a dal cs file, for the other database I cannot get a dal cs file ?
HBus is a database I can get the dal cs for, ...
SqlMetal /server:.\SQLSERVER2008 /database:HBus /code:HBusDC.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext
This kicks me out a file, ... which works, but excludes the HierarchyID field for the table and includes all other fields for that table. This is OK I do not mind.
The above cmd line kicks out an warning but still produces a file, like so
SqlMetal /server:.\SQLSERVER2008 /database:HBus /code:HBusDC.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext
Microsoft (R) Database Mapping Generator 2008 version 1.00.30729
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
Warning : SQM1021: Unable to extract column 'OrgNode' of Table 'dbo.HMsg' from SqlServer because the column's DbType is a user-defined type (UDT).
Warning : SQM1021: Unable to extract column 'OrgNode' of Table 'dbo.vwHMsg' from SqlServer because the column's DbType is a user-defined type (UDT).
HMsg is a table with a HierarchyID field.
I have another database, Elf, almost the same thing but I get a warning and an Error when using sql metal and I do not get a dal cs file ...
SqlMetal /server:.\SQLSERVER2008 /database:Elf /code:ElfDataContextDal.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext
An error as well as the warning and the cs file fails to appear on my disc, ... :-(
SqlMetal /server:.\SQLSERVER2008 /database:Elf /code:ElfDataContextDal.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext
Microsoft (R) Database Mapping Generator 2008 version 1.00.30729
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
Warning : SQM1021: Unable to extract column 'OrgNode' of Table 'dbo.EntityLink' from SqlServer because the column's DbType is a user-defined type (UDT).
Error : Requested value 'ELF.SYS.HIERARCHYID' was not found.
The fields are declared the same way
in Elf db
OrgNode [HierarchyID] null ,
in HBus db ...
OrgNode [HierarchyID] null ,
Both databases are in the same instance of sql server 2008, so the HierarchyID is an inbuilt type, neither db has HierarchyID udt ,...
cheers in advance for any replies ...