本文整理汇总了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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
}
示例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;
}
}