在 Enterprise Library 5.0 中映射应用程序块(数据访问应用程序块)?

发布于 2024-09-26 09:29:30 字数 564 浏览 3 评论 0原文

我一直在涉足 Enterprise Library 5 数据访问块,您可以使用 IRowMapper 返回对象(无论是否创建访问器),这是非常巧妙的

http://msdn.microsoft.com/en-us/library/ff664533%28v=PandP.50%29.aspx

我一直在尝试做相反的事情。使用某种映射器将对象保存到数据库,但找不到示例。看起来它只能以一种方式工作(使用映射器将数据库对象转换为业务对象)。有人成功使用 IRowMapper 将对象保存到数据库吗?

我确实找到了名为映射应用程序块的东西,但这仅适用于 EntLib4.1。我们在 EntLib5.0 中有类似的东西吗?

I have been dabbling at Enterprise Library 5 Data Access blocks and it is pretty neat that you can return objects using IRowMapper (with and without creating accessors)

http://msdn.microsoft.com/en-us/library/ff664533%28v=PandP.50%29.aspx

I have been trying to do the reverse. Save objects to DB using some sort of Mapper, but could not find an example. Looks like it only works one way (DB objects to business objects using Mapper). Has someone succeeded in using IRowMapper to save objects to DB ?

I did find something called Mapping Application Blocks, but that only works with EntLib4.1. Do we have something similar in EntLib5.0 ?

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

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

发布评论

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

评论(1

古镇旧梦 2024-10-03 09:29:30

RowMappers 明确是 DB ->仅对象。 Entlib 不是、也永远不会成为对象关系映射器。访问器是一种有用的便利,但它们是故意的 80% 的解决方案。

如果您想要更复杂的东西,那么您很快就会进入 ORM 领域,因此我建议您查看可用于 .NET 的众多 ORM 系统之一。

RowMappers are explicitly DB -> objects only. Entlib is not, and will never become, an object-relational mapper. Accessors are a useful convenience, but they're deliberately an 80% solution.

If you want something more sophisticated, you're rapidly getting into ORM territory, so I'd suggest looking at one of the many ORM systems available for .NET.

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