/// <summary>
        /// Default constructor to initialize the policy constructor
        /// </summary>
        /// <param name="request">New policy request</param>
        public PolicyCreator(NewPolicyRequest request)
        {
            _newPolicyRequest = request;

            var builder = Wireup.UseInternalContainer().UseMessageSerialiser <JsonNetSerialiser>();

            sagaMediator   = builder.ResolveMediator();
            sagaRepository = builder.ResolveRepository();

            _guid = Guid.NewGuid();
            Console.WriteLine($"New GUID: {_guid}");

            ((ISagaMessage)_newPolicyRequest).CorrelationId = _guid;
        }
Esempio n. 2
0
        public OperationResult Initiate(NewPolicyRequest message)
        {
            Console.WriteLine(" * Intializing Saga * ");

            SagaData.Request = message;
            var policy = message.ConvertToPolicy();

            var validationResult = _policyMmgt.ValidateNewPolicyRequest(policy);

            if (validationResult.Any())
            {
                return(new OperationResult(validationResult.ToArray()));
            }

            SagaData.Policy = policy;

            return(new OperationResult());
        }