问题描述
Mapper.DynamicMap<IDataReader,List<T>>(data.CreateDataReader())这出错,但是我用调试测试居然可以用,用wcf调用接口用不了AutoMapper.AutoMapperMappingException:Mappingtypes:IDataReader->List`1System.Data.IDataReader->System.Collections.Generic.List`1[[HuiShi.Models.GMDBNew.S1MoneyDetail,HuiShi.Models,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null]]Destinationpath:List`1Sourcevalue:System.Data.DataTableReader--->System.InvalidProgramException:公共语言运行时检测到无效的程序。在DynamicCreate(IDataRecord)在AutoMapper.Mappers.DataReaderMapper.Map(ResolutionContextcontext,IMappingEngineRunnermapper)在AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContextcontext)---内部异常堆栈跟踪的结尾---在AutoMapper.MappingEngine.AutoMapper.IMappingEngineRunner.Map(ResolutionContextcontext)在AutoMapper.MappingEngine.DynamicMap[TSource,TDestination](TSourcesource)在HuiShi.Core.Data.SqlHelper.GetDataPage[T](Databasedb,Stringsql,Stringsort,Int32start,Int32limit,Int32&total)位置d:worksapceleonJianghuyouDspG2HuiShi.CoreDataSqlHelper.cs:行号542在Db.GMDBNew.Repositories.S1DHRoleLoveinessRepository.GetS1DHNewMoney(Stringp1,QueryModelqm,Int32Pstart,Int32Plimit,Int32&outTotal)位置d:worksapceleonJianghuyouDspG2Db.GMDBNew.ServiceRepositoriesRepositoryBase.cs:行号1565在Db.GMDBNew.Service.ReportService.GetS1DHNewMoney(PageofList`1p,QueryModelqm)位置d:worksapceleonJianghuyouDspG2Db.GMDBNew.ServiceServicesReportService.cs:行号1398在HuiShi.Services.WCF.GMDBNew.ReportService.GetS1DHNewMoney(PageofList`1p,QueryModelqm)位置d:worksapceleonJianghuyouDspG2HuiShi.ServicesWCFGMDBNewReportService.cs:行号740在SyncInvokeGetS1DHNewMoney(Object,Object[],Object[])在System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Objectinstance,Object[]inputs,Object[]&outputs)在System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&rpc)在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&rpc)在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&rpc)在System.ServiceModel.Dispatcher.MessageRpc.Process(BooleanisOperationContextSet)