[英]How do I use AutoMapper to populate back to a DataTable?
I'm using AutoMapper which is a great tool. 我正在使用AutoMapper,这是一个很棒的工具。
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
. 有很多的例子将从DataTable
/ IDataRead
到 DTO
的,但我似乎无法找到任何转换DTO
回 DataTable
。
Is this possible? 这可能吗? I've tried various things, but I think there's some difficulty with the creation of Row
s - as you can't new
them up. 我尝试了各种各样的东西,但我认为Row
的创建存在一些困难 - 因为你不能new
它们。
Not right now out of the box. 现在不是开箱即用的。 What you COULD do is create a new IObjectMapper. 您可以做的是创建一个新的IObjectMapper。 Take a look at the DataReaderMapper.cs in the source code (found on github), and build the opposite direction. 看一下源代码中的DataReaderMapper.cs(在github上找到),并构建相反的方向。 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. 如果你开始工作,我很乐意将你回到项目中的内容折叠起来,因为这听起来真的很有意思。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.