.net4 中的映射
在浏览我从微软网站下载的mvc2视频教程时,培训师说.net4中有可用的工具,我们可以映射不同类的两个对象的字段,并且我们不需要一一设置这些值。
假设我有一个名为 tblusermaster 的表,其中包含 20 列,并且我创建了一个名为 usermasterModel 的模型,该模型也包含几乎相同类型的字段和名称。
因此,当我想将 tblusermaster 对象的值分配给 usermasterModel 对象时,我必须一一手动设置所有 20 个字段的值,但他说有一种工具可以映射此类内容,我们不必编写 20将值从一个对象传输到另一个对象(不同类但类型和名称相同)的行。
我已经为此进行了谷歌搜索,但无法得到如何做到这一点的答案。
请帮助我并给我链接和任何好的教程。
谢谢 编辑:其 http://www.asp.net/mvc 视频名称是 asp.net mvc2 basic另一件是 Scott Hanselman 的 asp.net mvc2 ninja 黑带
while going through video tutorials for mvc2 which i downloaded from microsoft's website, the traineer said that there is facility available in .net4 that we can map the fields of two object of different class and we need not to set there values one by one.
let say i have got a table named tblusermaster which contains 20 columns and i have created a model named usermasterModel which also contains almost same kind of fields and name.
so when i wants to assign values from object of tblusermaster to object of usermasterModel i will have to set value for all 20 fields manually one by one but he was saying that there is a facility to map such thing and we will not have to write 20 lines to transfer values from one object to another (of different class but same type and name).
i have done google for this but not able to get answer that how to do that.
please help me out and give me link and any good tutorial for this.
Thanks
EDIT: its on http://www.asp.net/mvc video names are asp.net mvc2 basic and another one is asp.net mvc2 ninja black belt by Scott Hanselman
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能指的是 CodePlex 上的 AutoMapper 项目。
此处有一个截屏视频。
Your probably referring to the AutoMapper project on CodePlex.
There is a screencast on it here.