1.點擊core項目添加鏈接的服務
2.鍵入對應的webservice地址,下載對應的代理服務
4.由於.net core 代理類只支持異步方法 原有webservice同步方法不會顯示 可以使用wait或Result改成同步方式。
1 protected override availableFlightWithPriceAndCommisionReply ExecuteCore(availableFlightWithPriceAndCommisionRequest request) { 2 3 var service = new GetAvailableFlightWithPriceAndCommisionService_1_0Client(); 4 5 return service.getAvailableFlightWithPriceAndCommisionAsync(request).Result.@return; 6 7 }
5.如果異步方法返回實體和同步方法返回實體不一樣 可以使用AutoMapper映射相應的實體
AutoMapper.Mapper.Initialize(c=>c.CreateMap<a,b>()); AutoMapper.Mapper.Map<b>(result);