SqlMetal、Sql Server 2008 数据库、带有 HierachyID 的表、dal cs 文件有时会创建?

发布于 2024-08-28 06:12:55 字数 2131 浏览 5 评论 0原文

我有 2 个数据库,其中有 2 个带有 HierachyID 字段的表。 对于一个数据库,我可以获得 dal cs 文件,对于另一个数据库,我无法获得 dal cs 文件?

HBus 是一个我可以获取其 dal cs 的数据库,...

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

这会弹出一个文件,...它可以工作,但排除表的 HierarchyID 字段并包含该表的所有其他字段。这没关系,我不介意。

上面的命令行会发出警告,但仍然会生成一个文件,就像

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 db ...

OrgNode [HierarchyID] null 中,

两个数据库都位于 sql server 2008 的同一个实例中,因此 HierarchyID 是内置类型,两个数据库都没有 HierarchyID udt ,...

提前为任何回复欢呼......

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 ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

琉璃梦幻 2024-09-04 06:12:56

实际上这个问题是来自一个返回hierarchyid的sp,而sqlmetal不喜欢这样,...解决了。

Actually the issue was from an sp that returned hierarchyid, and sqlmetal does not like that, ... solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文