如何在 SQl METAL 命令行工具中提供表信息

发布于 2024-08-21 19:28:19 字数 69 浏览 5 评论 0原文

当我们想直接从数据库生成外部映射文件时,我们如何在命令中提及表信息。我们有 /Database 选项,但是我们如何提及表信息

How do we mention the Table information in the command when we want to generate the external mapping file directly from the database. We have the /Database option but how do we mention the table information

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

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

发布评论

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

评论(2

只是在用心讲痛 2024-08-28 19:28:19

您无法使用 SqlMetal 来指定数据库中的哪些表要为其生成映射 - 不幸的是,要么全有要么全无。

您可以先使用 SqlMetal 为数据库生成 DBML 文件,然后过滤掉 文件。使用您自己编写的自定义流程,根据需要编辑 DBML 文件中的元素。 DBML 文件只是与 DBML 架构匹配的 XML 文件,因此可以使用 LINQ to XML 等轻松进行操作。

DBML 文件准备好后,您可以再次将其传递给 SqlMetal 以生成代码和外部映射文件。

You can't use SqlMetal to specify which tables in a database to generate mapping for - it's all or nothing, unfortunately.

You could use SqlMetal to generate a DBML file for the database first, then filter out <Table> elements in the DBML file as needed, using a custom process you write yourself. A DBML file is just an XML file that matches the DBML schema, so it's easy to manipulate using LINQ to XML, for example.

Once the DBML file is ready, you can pass it to SqlMetal again to generate code and an external mapping file.

别忘他 2024-08-28 19:28:19

尝试使用 SqlMetal Include

Try using SqlMetal Include.

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