コード例 #1
0
    protected override void Setup(FeatureConfigurationContext context)
    {
        context.Settings.EnableFeature<StorageType.Sagas>();

        var settings = context.Settings;
        var endpointName = settings.GetTablePrefix<StorageType.Sagas>();
        var sqlVarient = settings.GetSqlVarient();
        var commandBuilder = new SagaCommandBuilder(sqlVarient,endpointName);
        var jsonSerializerSettings = SagaSettings.GetJsonSerializerSettings(settings);
        var jsonSerializer = BuildJsonSerializer(jsonSerializerSettings);
        var readerCreator = SagaSettings.GetReaderCreator(settings);
        if (readerCreator == null)
        {
            readerCreator = reader => new JsonTextReader(reader);
        }
        var writerCreator = SagaSettings.GetWriterCreator(settings);
        if (writerCreator == null)
        {
            writerCreator = writer => new JsonTextWriter(writer);
        }
        var versionDeserializeBuilder = SagaSettings.GetVersionSettings(settings);
        var infoCache = new SagaInfoCache(versionDeserializeBuilder, jsonSerializer, readerCreator, writerCreator, commandBuilder);
        var sagaPersister = new SagaPersister(infoCache);
        context.Container.ConfigureComponent<ISagaPersister>(() => sagaPersister, DependencyLifecycle.SingleInstance);
    }
コード例 #2
0
 public SagaInfoCache(
     RetrieveVersionSpecificJsonSettings versionSpecificSettings,
     JsonSerializer jsonSerializer,
     Func<TextReader, JsonReader> readerCreator,
     Func<TextWriter, JsonWriter> writerCreator,
     SagaCommandBuilder commandBuilder)
 {
     this.versionSpecificSettings = versionSpecificSettings;
     this.writerCreator = writerCreator;
     this.readerCreator = readerCreator;
     this.jsonSerializer = jsonSerializer;
     this.commandBuilder = commandBuilder;
 }