草庐IT

automapper

全部标签

c# - AutoMapper 与 ValueInjecter

按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭11年前。锁定。这个问题及其答案是locked因为这个问题离题但具有历史意义。它目前不接受新的答案或互动。每次我都在寻找AutoMapperStackOverflow上的东西,我正在阅读有关ValueInjecter的内容.谁能告诉我它们之间的优缺点(性能、特性、API使用、可扩展性、测试)?

asp.net-mvc - 具有自定义格式的 ASP.NET MVC ViewModel 映射

我正在处理的项目在域模型中有大量货币属性,我需要将它们格式化为$#,###.##用于传输到View和从View传输。我对可以使用的不同方法有一个看法。一种方法是在View内显式格式化值,如"Pattern1"fromSteveMichelotti:...但这开始违反DRYprinciple很快。首选方法似乎是在DomainModel和ViewModel之间的映射期间进行格式化(根据ASP.NETMVCinAction第4.4.1节和"Pattern3")。使用AutoMapper,这将产生如下代码:[TestFixture]publicclassViewModelTests{[Test

asp.net-mvc - 具有自定义格式的 ASP.NET MVC ViewModel 映射

我正在处理的项目在域模型中有大量货币属性,我需要将它们格式化为$#,###.##用于传输到View和从View传输。我对可以使用的不同方法有一个看法。一种方法是在View内显式格式化值,如"Pattern1"fromSteveMichelotti:...但这开始违反DRYprinciple很快。首选方法似乎是在DomainModel和ViewModel之间的映射期间进行格式化(根据ASP.NETMVCinAction第4.4.1节和"Pattern3")。使用AutoMapper,这将产生如下代码:[TestFixture]publicclassViewModelTests{[Test

关于 c#:Automapper – 使用嵌套视图模型映射视图模型

Automapper-mappingaviewmodelwithnestedviewmodels我有一个包含IList视图模型的视图模型:12345678910 publicclassMyCustomViewModel  {    publicIListItemViewModel>Items{set;get;}    publicIListPersonViewModel>Persons{set;get;}    publicMyCustomViewModel()    {    }  }在我的控制器的索引操作方法中,我无法弄清楚如何正确映射这种嵌套的视图模型。通常我会这样做:12IListIt

关于 c#:Automapper – 使用嵌套视图模型映射视图模型

Automapper-mappingaviewmodelwithnestedviewmodels我有一个包含IList视图模型的视图模型:12345678910 publicclassMyCustomViewModel  {    publicIListItemViewModel>Items{set;get;}    publicIListPersonViewModel>Persons{set;get;}    publicMyCustomViewModel()    {    }  }在我的控制器的索引操作方法中,我无法弄清楚如何正确映射这种嵌套的视图模型。通常我会这样做:12IListIt

关于 c#:ValueInjecter 和 DataTable

ValueInjecterandDataTable我试图找出ValueInjecter,以便我可以在我们自己开发的小ORM中使用它。因为我应该支持DataRow和DataTable映射,所以我正在尝试为这种类型实现映射器。老实说,文档还不够好,我想试一试。也许Omu或该库的其他用户会回答。这是我的DataRow注入器123456789101112131415161718publicclassDataRowInjection:KnownSourceValueInjectionDataRow>  {    protectedoverridevoidInject(DataRowsource,obje

关于 c#:ValueInjecter 和 DataTable

ValueInjecterandDataTable我试图找出ValueInjecter,以便我可以在我们自己开发的小ORM中使用它。因为我应该支持DataRow和DataTable映射,所以我正在尝试为这种类型实现映射器。老实说,文档还不够好,我想试一试。也许Omu或该库的其他用户会回答。这是我的DataRow注入器123456789101112131415161718publicclassDataRowInjection:KnownSourceValueInjectionDataRow>  {    protectedoverridevoidInject(DataRowsource,obje

关于 c#:automapper map collections with action

automappermapcollectionswithaction我有以下代码12345678IListConfigurationDto>result=newListConfigurationDto>();foreach(varconfigurationinawaitconfigurations.ToListAsync()){  varconfigurationDto=_mapper.MapConfigurationDto>(configuration);  configurationDto.FilePath=_fileStorage.GetShortTemporaryLink(config

关于 c#:automapper map collections with action

automappermapcollectionswithaction我有以下代码12345678IListConfigurationDto>result=newListConfigurationDto>();foreach(varconfigurationinawaitconfigurations.ToListAsync()){  varconfigurationDto=_mapper.MapConfigurationDto>(configuration);  configurationDto.FilePath=_fileStorage.GetShortTemporaryLink(config