Пример #1
0
        private void SaveConfiguration(Action continueWith)
        {
            Log.Debug("Saving Configuration.");
            var data = _config.GetSerializedForm();
            var ev   = new Event(Guid.NewGuid(), "PersistentConfig1", true, data, new byte[0]);

            _ioDispatcher.WriteEvent(SystemStreams.PersistentSubscriptionConfig, ExpectedVersion.Any, ev, SystemAccount.Principal, x => HandleSaveConfigurationCompleted(continueWith, x));
        }
        private void SaveConfiguration(Action continueWith)
        {
            Log.Debug("Saving persistent subscription configuration");
            var data     = _config.GetSerializedForm();
            var ev       = new Event(Guid.NewGuid(), "PersistentConfig1", true, data, new byte[0]);
            var metadata = new StreamMetadata(maxCount: 2);
            Lazy <StreamMetadata> streamMetadata = new Lazy <StreamMetadata>(() => metadata);

            Event[] events = new Event[] { ev };
            _ioDispatcher.ConfigureStreamAndWriteEvents(SystemStreams.PersistentSubscriptionConfig,
                                                        ExpectedVersion.Any, streamMetadata, events, SystemAccount.Principal,
                                                        x => HandleSaveConfigurationCompleted(continueWith, x));
        }
 public void output_can_be_read_as_input_and_keep_same_values()
 {
     var config = new PersistentSubscriptionConfig();
     config.Updated = new DateTime(2014,08, 14);
     config.UpdatedBy = "Greg";
     config.Version = "1";
     config.Entries = new List<PersistentSubscriptionEntry>();
     config.Entries.Add(new PersistentSubscriptionEntry(){Group="foo", ResolveLinkTos = true, Stream = "Stream"});
     var data = config.GetSerializedForm();
     var config2 = PersistentSubscriptionConfig.FromSerializedForm(data);
     Assert.AreEqual(1, config2.Entries.Count);
     Assert.AreEqual(config.Updated, config2.Updated);
     Assert.AreEqual(config.UpdatedBy, config2.UpdatedBy);
 }