0

HierachyID フィールドを持つ 2 つのテーブルを持つ 2 つのデータベースがあります。1 つのデータベースでは dal cs ファイルを取得できますが、他のデータベースでは dal cs ファイルを取得できません。

HBus は、dal cs を取得できるデータベースです...

SqlMetal /server:.\SQLSERVER2008 /database:HBus /code:HBusDC.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext

これはファイルを追い出します...これは機能しますが、テーブルの HierarchyID フィールドを除外し、そのテーブルの他のすべてのフィールドを含めます。これで構わないのでOKです。

上記のコマンド行は警告を出しますが、それでもファイルを生成します。

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 は HierarchyID フィールドを持つテーブルです。

私は別のデータベース Elf を持っていますが、ほとんど同じものですが、 SQL Metal を使用すると警告とエラーが発生し、dal cs ファイルを取得できません ...

SqlMetal /server:.\SQLSERVER2008 /database:Elf /code:ElfDataContextDal.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext

エラーと警告が表示され、cs ファイルがディスクに表示されません... :-(

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.

フィールドは Elf db で同じ方法で宣言されます

OrgNode [HierarchyID] null ,

HBus データベースで ...

OrgNode [HierarchyID] null ,

両方のデータベースは sql server 2008 の同じインスタンスにあるため、HierarchyID は組み込み型であり、どちらのデータベースにも HierarchyID udt はありません...

事前に返信をお待ちしております...

4

1 に答える 1

1

実際には、問題はhierarchyidを返したspからのもので、sqlmetalはそれを好まない...解決しました。

于 2010-04-12T22:59:36.760 に答える