XML 数据模型相对于 DataSet 模型有哪些优点?

发布于 2024-07-09 07:44:17 字数 193 浏览 8 评论 0原文

在我目前的工作中,我们有一个基于 .NET/SQL Server 的 CMS 系统。 在为某些内部使用定制几个模块时,我有点惊讶地发现 API 不是通过绑定到 DataGrid/DataList/Repeater 控件的典型结果集返回数据,而是返回 XML节点/集合,然后传递到 XSLT 转换并以这种方式呈现在页面上。

使用这样的模型有什么好处?

At my current job we have a CMS system that is .NET/SQL Server based. While customizing a couple of the modules for some internal use, I was a little surprised to see that instead of having APIs that returned data via your typical result set that was bound to a DataGrid/DataList/Repeater control, that the APIs returned an XML node/collection, that was then passed to an XSLT transformation and rendered on the page that way.

What are the benefits to using a model like this?

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

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

发布评论

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

评论(4

你在我安 2024-07-16 07:44:17

使用 XSLT 转换将使您能够使用与标准 .Net 网格控件不同的布局和格式。 有些人不赞成使用 .Net 网格,因为它们可能包含不必要的 HTML,而且如果不仔细管理,它们可能会使 ViewState 膨胀。

最近这里有一次关于 .Net 网格的讨论臃肿软件(但开发人员无论如何都会使用它们)。

Using XSLT transformations would enable you to use a different layout and formatting than the standard .Net grid controls. Some people don't approve of using the .Net grids because they can include more HTML than necessary, and because if not managed carefully, they can bloat ViewState.

There was a recent discussion here about the .Net grids being bloatware (but developers use them anyway).

泅人 2024-07-16 07:44:17

输出的页面可以是任何类型,如 html、php 等。

The outputted pages can be of any type, like html, php, etc.

一页 2024-07-16 07:44:17

通过设置页面仅转换的数据源和 xml,您还可以立即创建一个可由其他软件使用的简单“Web 服务”。 例如,将该网格转换为 RSS 提要或编写一个程序来定期抓取该数据并发送更紧迫的警报将是微不足道的。

By setting up the datasource and xml that the page merely transforms, you have also instantly created a simple 'web service' that can be consumed by other software. For example, it would be trivial to turn that grid into an rss feed or write a program to scrape that data periodically and send a more pressing alert.

猫九 2024-07-16 07:44:17

XSLT 方法非常适合 MVC、单元测试、独立关注点,而 ASP.NET 控制得很好……却不是。

警告:我拒绝认为 MS 可以编写比我更好的 html/css/js 的假设。 ASP.NET 控件是笨重的令人厌恶的东西。

The XSLT method is very MVC, unit-testing, separate-concerns friendly where ASP.NET controls well... aren't.

caveat: I reject the assumption that MS can write better html/css/js than I can. ASP.NET controls are clunky abominations.

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