/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="pagedCriteria"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns> public List<Order> GetPagedOrders(PagedCriteria pagedCriteria) { try { //Resolve root dependencies and perform operations ISalesManagementService salesManagement = IoCFactory.Instance.CurrentContainer.Resolve<ISalesManagementService>(); return salesManagement.FindPagedOrders(pagedCriteria.PageIndex, pagedCriteria.PageCount); } catch (ArgumentException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve<ITraceManager>(); traceManager.TraceError(ex.Message); //propagate exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException<ServiceError>(detailedError); } }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="pagedCriteria"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns> public List<BankTransfer> GetPagedTransfers(PagedCriteria pagedCriteria) { try { using (IBankingManagementService bankingManagement = IoCFactory.Instance.CurrentContainer.Resolve<IBankingManagementService>()) { return bankingManagement.FindBankTransfers(pagedCriteria.PageIndex, pagedCriteria.PageCount); } } catch (ArgumentException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve<ITraceManager>(); traceManager.TraceError(ex.Message); //propagate bussines exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException<ServiceError>(detailedError); } }