Exemplo n.º 1
0
        public object DeserializePayload(
            TypeResolver typeResolver, IJsonProcessor jsonProcessor)
        {
            Type type = typeResolver.TryResolveType(EventType);

            return(DeserializePayload(jsonProcessor, type));
        }
Exemplo n.º 2
0
 public EntityEventStore(Func <EventStoreContext> contextFactory,
                         TypeResolver typeResolver,
                         IJsonProcessor jsonProcessor,
                         IMessageBus eventBus)
     : this(contextFactory, uniquePropertyDetector : default, typeResolver, jsonProcessor, eventBus)
 {
 }
Exemplo n.º 3
0
        public Message GenerateMessage(
            TypeResolver typeResolver, IJsonProcessor jsonProcessor)
        {
            Type type = typeResolver.TryResolveType(EventType);

            ConstructorInfo constructor = typeof(StreamEvent <>)
                                          .MakeGenericType(type)
                                          .GetTypeInfo()
                                          .GetConstructor(types: new[]
            {
                typeof(Guid),
                typeof(long),
                typeof(DateTime),
                type,
            });

            object data = constructor.Invoke(parameters: new object[]
            {
                StreamId,
                Version,
                RaisedTimeUtc,
                DeserializePayload(jsonProcessor, type),
            });

            return(new Message(id: MessageId, data, TracingProperties));
        }
Exemplo n.º 4
0
        public static Message GenerateMessage(
            this IEvent entity,
            TypeResolver typeResolver,
            IJsonProcessor jsonProcessor)
        {
            Type type = typeResolver.TryResolveType(entity.EventType);

            ConstructorInfo constructor = typeof(StreamEvent <>)
                                          .MakeGenericType(type)
                                          .GetTypeInfo()
                                          .GetConstructor(new[]
            {
                typeof(Guid),
                typeof(long),
                typeof(DateTime),
                type,
            });

            object data = constructor.Invoke(parameters: new object[]
            {
                entity.StreamId,
                entity.Version,
                new DateTime(entity.RaisedTimeUtc.Ticks, DateTimeKind.Utc),
                jsonProcessor.FromJson(entity.Payload, type),
            });

            var tracingProperties = new TracingProperties(
                entity.OperationId,
                entity.Contributor,
                entity.ParentId);

            return(new Message(id: entity.MessageId, data, tracingProperties));
        }
Exemplo n.º 5
0
 public EntityFlushEventsCommandExecutor(
     Func <EventStoreContext> contextFactory,
     TypeResolver typeResolver,
     IJsonProcessor jsonProcessor,
     IMessageBus eventBus)
 {
     _publisher = new EventPublisher(contextFactory, typeResolver, jsonProcessor, eventBus);
 }
 public TableFlushEventsCommandExecutor(
     CloudTable table,
     TypeResolver typeResolver,
     IJsonProcessor jsonProcessor,
     IMessageBus eventBus)
 {
     _publisher = new EventPublisher(table, typeResolver, jsonProcessor, eventBus);
 }
 public BlobSnapshotter(IStateRehydrator <T> rehydrator,
                        IJsonProcessor jsonProcessor,
                        CloudBlobContainer container)
 {
     _rehydrator    = rehydrator;
     _jsonProcessor = jsonProcessor;
     _container     = container;
 }
        public static T FromJson <T>(this IJsonProcessor jsonProcessor, string json)
        {
            if (jsonProcessor is null)
            {
                throw new ArgumentNullException(nameof(jsonProcessor));
            }

            return((T)jsonProcessor.FromJson(json, dataType: typeof(T)));
        }
 public EntityEventStore(Func <EventStoreContext> contextFactory,
                         TypeResolver typeResolver,
                         IJsonProcessor jsonProcessor,
                         IMessageBus eventBus)
 {
     _contextFactory = contextFactory;
     _typeResolver   = typeResolver;
     _jsonProcessor  = jsonProcessor;
     _publisher      = new EventPublisher(contextFactory, typeResolver, jsonProcessor, eventBus);
 }
Exemplo n.º 10
0
 public EventPublisher(Func <EventStoreContext> contextFactory,
                       TypeResolver typeResolver,
                       IJsonProcessor jsonProcessor,
                       IMessageBus eventBus)
 {
     _contextFactory = contextFactory;
     _typeResolver   = typeResolver;
     _jsonProcessor  = jsonProcessor;
     _eventBus       = eventBus;
 }
Exemplo n.º 11
0
 public EventPublisher(CloudTable table,
                       TypeResolver typeResolver,
                       IJsonProcessor jsonProcessor,
                       IMessageBus eventBus)
 {
     _table         = table;
     _typeResolver  = typeResolver;
     _jsonProcessor = jsonProcessor;
     _eventBus      = eventBus;
 }
 public TableEventStore(CloudTable table,
                        TypeResolver typeResolver,
                        IJsonProcessor jsonProcessor,
                        IMessageBus eventBus)
 {
     _table         = table;
     _typeResolver  = typeResolver;
     _jsonProcessor = jsonProcessor;
     _publisher     = new EventPublisher(table, typeResolver, jsonProcessor, eventBus);
 }
Exemplo n.º 13
0
        public void ConvertToEvent_serializes_data_correctly(
            string id,
            MessageData1 data,
            TracingProperties tracingProperties,
            [Frozen] IJsonProcessor jsonProcessor,
            EventConverter sut)
        {
            var message = new Message(id, data, tracingProperties);

            EventData actual = sut.ConvertToEvent(message);

            string       body    = Encoding.UTF8.GetString(actual.Body.Array);
            MessageData1 content = jsonProcessor.FromJson <MessageData1>(body);

            content.Should().BeEquivalentTo(data);
        }
 public BlobSnapshotReader(CloudBlobContainer container,
                           IJsonProcessor jsonProcessor)
 {
     _container     = container;
     _jsonProcessor = jsonProcessor;
 }
Exemplo n.º 15
0
 public JsonRpc(IJsonProcessor processor)
 {
     _processor = processor;
 }
Exemplo n.º 16
0
 public EventConverter(
     IJsonProcessor jsonProcessor, TypeResolver typeResolver)
 {
     _jsonProcessor = jsonProcessor;
     _typeResolver  = typeResolver;
 }
Exemplo n.º 17
0
 public JsonRpc(IJsonProcessor processor)
 {
     _processor = processor;
 }
Exemplo n.º 18
0
 private object DeserializePayload(IJsonProcessor jsonProcessor, Type type)
 => jsonProcessor.FromJson(json: Payload, dataType: type);
Exemplo n.º 19
0
        /// <summary>
        /// Constructor
        /// </summary>
        public DeserializeFromPathTest()
        {
            var fileProcessor = new WSV2.Common.IO.FileProcessor();

            _jsonProcessor = new WSV2.Common.IO.JsonProcessor(fileProcessor);
        }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="inputObjectProcessor">Instance of IInputObjectProcessor</param>
 /// <param name="jsonProcessor">Instance of IJsonProcessor</param>
 public CloneProcessor(IInputObjectProcessor inputObjectProcessor, IJsonProcessor jsonProcessor)
 {
     _inputObjectProcessor = inputObjectProcessor;
     _jsonProcessor        = jsonProcessor;
 }
Exemplo n.º 21
0
        /// <summary>
        /// Constructor
        /// </summary>
        public SerialzeWithIndentTest()
        {
            var fileProcessor = new WSV2.Common.IO.FileProcessor();

            _jsonProcessor = new WSV2.Common.IO.JsonProcessor(fileProcessor);
        }