forked from sachabarber/SachaBarber.CQRS.Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e2e79e
commit 37f86ce
Showing
8 changed files
with
119 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
SachaBarber.CQRS.Demo/SachaBarber.CQRS.Demo.Orders/OrderServiceClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using SachaBarber.CQRS.Demo.Orders.Commands; | ||
|
||
namespace SachaBarber.CQRS.Demo.Orders | ||
{ | ||
public partial class OrderServiceClient : | ||
System.ServiceModel.ClientBase<IOrderService>, IOrderService | ||
{ | ||
|
||
public OrderServiceClient() | ||
{ | ||
} | ||
|
||
public OrderServiceClient(string endpointConfigurationName) : | ||
base(endpointConfigurationName) | ||
{ | ||
} | ||
|
||
public OrderServiceClient(string endpointConfigurationName, string remoteAddress) : | ||
base(endpointConfigurationName, remoteAddress) | ||
{ | ||
} | ||
|
||
public OrderServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : | ||
base(endpointConfigurationName, remoteAddress) | ||
{ | ||
} | ||
|
||
public OrderServiceClient(System.ServiceModel.Channels.Binding binding, | ||
System.ServiceModel.EndpointAddress remoteAddress) : | ||
base(binding, remoteAddress) | ||
{ | ||
} | ||
|
||
public System.Threading.Tasks.Task<bool> SendCommand(Command command) | ||
{ | ||
return base.Channel.SendCommand(command); | ||
} | ||
} | ||
} |
28 changes: 22 additions & 6 deletions
28
SachaBarber.CQRS.Demo/SachaBarber.CQRS.Demo.Orders/OrderServiceInvoker.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.ServiceModel; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using SachaBarber.CQRS.Demo.Orders.Commands; | ||
using SachaBarber.CQRS.Demo.SharedCore; | ||
using SachaBarber.CQRS.Demo.SharedCore.Exceptions; | ||
using SachaBarber.CQRS.Demo.SharedCore.Faults; | ||
|
||
namespace SachaBarber.CQRS.Demo.Orders | ||
{ | ||
public class OrderServiceInvoker : ServiceInvokerBase, IOrderService | ||
public class OrderServiceInvoker | ||
{ | ||
public bool SendCommand(Command command) | ||
public TR CallService<TR>(Func<IOrderService, TR> requestAction) | ||
{ | ||
return this.CallService<IOrderService, bool>(proxy => proxy.SendCommand(command)); | ||
try | ||
{ | ||
OrderServiceClient proxy = new OrderServiceClient(); | ||
return requestAction(proxy); | ||
} | ||
catch (FaultException<GenericFault> gf) | ||
{ | ||
throw new ApplicationException("A FaultException<GenericFault> occured", gf.InnerException); | ||
} | ||
catch (FaultException<BusinessLogicFault> bf) | ||
{ | ||
throw new BusinessLogicException(bf.Message); | ||
} | ||
catch (Exception ex) | ||
{ | ||
throw new Exception("A Exception occured", ex); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters