如何使用 AutoMapper 填充回数据表?

发布于 2024-09-06 16:39:56 字数 257 浏览 2 评论 0原文

我正在使用 AutoMapper,这是一个很棒的工具。

有很多从 DataTable/IDataRead 转换为 DTO 的示例,但我似乎找不到任何将DTO返回转换为DataTable

这可能吗?我尝试过各种方法,但我认为创建行有一些困难 - 因为你不能新建它们。

I'm using AutoMapper which is a great tool.

There's lots of examples converting from DataTable/IDataRead to DTO's but I can't seem to find any that convert the DTO back to a DataTable.

Is this possible? I've tried various things, but I think there's some difficulty with the creation of Rows - as you can't new them up.

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

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

发布评论

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

评论(2

月牙弯弯 2024-09-13 16:39:56

现在还不能开箱即用。您可以做的是创建一个新的 IObjectMapper。查看源代码中的DataReaderMapper.cs(在github上找到),并构建相反的方向。如果你让它发挥作用,我很乐意将你得到的东西重新融入到项目中,因为这听起来是一个非常有趣的想法。

Not right now out of the box. What you COULD do is create a new IObjectMapper. Take a look at the DataReaderMapper.cs in the source code (found on github), and build the opposite direction. If you get it to work, I'll gladly fold what you get back into the project, because it sounds like a really interesting idea.

怎樣才叫好 2024-09-13 16:39:56

我在 GIT 中分叉了它;吉米·博加德 (Jimmy Bogard) 可能希望在下一个主要版本中将其合并。

您可以在此处获取它。

I forked it in GIT; Jimmy Bogard may be looking to merge it in during the next major version.

You can get it here.

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