Converts an IEvent from/to a flattened structure suitable for storing in an IEventStore.
Inheritance: IPropertyBagConverter
Esempio n. 1
0
        private static IEventStore InitializeEventStore()
        {
            var propertyBagConverter = new PropertyBagConverter();

            // Register type converter.
            propertyBagConverter.TypeResolver = new AppV2EventsTypeResolver();

            var eventStore = new MsSqlServerEventStore("Data Source=.\\sqlexpress; Initial Catalog=VersioningEventStore; Integrated Security=SSPI;", propertyBagConverter);
            return eventStore;
        }
Esempio n. 2
0
        private static IEventStore InitializeEventStore()
        {
            var converter = new PropertyBagConverter();
            converter.TypeResolver = new AppV2EventsTypeResolver();

            converter.AddPostConversion(typeof(NameChangedEvent), new NameChangedEventPostConverter());
            converter.AddPostConversion(typeof(PersonCreatedEvent), new PersonCreatedEventPostConverter());

            var eventStore = new MsSqlServerEventStore("Data Source=.\\sqlexpress; Initial Catalog=VersioningEventStore; Integrated Security=SSPI;", converter);
            return eventStore;
        }
Esempio n. 3
0
        public void Restoration_of_an_event_from_a_property_bag_containing_nulls_should_not_fail()
        {
            try
            {
                var converter = new PropertyBagConverter { TypeResolver = new SimpleEventTypeResolver() };

                var bag = new PropertyBag(typeof(TestEvent).AssemblyQualifiedName);
                bag.AddPropertyValue("SomeString", null);

                var obj = converter.Convert(bag);

                obj.Should().NotBeNull();
                obj.Should().BeOfType<TestEvent>();

                ((TestEvent) obj).SomeString.Should().BeNull();
            }
            catch(Exception e)
            {
                Assert.Fail(e.ToString());
            }
        }