Example #1
0
        static string GetPolicy <TComponent, TMessage>(ISagaPolicy <TComponent, TMessage> policy)
            where TComponent : class, ISaga
            where TMessage : class
        {
            string description;
            Type   policyType = policy.GetType().GetGenericTypeDefinition();

            if (policyType == typeof(InitiatingSagaPolicy <,>))
            {
                description = "Initiates New";
            }
            else if (policyType == typeof(ExistingOrIgnoreSagaPolicy <,>))
            {
                description = "Orchestrates Existing";
            }
            else if (policyType == typeof(CreateOrUseExistingSagaPolicy <,>))
            {
                description = "Initiates New Or Orchestrates Existing";
            }
            else
            {
                description = policyType.ToFriendlyName();
            }
            return(description);
        }