public MongoPersistenceWireup(Wireup inner, string connectionName, IDocumentSerializer serializer)
     : base(inner)
 {
     this.Container.Register(c => new MongoPersistenceFactory(
         connectionName,
         serializer).Build());
 }
Пример #2
0
        public static Snapshot ToSnapshot(this BsonDocument doc, IDocumentSerializer serializer)
        {
            if (doc == null)
                return null;

            var id = doc["_id"].AsBsonDocument;
            var streamId = id["StreamId"].AsGuid;
            var streamRevision = id["StreamRevision"].AsInt32;
            var bsonPayload = doc["Payload"];

            object payload;
            switch (bsonPayload.BsonType)
            {
                case BsonType.Binary:
                    payload = serializer.Deserialize<object>(bsonPayload.AsByteArray);
                    break;
                case BsonType.Document:
                    payload = BsonSerializer.Deserialize<object>(bsonPayload.AsBsonDocument);
                    break;
                default:
                    payload = bsonPayload.RawValue;
                    break;
            }

            return new Snapshot(
                streamId,
                streamRevision,
                payload);
        }
Пример #3
0
 public static BsonDocument ToMongoSnapshot(this Snapshot snapshot, IDocumentSerializer serializer)
 {
     return new BsonDocument
     {
         { "_id", new BsonDocument { { "StreamId", snapshot.StreamId }, { "StreamRevision", snapshot.StreamRevision } } },
         { "Payload", BsonDocumentWrapper.Create(serializer.Serialize(snapshot.Payload)) }
     };
 }
    public static Snapshot ToSnapshot(this RavenSnapshot snapshot, IDocumentSerializer serializer)
    {
      if (snapshot == null)
        return null;

      return new Snapshot(snapshot.BucketId, snapshot.StreamId, snapshot.StreamRevision,
        serializer.Deserialize<object>(snapshot.Payload));
    }
Пример #5
0
 public static RavenSnapshot ToRavenSnapshot(this Snapshot snapshot, IDocumentSerializer serializer)
 {
     return new RavenSnapshot
     {
         StreamId = snapshot.StreamId,
         StreamRevision = snapshot.StreamRevision,
         Payload = serializer.Serialize(snapshot.Payload)
     };
 }
Пример #6
0
 public static Commit ToCommit(this RavenCommit commit, IDocumentSerializer serializer)
 {
     return new Commit(commit.StreamId,
         commit.StreamRevision,
         commit.CommitId,
         commit.CommitSequence,
         commit.CommitStamp,
         commit.Headers,
         serializer.Deserialize<List<EventMessage>>(commit.Payload));
 }
Пример #7
0
		public static RavenSnapshot ToRavenSnapshot(this Snapshot snapshot, string partition, IDocumentSerializer serializer)
		{
		    return new RavenSnapshot
			{
                Id = ToRavenSnapshotId(snapshot, partition),
                Partition = partition,
				StreamId = snapshot.StreamId,
				StreamRevision = snapshot.StreamRevision,
				Payload = serializer.Serialize(snapshot.Payload)
			};
		}
		public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, string connectionName, IDocumentSerializer serializer, MongoPersistenceOptions options = null)
		{
			return new MongoPersistenceWireup(wireup, () =>
			{
			    var connectionStringSettings = ConfigurationManager.ConnectionStrings[connectionName];
                if( connectionStringSettings == null)
                    throw new ConfigurationErrorsException(Messages.ConnectionNotFound.FormatWith(connectionName));

			    return connectionStringSettings.ConnectionString;
			}, serializer, options);
		}
 public RavenPersistenceFactory(
     string connectionName,
     IDocumentSerializer serializer,
     TransactionScopeOption scopeOption,
     bool consistentQueries)
 {
     this.ConnectionStringName = connectionName;
     this.serializer = serializer;
     this.scopeOption = scopeOption;
     this.consistentQueries = consistentQueries;
 }
        public MongoPersistenceWireup(Wireup inner, string connectionName, IDocumentSerializer serializer) : base(inner)
        {
            Logger.Debug("Configuring Mongo persistence engine.");

            var options = Container.Resolve<TransactionScopeOption>();
            if (options != TransactionScopeOption.Suppress)
            {
                Logger.Warn("MongoDB does not participate in transactions using TransactionScope.");
            }

            Container.Register(c => new MongoPersistenceFactory(connectionName, serializer).Build());
        }
        public RavenPersistenceWireup(
			Wireup inner,
			string connectionName,
			IDocumentSerializer serializer,
			bool consistentQueries)
            : base(inner)
        {
            this.Container.Register(c => new RavenPersistenceFactory(
                connectionName,
                serializer,
                this.Container.Resolve<TransactionScopeOption>(),
                consistentQueries).Build());
        }
Пример #12
0
 public static BsonDocument ToMongoCommit(this Commit commit, IDocumentSerializer serializer)
 {
     var streamRevision = commit.StreamRevision - (commit.Events.Count - 1);
     var events = commit.Events.Select(e => new BsonDocument { { "StreamRevision", streamRevision++ }, { "Payload", new BsonDocumentWrapper(typeof(EventMessage), serializer.Serialize(e)) } });
     return new BsonDocument
     {
         { "_id", new BsonDocument { { "StreamId", commit.StreamId }, { "CommitSequence", commit.CommitSequence } } },
         { "CommitId", commit.CommitId },
         { "CommitStamp", commit.CommitStamp },
         { "Headers", BsonDocumentWrapper.Create(commit.Headers) },
         { "Events", BsonArray.Create(events) },
         { "Dispatched", false }
     };
 }
 public static ICommit ToCommit(this RavenCommit commit, IDocumentSerializer serializer)
 {
   return new Commit(
       commit.BucketId,
       commit.StreamId,
       commit.StreamRevision,
       commit.CommitId,
       commit.CommitSequence,
       commit.CommitStamp,
       commit.CheckpointNumber.ToString(CultureInfo.InvariantCulture),
       commit.Headers,
       serializer.Deserialize<IList<EventMessage>>(commit.Payload)
       );
 }
Пример #14
0
 public static RavenCommit ToRavenCommit(this Commit commit, IDocumentSerializer serializer)
 {
     return new RavenCommit
     {
         Id = ToRavenCommitId(commit),
         StreamId = commit.StreamId,
         CommitSequence = commit.CommitSequence,
         StartingStreamRevision = commit.StreamRevision - (commit.Events.Count - 1),
         StreamRevision = commit.StreamRevision,
         CommitId = commit.CommitId,
         CommitStamp = commit.CommitStamp,
         Headers = commit.Headers,
         Payload = serializer.Serialize(commit.Events)
     };
 }
Пример #15
0
 public static RavenCommit ToRavenCommit(this CommitAttempt commit, IDocumentSerializer serializer)
 {
     return new RavenCommit
     {
         Id = ToRavenCommitId(commit),
         BucketId = commit.BucketId,
         StreamId = commit.StreamId,
         CommitSequence = commit.CommitSequence,
         StartingStreamRevision = commit.StreamRevision - (commit.Events.Count - 1),
         StreamRevision = commit.StreamRevision,
         CommitId = commit.CommitId,
         CommitStamp = commit.CommitStamp,
         Headers = commit.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value),
         Payload = serializer.Serialize(commit.Events)
     };
 }
Пример #16
0
        public static Commit ToCommit(this BsonDocument doc, IDocumentSerializer serializer)
        {
            if (doc == null)
                return null;

            var id = doc["_id"].AsBsonDocument;
            var streamId = id["StreamId"].AsGuid;
            var commitSequence = id["CommitSequence"].AsInt32;

            var events = doc["Events"].AsBsonArray.Select(e => e.AsBsonDocument["Payload"].IsBsonDocument ? BsonSerializer.Deserialize<EventMessage>(e.AsBsonDocument["Payload"].AsBsonDocument) : serializer.Deserialize<EventMessage>(e.AsBsonDocument["Payload"].AsByteArray)).ToList();
            var streamRevision = doc["Events"].AsBsonArray.Last().AsBsonDocument["StreamRevision"].AsInt32;
            return new Commit(
                streamId,
                streamRevision,
                doc["CommitId"].AsGuid,
                commitSequence,
                doc["CommitStamp"].AsDateTime,
                BsonSerializer.Deserialize<Dictionary<string, object>>(doc["Headers"].AsBsonDocument),
                events);
        }
Пример #17
0
 public MongoPersistenceFactoryFromConnectionString(string connectionString, IDocumentSerializer serializer)
     : base(connectionString, serializer)
 {
     _connectionString = connectionString;
 }
Пример #18
0
 public FormatConverter(InputParser inputParser, IDocumentSerializer documentSerializer)
 {
     this.inputParser        = inputParser;
     this.documentSerializer = documentSerializer;
 }
        public static Wireup UsingMongoPersistence(
			this Wireup wireup, string connectionName, IDocumentSerializer serializer)
        {
            wireup.With(new MongoPersistenceFactory(connectionName, serializer).Build());
            return wireup;
        }
 public MongoPersistenceFactory(string connectionName, IDocumentSerializer serializer)
 {
     this.connectionName = connectionName;
     this.serializer     = serializer;
 }
Пример #21
0
 public ResourceVariableProvider(ISender sender, IDocumentSerializer documentSerializer, ILogger logger) : base(sender, documentSerializer, "resources", logger)
 {
 }
Пример #22
0
        /// <summary>
        /// Creates a new instance of the HttpTransportListener class.
        /// </summary>
        /// <param name="port">The port for listening.</param>
        /// <param name="hostName">Name of the host for binding.</param>
        /// <param name="useHttps">if set to <c>true</c> the listener endpoint will use HTTPS.</param>
        /// <param name="requestTimeout">The request timeout.</param>
        /// <param name="writeExceptionsToOutput">if set to <c>true</c> the exceptions details will be written in the response body.</param>
        /// <param name="httpServer">The HTTP server instance.</param>
        /// <param name="httpTransportProvider">The HTTP transport provider instance.</param>
        /// <param name="serializer">The serializer instance.</param>
        /// <param name="messageStorage">The message storage instance.</param>
        /// <param name="notificationStorage">The notification storage instance.</param>
        /// <param name="processors">The processors.</param>
        /// <param name="traceWriter">The trace writer.</param>
        public HttpTransportListener(int port, string hostName  = "*", bool useHttps        = false, TimeSpan requestTimeout = default(TimeSpan), TimeSpan transportExpirationInactivityInterval = default(TimeSpan), bool writeExceptionsToOutput = true,
                                     int maxDegreeOfParallelism = 1, IHttpServer httpServer = null, IHttpTransportProvider httpTransportProvider = null, IDocumentSerializer serializer          = null, IEnvelopeStorage <Message> messageStorage = null,
                                     IEnvelopeStorage <Notification> notificationStorage = null, IHttpProcessor[] processors = null, ITraceWriter traceWriter = null)
        {
            _useHttps = useHttps;
            var scheme = _useHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp;

            _writeExceptionsToOutput = writeExceptionsToOutput;
            _maxDegreeOfParallelism  = maxDegreeOfParallelism;
            _requestTimeout          = requestTimeout != default(TimeSpan) ? requestTimeout : TimeSpan.FromSeconds(Constants.DEFAULT_REQUEST_TIMEOUT);

            var basePath = string.Format("{0}://{1}:{2}", scheme, hostName, port);
            var prefixes = new string[]
            {
                Constants.ROOT + Constants.MESSAGES_PATH + Constants.ROOT,
                Constants.ROOT + Constants.COMMANDS_PATH + Constants.ROOT,
                Constants.ROOT + Constants.NOTIFICATIONS_PATH + Constants.ROOT
            };

            var fullPrefixes = prefixes.Select(p => basePath + p).ToArray();

            var safeHostName = hostName;

            if (hostName.Equals("*") || hostName.Equals("+"))
            {
                safeHostName = "localhost";
            }

            var baseUri = new Uri(string.Format("{0}://{1}:{2}", scheme, safeHostName, port));

            ListenerUris = prefixes
                           .Select(p => new Uri(baseUri, p))
                           .ToArray();

            _httpServer          = httpServer ?? new HttpServer(fullPrefixes, AuthenticationSchemes.Basic);
            _serializer          = serializer ?? new DocumentSerializer();
            _messageStorage      = messageStorage ?? new DictionaryEnvelopeStorage <Message>();
            _notificationStorage = notificationStorage ?? new DictionaryEnvelopeStorage <Notification>();
            _traceWriter         = traceWriter;

            transportExpirationInactivityInterval = transportExpirationInactivityInterval != default(TimeSpan) ? transportExpirationInactivityInterval : TimeSpan.FromSeconds(Constants.DEFAULT_TRANSPORT_EXPIRATION_INACTIVITY_INTERVAL);
            _httpTransportProvider = httpTransportProvider ?? new HttpTransportProvider(_useHttps, _messageStorage, _notificationStorage, transportExpirationInactivityInterval);
            _httpTransportProvider.TransportCreated += async(sender, e) => await _transportBufferBlock.SendAsync(e.Transport, _listenerCancellationTokenSource.Token).ConfigureAwait(false);

            // Context processors
            _uriTemplateTable = new UriTemplateTable(baseUri);
            if (processors == null)
            {
                processors = CreateProcessors();
            }
            foreach (var processor in processors)
            {
                _uriTemplateTable.KeyValuePairs.Add(new KeyValuePair <UriTemplate, object>(processor.Template, processor));
            }
            _uriTemplateTable.MakeReadOnly(true);
        }
		public static PersistenceWireup UsingMongoPersistence(this Wireup wireup, Func<string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions options = null)
		{
			return new MongoPersistenceWireup(wireup, connectionStringProvider, serializer, options);
		}
 public static StorageDocument ToStorageDocument(this Document document, IDocumentSerializer documentSerializer) => new StorageDocument
 {
     Document = documentSerializer.Serialize(document),
     Type     = document.GetMediaType()
 };
Пример #25
0
        public static BsonDocument ToMongoCommit(this CommitAttempt commit, LongCheckpoint checkpoint, IDocumentSerializer serializer)
        {
            int streamRevision                = commit.StreamRevision - (commit.Events.Count - 1);
            int streamRevisionStart           = streamRevision;
            IEnumerable <BsonDocument> events = commit
                                                .Events
                                                .Select(e =>
                                                        new BsonDocument
            {
                { MongoCommitFields.StreamRevision, streamRevision++ },
                { MongoCommitFields.Payload, new BsonDocumentWrapper(typeof(EventMessage), serializer.Serialize(e)) }
            });

            return(new BsonDocument
            {
                { MongoCommitFields.CheckpointNumber, checkpoint.LongValue },
                { MongoCommitFields.CommitId, commit.CommitId },
                { MongoCommitFields.CommitStamp, commit.CommitStamp },
                { MongoCommitFields.Headers, BsonDocumentWrapper.Create(commit.Headers) },
                { MongoCommitFields.Events, new BsonArray(events) },
                { MongoCommitFields.Dispatched, false },
                { MongoCommitFields.StreamRevisionFrom, streamRevisionStart },
                { MongoCommitFields.StreamRevisionTo, streamRevision - 1 },
                { MongoCommitFields.BucketId, commit.BucketId },
                { MongoCommitFields.StreamId, commit.StreamId },
                { MongoCommitFields.CommitSequence, commit.CommitSequence }
            });
        }
        public static BsonDocument ToMongoCommit(this CommitAttempt commit, Int64 checkpoint, IDocumentSerializer serializer)
        {
            int streamRevision      = commit.StreamRevision - (commit.Events.Count - 1);
            int streamRevisionStart = streamRevision;

            IEnumerable <BsonDocument> events = commit
                                                .Events
                                                .Select(e =>
                                                        new BsonDocument
            {
                { MongoCommitFields.StreamRevision, streamRevision++ },
                { MongoCommitFields.Payload, BsonDocumentWrapper.Create(typeof(EventMessage), serializer.Serialize(e)) }
            });

            var mc = new MongoCommit
            {
                CheckpointNumber   = checkpoint,
                CommitId           = commit.CommitId,
                CommitStamp        = commit.CommitStamp,
                Headers            = commit.Headers,
                Events             = new BsonArray(events),
                StreamRevisionFrom = streamRevisionStart,
                StreamRevisionTo   = streamRevision - 1,
                BucketId           = commit.BucketId,
                StreamId           = commit.StreamId,
                CommitSequence     = commit.CommitSequence
            };

            return(mc.ToBsonDocument());
        }
        public static BsonDocument ToMongoCommit_original(this CommitAttempt commit, Int64 checkpoint, IDocumentSerializer serializer)
        {
            int streamRevision                = commit.StreamRevision - (commit.Events.Count - 1);
            int streamRevisionStart           = streamRevision;
            IEnumerable <BsonDocument> events = commit
                                                .Events
                                                .Select(e =>
                                                        new BsonDocument
            {
                { MongoCommitFields.StreamRevision, streamRevision++ },
                { MongoCommitFields.Payload, BsonDocumentWrapper.Create(typeof(EventMessage), serializer.Serialize(e)) }
            });

            //var dictionarySerialize = new DictionaryInterfaceImplementerSerializer<Dictionary<string, object>>(DictionaryRepresentation.ArrayOfArrays);
            //var dicSer = BsonSerializer.LookupSerializer<Dictionary<string, object>>();

            return(new BsonDocument
            {
                { MongoCommitFields.CheckpointNumber, checkpoint },
                { MongoCommitFields.CommitId, commit.CommitId },
                { MongoCommitFields.CommitStamp, commit.CommitStamp },
                { MongoCommitFields.Headers, BsonDocumentWrapper.Create(commit.Headers) },
                { MongoCommitFields.Events, new BsonArray(events) },
                { MongoCommitFields.StreamRevisionFrom, streamRevisionStart },
                { MongoCommitFields.StreamRevisionTo, streamRevision - 1 },
                { MongoCommitFields.BucketId, commit.BucketId },
                { MongoCommitFields.StreamId, commit.StreamId },
                { MongoCommitFields.CommitSequence, commit.CommitSequence }
            });
        }
Пример #28
0
 public DocumentCreator(IFilePathProvider filePathProvider, IFileHandler fileHandler, IDocumentSerializer documentSerializer)
 {
     FilePathProvider   = filePathProvider;
     FileHandler        = fileHandler;
     DocumentSerializer = documentSerializer;
 }
Пример #29
0
        public static BsonDocument ToMongoCommit(this CommitAttempt commit, Func <int> getNextCheckpointNumber, IDocumentSerializer serializer)
        {
            int streamRevision = commit.StreamRevision - (commit.Events.Count - 1);
            IEnumerable <BsonDocument> events = commit
                                                .Events
                                                .Select(e =>
                                                        new BsonDocument
            {
                { "StreamRevision", streamRevision++ },
                { "Payload", new BsonDocumentWrapper(typeof(EventMessage), serializer.Serialize(e)) }
            });

            return(new BsonDocument
            {
                { MongoFields.Id, new BsonDocument
                  {
                      { MongoFields.BucketId, commit.BucketId },
                      { MongoFields.StreamId, commit.StreamId },
                      { MongoFields.CommitSequence, commit.CommitSequence }
                  } },
                { MongoFields.CommitId, commit.CommitId },
                { MongoFields.CommitStamp, commit.CommitStamp },
                { MongoFields.CheckpointNumber, getNextCheckpointNumber() },
                { MongoFields.Headers, BsonDocumentWrapper.Create(commit.Headers) },
                { MongoFields.Events, new BsonArray(events) },
                { MongoFields.Dispatched, false }
            });
        }
Пример #30
0
 public RedisDatabase(RedisConnection connection, IDocumentSerializer serializer, int databaseNumber)
 {
     Connection = connection;
     Serializer = serializer;
     Number     = databaseNumber;
 }
Пример #31
0
 public MongoPersistenceWireupFromConnectionString(Wireup inner, string connectionString, IDocumentSerializer serializer)
     : base(inner)
 {
     Logger.Debug("Configuring Mongo persistence engine.");
     Container.Register(c => new MongoPersistenceFactoryFromConnectionString(connectionString, serializer).Build());
 }
Пример #32
0
 public void SetUp()
 {
     serializer = new JsonDocumentSerializer();
 }
        public static PersistenceWireup UsingRavenPersistence(
			this Wireup wireup, string connectionName, IDocumentSerializer serializer, bool consistentQueries)
        {
            return new RavenPersistenceWireup(wireup, connectionName, serializer, consistentQueries);
        }
Пример #34
0
 protected internal DocumentPartition(CloudStorageAccount storageAccount, string tableName, string partitionKey, Func <T, string> rowKey, IDocumentSerializer serializer)
 {
     TableName    = tableName ?? DocumentPartition.GetDefaultTableName <T>();
     PartitionKey = partitionKey ?? TablePartition.GetDefaultPartitionKey <T>();
     repository   = new DocumentRepository <T>(storageAccount,
                                               TableName,
                                               _ => PartitionKey,
                                               rowKey ?? RowKeyAttribute.CreateCompiledAccessor <T>(),
                                               serializer);
 }
 public RavenPersistenceFactory(string connectionName, IDocumentSerializer serializer)
     : this(connectionName, serializer, false)
 {
 }
Пример #36
0
 public static RavenSnapshot ToRavenSnapshot(this Snapshot snapshot, string partition, IDocumentSerializer serializer)
 {
     return(new RavenSnapshot
     {
         Id = ToRavenSnapshotId(snapshot, partition),
         Partition = partition,
         StreamId = snapshot.StreamId,
         StreamRevision = snapshot.StreamRevision,
         Payload = serializer.Serialize(snapshot.Payload)
     });
 }
        public static void SetDocumentSerializer(EventStoreConfiguration cfg, IDocumentSerializer serializer)
        {
            if (cfg.ContainsKey(DocumentSerializer_SettingsKey))
            throw new InvalidOperationException("You should not configure document serializer for event store twice.");

              Condition.Requires(cfg, "cfg").IsNotNull();
              Condition.Requires(serializer, "serializer").IsNotNull();
              cfg.Set(DocumentSerializer_SettingsKey, serializer);
        }
        public static PersistenceWireup UsingRavenPersistence(
			this Wireup wireup, string connectionName, IDocumentSerializer serializer)
        {
            return wireup.UsingRavenPersistence(connectionName, serializer, false);
        }
Пример #39
0
 public static RavenCommit ToRavenCommit(this Commit commit, string partition, IDocumentSerializer serializer)
 {
     return(new RavenCommit
     {
         Id = ToRavenCommitId(commit, partition),
         Partition = partition,
         StreamId = commit.StreamId,
         CommitSequence = commit.CommitSequence,
         StartingStreamRevision = commit.StreamRevision - (commit.Events.Count - 1),
         StreamRevision = commit.StreamRevision,
         CommitId = commit.CommitId,
         CommitStamp = commit.CommitStamp,
         Headers = commit.Headers,
         Payload = serializer.Serialize(commit.Events)
     });
 }
 public SqlServerPersonRepository(EventStoreContext dbContext, SamplesContext samplesContext,
                                  IDocumentSerializer serializer, IAggregateFactory aggregateFactory)
     : base(dbContext, serializer, aggregateFactory)
 {
     _samplesContext = samplesContext;
 }
Пример #41
0
        public SendEnvelopeHttpProcessorBase(HashSet <string> methods, UriTemplate template, IDocumentSerializer serializer, ITraceWriter traceWriter = null)
        {
            Methods  = methods;
            Template = template;

            _serializer  = serializer;
            _traceWriter = traceWriter;
        }
	    public MongoPersistenceFactory(Func<string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions options = null)
        {
            _connectionStringProvider = connectionStringProvider;
            _serializer = serializer;
	        _options = options ?? new MongoPersistenceOptions();
        }
Пример #43
0
 public FormatConverter(IDocumentSerializer documentSerializer, InputParser inputParser)
 {
     _documentSerializer = documentSerializer;
     _inputParser        = inputParser;
 }
 public AesEncryptedDocumentSerializer(IDocumentSerializer internalSerializer, AesEncryptionOptions?options = null)
 {
     this.serializer = internalSerializer
                       ?? throw new System.ArgumentNullException(nameof(internalSerializer));
     this.options = options ?? new AesEncryptionOptions();
 }
 public MongoPersistenceFactory(string connectionName, IDocumentSerializer serializer)
 {
     this.connectionName = connectionName;
     this.serializer = serializer;
 }
Пример #46
0
 public AuthenticationContext(IFirebaseSettings settings, INetworkService networkService, IDocumentSerializer jsonSerializer)
 {
     _settings       = settings;
     _networkService = networkService;
     _jsonSerializer = jsonSerializer;
 }
 public virtual RavenPersistenceWireup WithSerializer(IDocumentSerializer instance)
 {
     this.serializer = instance;
     return this;
 }
Пример #48
0
 public RedisClient(string connectionString, IDocumentSerializer serializer = null)
     : this(new RedisConfiguration(connectionString), serializer)
 {
 }
Пример #49
0
 public static PersistenceWireup UsingMongoPersistenceFromConnectionString(
     this Wireup wireup, string connectionName, IDocumentSerializer serializer)
 {
     return new MongoPersistenceWireupFromConnectionString(wireup, connectionName, serializer);
 }
Пример #50
0
 public FormatConverter()
 {
     _documentSerializer = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IDocumentSerializer>();
     _inputParser        = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <InputParser>();
 }
Пример #51
0
        public virtual RavenPersistenceWireup WithSerializer(IDocumentSerializer instance)
        {
            Logger.Debug("Registering serializer of type '{0}'.", instance.GetType());

            this.serializer = instance;
            return this;
        }
 public DocumentStoreInternal(IDocumentSerializer serializer, IDataStore dataStore)
 {
     this.rootDataStore = dataStore ?? throw new ArgumentNullException(nameof(dataStore));
     this.serializer    = serializer ?? throw new ArgumentNullException(nameof(serializer));
 }
 public RavenPersistenceFactory(string connectionName, IDocumentSerializer serializer, RavenPersistenceOptions options)
 {
     _options = options;
     _connectionName = connectionName;
     _serializer = serializer;
 }
Пример #54
0
 public FormatConverter()
 {
     //_documentSerializer = new JsonDocumentSerializer();
     _documentSerializer = new CamelCaseJsonSerializer();
     _inputParser        = new JsonInputParser();
 }
Пример #55
0
 public SendRawMessageAction(ISender sender, IDocumentSerializer documentSerializer)
     : base(nameof(SendRawMessage))
 {
     _sender             = sender;
     _documentSerializer = documentSerializer;
 }
 public RavenPersistenceFactory(string connectionName, IDocumentSerializer serializer, bool consistentQueries)
 {
     this.ConnectionStringName = connectionName;
     this.serializer           = serializer;
     this.consistentQueries    = consistentQueries;
 }
Пример #57
0
 protected ResourceVariableProviderBase(ISender sender, IDocumentSerializer documentSerializer, string resourceName)
 {
     _sender             = sender;
     _documentSerializer = documentSerializer;
     _resourceName       = resourceName ?? throw new ArgumentNullException(nameof(resourceName));
 }
 public ContactVariableProvider(IContactExtension contactExtension, IDocumentSerializer documentSerializer)
     : base(VariableSource.Contact, ContextExtensions.CONTACT_KEY)
 {
     _contactExtension   = contactExtension;
     _documentSerializer = documentSerializer;
 }
Пример #59
0
 public FormatConverter(InputParser inputParser, IDocumentSerializer documentSerializer)
 {
     this.inputParser = inputParser;
     this.documentSerializer = documentSerializer;
 }
        public MongoPersistenceWireup(Wireup inner, Func <string> connectionStringProvider, IDocumentSerializer serializer, MongoPersistenceOptions persistenceOptions)
            : base(inner)
        {
            Logger.Debug("Configuring Mongo persistence engine.");

#if !NETSTANDARD1_6
            var options = Container.Resolve <TransactionScopeOption>();
            if (options != TransactionScopeOption.Suppress)
            {
                Logger.Warn("MongoDB does not participate in transactions using TransactionScope.");
            }
#endif

            Container.Register(_ => new MongoPersistenceFactory(connectionStringProvider, serializer, persistenceOptions).Build());
        }