当前位置: 首页>>代码示例>>C#>>正文


C# IEventStoreConnection.AppendToStreamAsync方法代码示例

本文整理汇总了C#中IEventStoreConnection.AppendToStreamAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IEventStoreConnection.AppendToStreamAsync方法的具体用法?C# IEventStoreConnection.AppendToStreamAsync怎么用?C# IEventStoreConnection.AppendToStreamAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEventStoreConnection的用法示例。


在下文中一共展示了IEventStoreConnection.AppendToStreamAsync方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendToStream

        private static void AppendToStream(IEventStoreConnection connection)
        {
            byte[] data = Encoding.UTF8.GetBytes("event data");
            byte[] metadata = Encoding.UTF8.GetBytes("event metadata");
            EventData eventData = new EventData(Guid.NewGuid(), "testEvent", false, data, metadata);

            connection.AppendToStreamAsync("test-stream", ExpectedVersion.Any, eventData).Wait();
        }
开发者ID:ppastecki,项目名称:EventStoreTutorial,代码行数:8,代码来源:Program.cs

示例2: Connect

 private void Connect()
 {
     var settings = ConnectionSettings.Create();
     var ip = new IPEndPoint(_ipAddress, _port);
     Log("Connecting to {0}:{1}...", _ipAddress, _port);
     _connection = EventStoreConnection.Create(settings, ip);
     _connection.ConnectAsync();
     _connection.AppendToStreamAsync("hello", ExpectedVersion.Any, new EventData(Guid.NewGuid(), "Hello", false, new byte[0], new byte[0]));
     Log("Connected.");
     Log("Username to be used is: {0}", _userName);
     _credentials = new UserCredentials(_userName, _password);
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:12,代码来源:UpgradeProjectionsWorker.cs

示例3: SetUp

        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.ConnectAsync().Wait();

            _connection.SetStreamMetadataAsync(Stream, ExpectedVersion.EmptyStream, StreamMetadata.Build().SetMaxCount(3)).Wait();

            _testEvents = Enumerable.Range(0, 5).Select(x => TestEvent.NewTestEvent(data: x.ToString())).ToArray();
            _connection.AppendToStreamAsync(Stream, ExpectedVersion.EmptyStream, _testEvents).Wait();
        }
开发者ID:czcz1024,项目名称:EventStore,代码行数:14,代码来源:when_having_max_count_set_for_stream.cs

示例4: Given

 protected override void Given()
 {
     _serverEndPoint = new IPEndPoint(IPAddress.Loopback, PortsHelper.GetAvailablePort(IPAddress.Loopback));
     _url = _HttpEndPoint.ToHttpUrl("/stats/tcp");
     
     var settings = ConnectionSettings.Create();
     _connection = EventStoreConnection.Create(settings, _node.TcpEndPoint);
     _connection.ConnectAsync().Wait();
     
     var testEvent = new EventData(Guid.NewGuid(),"TestEvent",true,Encoding.ASCII.GetBytes("{'Test' : 'OneTwoThree'}"),null);
     _connection.AppendToStreamAsync("tests",ExpectedVersion.Any,testEvent).Wait();
     
     _portableServer = new PortableServer(_serverEndPoint);
     _portableServer.SetUp();
 }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:15,代码来源:when_getting_tcp_stats_from_stat_controller.cs

示例5: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();
            _node = new MiniNode(PathName, inMemDb: true);
            _node.Start();

            _conn = BuildConnection(_node);
            _conn.ConnectAsync().Wait();
            //Create 80000 events
            for(var i = 0; i < 80; i++)
            {
                _conn.AppendToStreamAsync(_streamName, ExpectedVersion.Any, CreateThousandEvents()).Wait();
            }

            _settings = new CatchUpSubscriptionSettings(100, 1, false, true);
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:16,代码来源:catchup_subscription_handles_small_batch_sizes.cs

示例6: SetUp

        public override void SetUp()
        {
            base.SetUp();
            _node = new MiniNode(PathName);
            _node.Start();

            _firstEvent = TestEvent.NewTestEvent();

            _connection = TestConnection.Create(_node.TcpEndPoint);
            _connection.ConnectAsync().Wait();

            Assert.AreEqual(2, _connection.AppendToStreamAsync("test-stream",
                                                          ExpectedVersion.NoStream,
                                                          _firstEvent,
                                                          TestEvent.NewTestEvent(),
                                                          TestEvent.NewTestEvent()).Result.NextExpectedVersion);

            using (var transaction = _connection.StartTransactionAsync("test-stream", 2).Result)
            {
                Assert.AreEqual(2, transaction.Commit().NextExpectedVersion);
            }
        }
开发者ID:MariuszTrybus,项目名称:EventStore,代码行数:22,代码来源:when_committing_empty_transaction.cs

示例7: WriteEvents

 private void WriteEvents(IEventStoreConnection connection)
 {
     for (int i = 0; i < 10; i++)
     {
         var id = Guid.NewGuid();
         connection.AppendToStreamAsync(_stream, ExpectedVersion.Any, DefaultData.AdminCredentials,
             new EventData(id, "test", true, Encoding.UTF8.GetBytes("{'foo' : 'bar'}"), new byte[0])).Wait();
         if (i == 4) _id = id;
     }
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:10,代码来源:connecting_to_a_persistent_subscription.cs


注:本文中的IEventStoreConnection.AppendToStreamAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。