Exemple #1
0
        public static Task <StoredResponse> ExecuteTransaction <TPayload, T>(this IMachineInterfaceConnector <T> connector, string requestId,
                                                                             Func <TPayload, T> getPartitionKey,
                                                                             Func <IMachineInterfaceConnectorMessageSession <TPayload>, Task <StoredResponse> > transaction)
        {
            return(connector.ExecuteTransaction(requestId, async stream =>
            {
                using (var streamReader = new StreamReader(stream))
                    using (var reader = new JsonTextReader(streamReader))
                    {
                        var request = serializer.Deserialize <TPayload>(reader);

                        var partitionKey = getPartitionKey(request);
                        return (request, partitionKey);
                    }
            }, transaction));
        }
Exemple #2
0
 public PaymentController(ILogger <PaymentController> logger, IMachineInterfaceConnector <string> connector)
 {
     this.logger    = logger;
     this.connector = connector;
 }