Example #1
0
        /// <summary>
        /// This method adds the appropriate persistence command.
        /// </summary>
        /// <param name="cpipe">The pipeline.</param>
        static void ServerCommunicationSet(IPipelineChannelIncoming <MicroservicePipeline> cpipe)
        {
            var config = cpipe.ToConfiguration();

            switch (sSettings.CommunicationType)
            {
            case CommunicationOptions.Local:
                break;

            case CommunicationOptions.Tcp:
                cpipe.AttachTcpTlsListener();
                break;

            case CommunicationOptions.Tls:
                break;

            case CommunicationOptions.AzureServiceBus:
                cpipe.AttachAzureServiceBusTopicListener();
                break;

            case CommunicationOptions.AzureBlobQueue:
                break;

            default:
                throw new NotSupportedException();
            }
        }
        static void PersistenceCommandSet(IPipelineChannelIncoming <MicroservicePipeline> cpipe)
        {
            var config = cpipe.ToConfiguration();

            switch (sContext.PersistenceType)
            {
            case PersistenceOptions.Sql:
                cpipe.AttachCommand(new PersistenceMondayMorningBluesSql(config.SqlConnection(), MondayMorningBluesHelper.VersionPolicyHelper));
                break;

            case PersistenceOptions.Blob:
                cpipe.AttachPersistenceManagerAzureBlobStorage(
                    (MondayMorningBlues k) => k.Id
                    , (s) => new Guid(s)
                    , keySerializer: (g) => g.ToString("N").ToUpperInvariant()
                    , versionPolicy: MondayMorningBluesHelper.VersionPolicyHelper
                    , referenceMaker: MondayMorningBluesHelper.ToReferences
                    );
                break;

            case PersistenceOptions.DocumentDb:
                cpipe.AttachPersistenceManagerDocumentDb(
                    (MondayMorningBlues k) => k.Id
                    , (s) => new Guid(s)
                    , versionPolicy: MondayMorningBluesHelper.VersionPolicyHelper
                    , referenceMaker: MondayMorningBluesHelper.ToReferences
                    ); break;

            case PersistenceOptions.DocumentDbSdk:
                cpipe.AttachPersistenceManagerDocumentDbSdk(
                    (MondayMorningBlues k) => k.Id
                    , (s) => new Guid(s)
                    , versionPolicy: MondayMorningBluesHelper.VersionPolicyHelper
                    , referenceMaker: MondayMorningBluesHelper.ToReferences
                    );
                break;

            case PersistenceOptions.Memory:
                cpipe.AttachPersistenceManagerHandlerMemory(
                    (MondayMorningBlues k) => k.Id
                    , (s) => new Guid(s)
                    , versionPolicy: MondayMorningBluesHelper.VersionPolicyHelper
                    , referenceMaker: MondayMorningBluesHelper.ToReferences);
                break;

            case PersistenceOptions.RedisCache:
                cpipe.AttachPersistenceManagerRedisCache(
                    (MondayMorningBlues k) => k.Id
                    , (s) => new Guid(s)
                    , versionPolicy: MondayMorningBluesHelper.VersionPolicyHelper
                    , referenceMaker: MondayMorningBluesHelper.ToReferences);
                break;
            }
        }