如何读取 DBML 文件并将其映射到 .NET 中的对象模型?

发布于 2024-08-11 08:18:04 字数 770 浏览 3 评论 0原文

我计划编写一个代码生成器来生成 UI(表单、网格等)。由于我使用 LINQ 我计划读取 DBML 文件以进行元数据提取。是否有一些 API 可以读取 DBML 对象模型(数据库、表、列和关联)?

我已使用 Red Gate Software 打开 SQLMetal.exe .NET Reflector。它包含一个名为 LinqToSqlShared.DbmlObjectModel 的命名空间,它似乎包含读取 DBML 对象模型所需的所有内容。坏消息是:该名称空间不会公开供外部使用,并且所有类都被声明为“Friend”(或密封)。

再次,是否存在某些东西,例如 LinqToSqlShared.DbmlObjectModel 命名空间,可以将 DBML 读取到 .NET。?还是我必须自己写?

I'm planning to write a code generator to generate UI (forms, grids, etc.). Since I'm using LINQ I'm planning to read a DBML file for metadata extraction purposes. Is there some API to read the DBML object model (database, tables, columns, and associations)?

I've opened SQLMetal.exe with Red Gate Software's .NET Reflector. It contains a namespace called LinqToSqlShared.DbmlObjectModel and it seems it contains everything I need to read a DBML object model. The bad news is: that namespace is not exposed for external consumption and all classes are declared as "Friend" (or sealed).

Once again, does something exist, like the LinqToSqlShared.DbmlObjectModel namespace, to read DBML to an object model in .NET.? Or do I have to write it my self?

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

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

发布评论

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

评论(2

生活了然无味 2024-08-18 08:18:04

看看 L2ST4 项目中如何读取模型。您可以重复使用 T4 文件。

Have a look at how the model is read in L2ST4 project. You could reuse the T4 file.

故事还在继续 2024-08-18 08:18:04

看一下 Reegenerator 这样的工具。我们正在考虑将其作为 L2S 代码生成器的替代品,因为我们有一些特定的代码生成要求。

Take a look at a tool like Reegenerator. We're considering this as a replacement for the L2S code generator, because we've got some specific code generation requirements.

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