├── .gitignore
├── EventStore.ClientAPI.NetCore.sln
├── LICENSE.md
├── README.md
├── appveyor.yml
├── build.sh
├── run_suppressed_tests.sh
├── scripts
├── appveyortest.ps1
├── installandruneventstore.ps1
└── updateversion.ps1
├── src
└── EventStore.ClientAPI.NetCore
│ ├── AllCheckpoint.cs
│ ├── AllEventsSlice.cs
│ ├── CatchUpSubscriptionSettings.cs
│ ├── ClientApiConstants.cs
│ ├── ClientAuthenticationFailedEventArgs.cs
│ ├── ClientClosedEventArgs.cs
│ ├── ClientConnectionEventArgs.cs
│ ├── ClientErrorEventArgs.cs
│ ├── ClientOperations
│ ├── AppendToStreamOperation.cs
│ ├── CommitTransactionOperation.cs
│ ├── ConditionalAppendToStreamOperation.cs
│ ├── ConnectToPersistentSubscriptionOperation.cs
│ ├── CreatePersistentSubscriptionOperation.cs
│ ├── DeletePersistentSubscriptionOperation.cs
│ ├── DeleteStreamOperation.cs
│ ├── IClientOperation.cs
│ ├── ISubscriptionOperation.cs
│ ├── OperationBase.cs
│ ├── ReadAllEventsBackwardOperation.cs
│ ├── ReadAllEventsForwardOperation.cs
│ ├── ReadEventOperation.cs
│ ├── ReadStreamEventsBackwardOperation.cs
│ ├── ReadStreamEventsForwardOperation.cs
│ ├── StartTransactionOperation.cs
│ ├── SubscriptionOperation.cs
│ ├── TransactionalWriteOperation.cs
│ ├── UpdatePersistentSubscriptionOperation.cs
│ └── VolatileSubscriptionOperation.cs
│ ├── ClientReconnectingEventArgs.cs
│ ├── ClusterSettings.cs
│ ├── ClusterSettingsBuilder.cs
│ ├── Common
│ ├── Log
│ │ ├── ConsoleLogger.cs
│ │ ├── DebugLogger.cs
│ │ ├── FileLogger.cs
│ │ ├── LogManager.cs
│ │ └── NoopLogger.cs
│ ├── SystemNames.cs
│ └── Utils
│ │ ├── Ensure.cs
│ │ ├── Helper.cs
│ │ ├── Json.cs
│ │ └── Threading
│ │ ├── ManualResetEventSlimExtensions.cs
│ │ └── TaskExtensions.cs
│ ├── ConditionalWriteFailureReason.cs
│ ├── ConditionalWriteResult.cs
│ ├── ConnectionSettings.cs
│ ├── ConnectionSettingsBuilder.cs
│ ├── ConnectionString.cs
│ ├── DeleteResult.cs
│ ├── DnsClusterSettingsBuilder.cs
│ ├── EventData.cs
│ ├── EventReadResult.cs
│ ├── EventReadStatus.cs
│ ├── EventStore.ClientAPI.NetCore.csproj
│ ├── EventStoreCatchUpSubscription.cs
│ ├── EventStoreConnection.cs
│ ├── EventStorePersistentSubscription.cs
│ ├── EventStorePersistentSubscriptionBase.cs
│ ├── EventStoreSubscription.cs
│ ├── EventStoreTransaction.cs
│ ├── Exceptions
│ ├── AccessDeniedException.cs
│ ├── CannotEstablishConnectionException.cs
│ ├── ClusterException.cs
│ ├── CommandNotExpectedException.cs
│ ├── ConnectionClosedException.cs
│ ├── EventStoreConnectionException.cs
│ ├── InvalidTransactionException.cs
│ ├── NoResultException.cs
│ ├── NotAuthenticatedException.cs
│ ├── OperationExpiredException.cs
│ ├── OperationTimedOutException.cs
│ ├── ProjectionCommandConflictException.cs
│ ├── ProjectionCommandFailedException.cs
│ ├── RetriesLimitReachedException.cs
│ ├── ServerErrorException.cs
│ ├── StreamDeletedException.cs
│ ├── UserCommandConflictException.cs
│ ├── UserCommandFailedException.cs
│ └── WrongExpectedVersionException.cs
│ ├── ExpectedVersion.cs
│ ├── GossipSeed.cs
│ ├── GossipSeedClusterSettingsBuilder.cs
│ ├── IConnectToPersistentSubscriptions.cs
│ ├── IEndPointDiscoverer.cs
│ ├── IEventStoreConnection.cs
│ ├── IEventStoreConnectionExtensions.cs
│ ├── ILogger.cs
│ ├── Internal
│ ├── ClusterDnsEndPointDiscoverer.cs
│ ├── Consts.cs
│ ├── Empty.cs
│ ├── EventStoreConnectionLogicHandler.cs
│ ├── EventStoreNodeConnection.cs
│ ├── IEventStoreConnectionLogicHandler.cs
│ ├── IEventStoreTransactionConnection.cs
│ ├── IPEndPointExtensions.cs
│ ├── Messages.cs
│ ├── OperationsManager.cs
│ ├── PersistentSubscriptionCreateResult.cs
│ ├── PersistentSubscriptionCreateStatus.cs
│ ├── PersistentSubscriptionDeleteResult.cs
│ ├── PersistentSubscriptionDeleteStatus.cs
│ ├── PersistentSubscriptionUpdateResult.cs
│ ├── PersistentSubscriptionUpdateStatus.cs
│ ├── SimpleQueuedHandler.cs
│ ├── SingleEndpointDiscoverer.cs
│ ├── StaticEndPointDiscoverer.cs
│ ├── SubscriptionsManager.cs
│ └── VolatileEventStoreSubscription.cs
│ ├── Messages
│ ├── ClientMessage.cs
│ ├── ClientMessagesExtensions.cs
│ └── ClusterMessages.cs
│ ├── NodeEndPoints.cs
│ ├── NodePreference.cs
│ ├── PersistentEventStoreSubscription.cs
│ ├── PersistentSubscriptionNakEventAction.cs
│ ├── PersistentSubscriptionSettings.cs
│ ├── PersistentSubscriptionSettingsBuilder.cs
│ ├── Position.cs
│ ├── Projections
│ ├── ProjectionDetails.cs
│ ├── ProjectionsClient.cs
│ ├── ProjectionsManager.cs
│ └── QueryManager.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── RawStreamMetadataResult.cs
│ ├── ReadDirection.cs
│ ├── RecordedEvent.cs
│ ├── ResolvedEvent.cs
│ ├── SliceReadStatus.cs
│ ├── StreamAcl.cs
│ ├── StreamCheckpoint.cs
│ ├── StreamEventsSlice.cs
│ ├── StreamMetadata.cs
│ ├── StreamMetadataBuilder.cs
│ ├── StreamMetadataResult.cs
│ ├── StreamPosition.cs
│ ├── SubscriptionDropReason.cs
│ ├── SystemData
│ ├── InspectionDecision.cs
│ ├── InspectionResult.cs
│ ├── StatusCode.cs
│ ├── TcpCommand.cs
│ ├── TcpPackage.cs
│ └── UserCredentials.cs
│ ├── SystemSettings.cs
│ ├── Transport.Http
│ ├── ClientOperationState.cs
│ ├── ContentType.cs
│ ├── EndpointExtensions.cs
│ ├── HttpAsyncClient.cs
│ ├── HttpMethod.cs
│ ├── HttpResponse.cs
│ └── HttpStatusCode.cs
│ ├── Transport.Tcp
│ ├── IMonitoredTcpConnection.cs
│ ├── ITcpConnection.cs
│ ├── LengthPrefixFramer.cs
│ ├── PackageFramingException.cs
│ ├── ProtobufExtensions.cs
│ ├── SocketArgsPool.cs
│ ├── TcpClientConnector.cs
│ ├── TcpConfiguratin.cs
│ ├── TcpConnection.cs
│ ├── TcpConnectionBase.cs
│ ├── TcpConnectionLockless.cs
│ ├── TcpConnectionMonitor.cs
│ ├── TcpConnectionSsl.cs
│ ├── TcpPackageConnection.cs
│ └── TcpStats.cs
│ ├── UserManagement
│ ├── ChangePasswordDetails.cs
│ ├── RelLink.cs
│ ├── ResetPasswordDetails.cs
│ ├── UserCreationInformation.cs
│ ├── UserDetails.cs
│ ├── UserUpdateInformation.cs
│ ├── UsersClient.cs
│ └── UsersManager.cs
│ └── WriteResult.cs
├── test
└── EventStore.ClientAPI.NetCore.Tests
│ ├── DefaultData.cs
│ ├── EventNumber.cs
│ ├── EventStore.ClientAPI.NetCore.Tests.csproj
│ ├── FakeEventStoreConnection.cs
│ ├── Helpers
│ ├── EventDataComparer.cs
│ ├── EventsStream.cs
│ ├── OngoingTransaction.cs
│ ├── StreamWriter.cs
│ ├── SystemStreams.cs
│ ├── TailWriter.cs
│ ├── TcpType.cs
│ ├── TestConnection.cs
│ ├── TestEvent.cs
│ ├── TestNode.cs
│ └── TransactionalWriter.cs
│ ├── ProjectionSpecification.cs
│ ├── Security
│ ├── AuthenticationTestBase.cs
│ ├── all_stream_with_no_acl_security.cs
│ ├── authorized_default_credentials_security.cs
│ ├── delete_stream_security.cs
│ ├── multiple_role_security.cs
│ ├── overriden_system_stream_security.cs
│ ├── overriden_system_stream_security_for_all.cs
│ ├── overriden_user_stream_security.cs
│ ├── read_all_security.cs
│ ├── read_stream_meta_security.cs
│ ├── read_stream_security.cs
│ ├── stream_security_inheritance.cs
│ ├── subscribe_to_all_security.cs
│ ├── subscribe_to_stream_security.cs
│ ├── system_stream_security.cs
│ ├── transactional_write_stream_security.cs
│ ├── write_stream_meta_security.cs
│ └── write_stream_security.cs
│ ├── SpecificationWithConnection.cs
│ ├── SpecificationWithLinkToToDeletedEvents.cs
│ ├── SpecificationWithLinkToToMaxCountDeletedEvents.cs
│ ├── SystemData
│ └── clientapi_tcp_package.cs
│ ├── SystemRoles.cs
│ ├── SystemUsers.cs
│ ├── UserManagement
│ ├── TestWithNode.cs
│ ├── TestWithUser.cs
│ ├── change_password.cs
│ ├── creating_a_user.cs
│ ├── deleting_a_user.cs
│ ├── enable_disable_user.cs
│ ├── get_current_user.cs
│ ├── list_users.cs
│ ├── reset_password.cs
│ └── updating_a_user.cs
│ ├── a_nak_in_subscription_handler_in_autoack_mode_drops_the_subscription.cs
│ ├── append_to_stream.cs
│ ├── appending_to_implicitly_created_stream.cs
│ ├── appending_to_implicitly_created_stream_using_transaction.cs
│ ├── can_create_duplicate_persistent_subscription_group_name_on_different_streams.cs
│ ├── catch_up_subscription_handles_errors.cs
│ ├── catchup_subscription_handles_small_batch_sizes.cs
│ ├── connect.cs
│ ├── connect_to_existing_persistent_subscription_with_max_one_client.cs
│ ├── connect_to_existing_persistent_subscription_with_max_one_client_async.cs
│ ├── connect_to_existing_persistent_subscription_with_permissions.cs
│ ├── connect_to_existing_persistent_subscription_with_permissions_async.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_and_events_in_it.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_and_events_in_it_async.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_and_no_stream.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_and_no_stream_async.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_not_set_and_events_in_it.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_not_set_and_events_in_it_async.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_beginning_not_set_and_events_in_it_then_event_written.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_two_and_no_stream.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_two_and_no_stream_async.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_x_set_and_events_in_it.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_x_set_and_events_in_it_then_event_written.cs
│ ├── connect_to_existing_persistent_subscription_with_start_from_x_set_higher_than_x_and_events_in_it_then_event_written.cs
│ ├── connect_to_existing_persistent_subscription_without_permissions.cs
│ ├── connect_to_existing_persistent_subscription_without_permissions_async.cs
│ ├── connect_to_non_existing_persistent_subscription_with_permissions.cs
│ ├── connect_to_non_existing_persistent_subscription_with_permissions_async.cs
│ ├── connect_to_persistent_subscription_with_retries.cs
│ ├── connection_string.cs
│ ├── create_duplicate_persistent_subscription_group.cs
│ ├── create_persistent_subscription_after_deleting_the_same.cs
│ ├── create_persistent_subscription_group_without_permissions.cs
│ ├── create_persistent_subscription_on_all_stream.cs
│ ├── create_persistent_subscription_on_existing_stream.cs
│ ├── create_persistent_subscription_on_non_existing_stream.cs
│ ├── create_persistent_subscription_with_dont_timeout.cs
│ ├── create_persistent_subscription_with_too_big_checkpoint_after.cs
│ ├── create_persistent_subscription_with_too_big_message_timeout.cs
│ ├── create_persistent_subscription_with_too_big_retry_after.cs
│ ├── deleting_existing_persistent_subscription_group_with_permissions.cs
│ ├── deleting_existing_persistent_subscription_with_subscriber.cs
│ ├── deleting_persistent_subscription_group_that_doesnt_exist.cs
│ ├── deleting_persistent_subscription_group_without_permissions.cs
│ ├── deleting_stream.cs
│ ├── event_store_connection_should.cs
│ ├── happy_case_catching_up_to_link_to_events_auto_ack.cs
│ ├── happy_case_catching_up_to_link_to_events_manual_ack.cs
│ ├── happy_case_catching_up_to_normal_events_auto_ack.cs
│ ├── happy_case_catching_up_to_normal_events_manual_ack.cs
│ ├── happy_case_writing_and_subscribing_to_normal_events_auto_ack.cs
│ ├── happy_case_writing_and_subscribing_to_normal_events_manual_ack.cs
│ ├── not_connected_tests.cs
│ ├── read_all_events_backward_should.cs
│ ├── read_all_events_forward_should.cs
│ ├── read_all_events_forward_with_hard_deleted_stream_should.cs
│ ├── read_all_events_forward_with_linkto_passed_max_count.cs
│ ├── read_all_events_forward_with_linkto_to_deleted_event.cs
│ ├── read_all_events_forward_with_soft_deleted_stream_should.cs
│ ├── read_allevents_backward_with_linkto_deleted_event.cs
│ ├── read_event_of_linkto_to_deleted_event.cs
│ ├── read_event_should.cs
│ ├── read_event_stream_backward_should.cs
│ ├── read_event_stream_forward_should.cs
│ ├── read_stream_events_with_unresolved_linkto.cs
│ ├── soft_delete.cs
│ ├── ssl_append_to_stream.cs
│ ├── subscribe_should.cs
│ ├── subscribe_to_all_catching_up_should.cs
│ ├── subscribe_to_all_should.cs
│ ├── subscribe_to_stream_catching_up_should.cs
│ ├── transaction.cs
│ ├── update_existing_persistent_subscription.cs
│ ├── update_existing_persistent_subscription_with_subscribers.cs
│ ├── update_existing_persistent_subscription_without_permissions.cs
│ ├── update_non_existing_persistent_subscription.cs
│ ├── when_a_projection_is_running.cs
│ ├── when_committing_empty_transaction.cs
│ ├── when_connecting_with_connection_string.cs
│ ├── when_creating_continuous_projection.cs
│ ├── when_creating_continuous_projection_with_track_emitted_streams.cs
│ ├── when_creating_one_time_projection.cs
│ ├── when_creating_transient_projection.cs
│ ├── when_disabling_projections.cs
│ ├── when_enabling_projections.cs
│ ├── when_having_max_count_set_for_stream.cs
│ ├── when_having_truncatebefore_set_for_stream.cs
│ ├── when_listing_all_projections.cs
│ ├── when_listing_continuous_projections.cs
│ ├── when_listing_one_time_projections.cs
│ ├── when_updating_a_projection_query.cs
│ ├── when_working_with_metadata.cs
│ ├── when_working_with_stream_metadata_as_byte_array.cs
│ ├── when_working_with_stream_metadata_as_structured_info.cs
│ └── when_writing_and_subscribing_to_normal_events_manual_nack.cs
└── wercker.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
3 | .vscode
4 | .vs
5 | backup
6 | .idea
7 | project.lock.json
8 | *.xproj.user
9 | TestResult.xml
10 | *.nuget.props
11 | *.out
12 | *.ncrunchsolution.user
13 | artifacts/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Deprecated
2 |
3 | # EventStore .NET Core Client
4 |
5 | This repository contained an Event Store .NET client for .NET Core, targetting netstandard-2.0.
6 |
7 | As of version 5.0.0, the official client maintained as part of [github.com/EventStore/EventStore](github.com/EventStore/EventStore) now targets all supported .NET platforms:
8 |
9 | - netstandard2.0
10 | - net452
11 | - net46
12 |
13 | This code and repository is not maintained.
14 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 4.1.0.{build}
2 |
3 | image: Visual Studio 2017
4 |
5 | install:
6 | - ps: .\scripts\updateversion.ps1
7 | - ps: .\scripts\installandruneventstore.ps1
8 |
9 | dotnet_csproj:
10 | patch: true
11 | file: '**\*.csproj'
12 | version: '{version}'
13 | package_version: '{version}'
14 |
15 | configuration: Release
16 |
17 | before_build:
18 | - msbuild /t:restore EventStore.ClientAPI.NetCore.sln
19 |
20 | build:
21 | project: EventStore.ClientAPI.NetCore.sln
22 | publish_nuget: true
23 | verbosity: minimal
24 |
25 | deploy:
26 | provider: NuGet
27 | on:
28 | appveyor_repo_tag: true
29 | api_key:
30 | secure: zd6D5E28IF7m/HSA9k1GUDSzOiWhnrvQUBATrbEqA2MJVh1rDDl+4LDuv+dvioWp
31 | artifact: /.*\.nupkg/
32 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | dotnet restore src/EventStore.ClientAPI.NetCore/EventStore.ClientAPI.NetCore.csproj
4 | dotnet restore test/EventStore.ClientAPI.NetCore.Tests/EventStore.ClientAPI.NetCore.Tests.csproj
5 | dotnet build src/EventStore.ClientAPI.NetCore/EventStore.ClientAPI.NetCore.csproj
6 | dotnet build test/EventStore.ClientAPI.NetCore.Tests/EventStore.ClientAPI.NetCore.Tests.csproj
7 | dotnet pack src/EventStore.ClientAPI.NetCore/EventStore.ClientAPI.NetCore.csproj
--------------------------------------------------------------------------------
/run_suppressed_tests.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # Abort on Error
3 | set -e
4 |
5 | export PING_SLEEP=30s
6 | export WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 | export BUILD_OUTPUT=$WORKDIR/build.out
8 |
9 | touch $BUILD_OUTPUT
10 |
11 | dump_output() {
12 | echo Tailing the last 500 lines of output:
13 | tail -500 $BUILD_OUTPUT
14 | }
15 | error_handler() {
16 | echo ERROR: An error was encountered with the build.
17 | dump_output
18 | exit 1
19 | }
20 | # If an error occurs, run our error handler to output a tail of the build
21 | trap 'error_handler' ERR
22 |
23 | # Set up a repeating loop to send some output to Travis.
24 |
25 | bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" &
26 | PING_LOOP_PID=$!
27 |
28 | dotnet test test/EventStore.ClientAPI.NetCore.Tests/EventStore.ClientAPI.NetCore.Tests.csproj >> $BUILD_OUTPUT 2>&1
29 |
30 | # The build finished without returning an error so dump a tail of the output
31 | dump_output
32 |
33 | # nicely terminate the ping output loop
34 | kill $PING_LOOP_PID
35 |
--------------------------------------------------------------------------------
/scripts/appveyortest.ps1:
--------------------------------------------------------------------------------
1 | $testResults = Join-Path $env:APPVEYOR_BUILD_FOLDER testResults.xml
2 | dotnet test test\EventStore.ClientAPI.NetCore.Tests\EventStore.ClientAPI.NetCore.Tests.csproj --no-build --logger="trx;LogFileName=$testResults"
3 | $wc = New-Object System.Net.WebClient
4 | $wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$env:APPVEYOR_JOB_ID", $testResults)
--------------------------------------------------------------------------------
/scripts/installandruneventstore.ps1:
--------------------------------------------------------------------------------
1 | (New-Object Net.WebClient).DownloadFile('https://eventstore.org/downloads/EventStore-OSS-Win-v4.1.0.zip','c:\tools\eventstore.zip')
2 | 7z e C:\tools\eventstore.zip -oC:\tools\EventStore
3 | start-process -NoNewWindow "C:\tools\EventStore\EventStore.ClusterNode.exe" "--memdb --run-projections ALL"
--------------------------------------------------------------------------------
/scripts/updateversion.ps1:
--------------------------------------------------------------------------------
1 |
2 | if($env:APPVEYOR_REPO_TAG -eq 'True'){
3 | Update-AppveyorBuild -version $env:APPVEYOR_REPO_BRANCH
4 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/AllCheckpoint.cs:
--------------------------------------------------------------------------------
1 | namespace EventStore.ClientAPI
2 | {
3 | ///
4 | /// This class contains constants to be used when setting up subscriptions
5 | /// using the IEventStoreConnection.SubscribeToAllFrom method on
6 | /// .
7 | ///
8 | public static class AllCheckpoint
9 | {
10 | ///
11 | /// Indicates that a catch-up subscription should receive all events
12 | /// in the database.
13 | ///
14 | public static Position? AllStart = null;
15 | }
16 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/AllEventsSlice.cs:
--------------------------------------------------------------------------------
1 | using EventStore.ClientAPI.Internal;
2 | using EventStore.ClientAPI.Messages;
3 |
4 | namespace EventStore.ClientAPI
5 | {
6 | ///
7 | /// The result of a read operation from the $all stream.
8 | ///
9 | public class AllEventsSlice
10 | {
11 | ///
12 | /// The direction of read request.
13 | ///
14 | public readonly ReadDirection ReadDirection;
15 |
16 | ///
17 | /// A representing the position where this slice was read from.
18 | ///
19 | public readonly Position FromPosition;
20 |
21 | ///
22 | /// A representing the position where the next slice should be read from.
23 | ///
24 | public readonly Position NextPosition;
25 |
26 | ///
27 | /// The events read.
28 | ///
29 | public readonly ResolvedEvent[] Events;
30 |
31 | ///
32 | /// A boolean representing whether or not this is the end of the $all stream.
33 | ///
34 | public bool IsEndOfStream { get { return Events.Length == 0; } }
35 |
36 | internal AllEventsSlice(ReadDirection readDirection, Position fromPosition, Position nextPosition, ClientMessage.ResolvedEvent[] events)
37 | {
38 | ReadDirection = readDirection;
39 | FromPosition = fromPosition;
40 | NextPosition = nextPosition;
41 | if (events == null)
42 | Events = Empty.ResolvedEvents;
43 | else
44 | {
45 | Events = new ResolvedEvent[events.Length];
46 | for (int i = 0; i < Events.Length; ++i)
47 | {
48 | Events[i] = new ResolvedEvent(events[i]);
49 | }
50 | }
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientApiConstants.cs:
--------------------------------------------------------------------------------
1 | namespace EventStore.ClientAPI
2 | {
3 | ///
4 | /// Various constant values that may be useful when working with the ClientAPI.
5 | ///
6 | public static class ClientApiConstants
7 | {
8 | ///
9 | /// The maximum number of events that can be read in a single operation.
10 | ///
11 | public static readonly int MaxReadSize = Consts.MaxReadSize;
12 | }
13 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientAuthenticationFailedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI
4 | {
5 | ///
6 | /// Event Arguments for the event raised when an fails
7 | /// to authenticate against an Event Store server.
8 | ///
9 | public class ClientAuthenticationFailedEventArgs : EventArgs
10 | {
11 | ///
12 | /// A reason for authentication failure, if known.
13 | ///
14 | public string Reason { get; private set; }
15 |
16 | ///
17 | /// The responsible for raising the event.
18 | ///
19 | public IEventStoreConnection Connection { get; private set; }
20 |
21 | ///
22 | /// Constructs a new instance of .
23 | ///
24 | /// The responsible for raising the event.
25 | /// A reason for authentication failure, if known.
26 | public ClientAuthenticationFailedEventArgs(IEventStoreConnection connection, string reason)
27 | {
28 | Connection = connection;
29 | Reason = reason;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientClosedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI
4 | {
5 | ///
6 | /// Event Arguments for the event raised when an is
7 | /// disconnected from an Event Store server.
8 | ///
9 | public class ClientClosedEventArgs : EventArgs
10 | {
11 | ///
12 | /// A description of the reason the connection was closed if closing was initiated by the server or client API directly
13 | /// rather than by calling .
14 | ///
15 | public string Reason { get; private set; }
16 |
17 | ///
18 | /// The responsible for raising the event.
19 | ///
20 | public IEventStoreConnection Connection { get; private set; }
21 |
22 | ///
23 | /// Constructs a new instance of .
24 | ///
25 | /// The responsible for raising the event.
26 | /// A description of the reason the connection was closed.
27 | public ClientClosedEventArgs(IEventStoreConnection connection, string reason)
28 | {
29 | Connection = connection;
30 | Reason = reason;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientConnectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 |
4 | namespace EventStore.ClientAPI
5 | {
6 | ///
7 | /// Event Arguments for the event raised when an is
8 | /// connected to or disconnected from an Event Store server.
9 | ///
10 | public class ClientConnectionEventArgs : EventArgs
11 | {
12 | ///
13 | /// The endpoint of the Event Store server to or from which the connection was connected or disconnected.
14 | ///
15 | public IPEndPoint RemoteEndPoint { get; private set; }
16 |
17 | ///
18 | /// The responsible for raising the event.
19 | ///
20 | public IEventStoreConnection Connection { get; private set; }
21 |
22 | ///
23 | /// Constructs a new instance of .
24 | ///
25 | /// The responsible for raising the event.
26 | /// The endpoint of the Event Store server to or from which the connection was connected or disconnected.
27 | public ClientConnectionEventArgs(IEventStoreConnection connection, IPEndPoint remoteEndPoint)
28 | {
29 | Connection = connection;
30 | RemoteEndPoint = remoteEndPoint;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientErrorEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI
4 | {
5 | ///
6 | /// Event Arguments for the event raised when an error occurs on an .
7 | ///
8 | public class ClientErrorEventArgs : EventArgs
9 | {
10 | ///
11 | /// The thrown exception, if one was raised.
12 | ///
13 | public Exception Exception { get; private set; }
14 |
15 | ///
16 | /// The responsible for raising the event.
17 | ///
18 | public IEventStoreConnection Connection { get; private set; }
19 |
20 | ///
21 | /// Constructs a new instance of .
22 | ///
23 | /// The responsible for raising the event.
24 | /// The thrown exception, if one was raised.
25 | public ClientErrorEventArgs(IEventStoreConnection connection, Exception exception)
26 | {
27 | Connection = connection;
28 | Exception = exception;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientOperations/IClientOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using EventStore.ClientAPI.SystemData;
3 |
4 | namespace EventStore.ClientAPI.ClientOperations
5 | {
6 | internal interface IClientOperation
7 | {
8 | TcpPackage CreateNetworkPackage(Guid correlationId);
9 | InspectionResult InspectPackage(TcpPackage package);
10 | void Fail(Exception exception);
11 | }
12 |
13 | internal interface ISubscription: IClientOperation
14 | {
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientOperations/ISubscriptionOperation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using EventStore.ClientAPI.SystemData;
3 | using EventStore.ClientAPI.Transport.Tcp;
4 |
5 | namespace EventStore.ClientAPI.ClientOperations
6 | {
7 | internal interface ISubscriptionOperation
8 | {
9 | void DropSubscription(SubscriptionDropReason reason, Exception exc, TcpPackageConnection connection = null);
10 | void ConnectionClosed();
11 | InspectionResult InspectPackage(TcpPackage package);
12 | bool Subscribe(Guid correlationId, TcpPackageConnection connection);
13 | }
14 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClientReconnectingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI
4 | {
5 | ///
6 | /// Event Arguments for the event raised when an is
7 | /// about to reconnect to an Event Store server.
8 | ///
9 | public class ClientReconnectingEventArgs : EventArgs
10 | {
11 | ///
12 | /// The responsible for raising the event.
13 | ///
14 | public IEventStoreConnection Connection { get; private set; }
15 |
16 | ///
17 | /// Constructs a new instance of .
18 | ///
19 | /// The responsible for raising the event.
20 | public ClientReconnectingEventArgs(IEventStoreConnection connection)
21 | {
22 | Connection = connection;
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/ClusterSettingsBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace EventStore.ClientAPI
2 | {
3 | ///
4 | /// Builder used for creating instances of ClusterSettings.
5 | ///
6 | public class ClusterSettingsBuilder
7 | {
8 | ///
9 | /// Sets the client to discover nodes using a DNS name and a well-known port.
10 | ///
11 | /// A for further configuration.
12 | public DnsClusterSettingsBuilder DiscoverClusterViaDns()
13 | {
14 | return new DnsClusterSettingsBuilder();
15 | }
16 |
17 | ///
18 | /// Sets the client to discover cluster nodes by specifying the IP endpoints of
19 | /// one or more of the nodes.
20 | ///
21 | ///
22 | public GossipSeedClusterSettingsBuilder DiscoverClusterViaGossipSeeds()
23 | {
24 | return new GossipSeedClusterSettingsBuilder();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Log/DebugLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI.Common.Log
4 | {
5 | class DebugLogger : ILogger
6 | {
7 | public void Error(string format, params object[] args)
8 | {
9 | System.Diagnostics.Trace.WriteLine(Log("ERROR", format, args));
10 | }
11 |
12 | public void Error(Exception ex, string format, params object[] args)
13 | {
14 | System.Diagnostics.Trace.WriteLine(Log("ERROR", ex, format, args));
15 | }
16 |
17 | public void Debug(string format, params object[] args)
18 | {
19 | System.Diagnostics.Trace.WriteLine(Log("DEBUG", format, args));
20 | }
21 |
22 | public void Debug(Exception ex, string format, params object[] args)
23 | {
24 | System.Diagnostics.Trace.WriteLine(Log("DEBUG", ex, format, args));
25 | }
26 |
27 | public void Info(string format, params object[] args)
28 | {
29 | System.Diagnostics.Trace.WriteLine(Log("INFO", format, args));
30 | }
31 |
32 | public void Info(Exception ex, string format, params object[] args)
33 | {
34 | System.Diagnostics.Trace.WriteLine(Log("INFO", ex, format, args));
35 | }
36 |
37 |
38 | private string Log(string level, string format, params object[] args)
39 | {
40 | return string.Format("{0}: {1}", level, args.Length == 0 ? format : string.Format(format, args));
41 | }
42 |
43 | private string Log(string level, Exception exc, string format, params object[] args)
44 | {
45 | return string.Format("{0} EXCEPTION: {1}\nException: {2}", level, args.Length == 0 ? format : string.Format(format, args), exc);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Log/FileLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace EventStore.ClientAPI.Common.Log
5 | {
6 | ///
7 | /// Logger that writes to a file
8 | ///
9 | class FileLogger : ILogger, IDisposable
10 | {
11 | private readonly StreamWriter _streamWriter;
12 |
13 | public FileLogger(string filename)
14 | {
15 | _streamWriter = new StreamWriter(new FileStream(filename, FileMode.OpenOrCreate)) {AutoFlush = true};
16 | }
17 |
18 | public void Error(string format, params object[] args)
19 | {
20 | _streamWriter.WriteLine("Error: " + format, args);
21 | }
22 |
23 | public void Error(Exception ex, string format, params object[] args)
24 | {
25 | _streamWriter.WriteLine("Error: " + format, args);
26 | _streamWriter.WriteLine(ex);
27 | }
28 |
29 | public void Info(string format, params object[] args)
30 | {
31 | _streamWriter.WriteLine("Info : " + format, args);
32 | }
33 |
34 | public void Info(Exception ex, string format, params object[] args)
35 | {
36 | _streamWriter.WriteLine("Info : " + format, args);
37 | _streamWriter.WriteLine(ex);
38 | }
39 |
40 | public void Debug(string format, params object[] args)
41 | {
42 | _streamWriter.WriteLine("Debug: " + format, args);
43 | }
44 |
45 | public void Debug(Exception ex, string format, params object[] args)
46 | {
47 | _streamWriter.WriteLine("Debug: " + format, args);
48 | _streamWriter.WriteLine(ex);
49 |
50 | }
51 |
52 | void IDisposable.Dispose()
53 | {
54 | _streamWriter.Dispose();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Log/LogManager.cs:
--------------------------------------------------------------------------------
1 | namespace EventStore.ClientAPI.Common.Log
2 | {
3 | /* public static class LogManager
4 | {
5 | private static readonly ILogger Default = new DebugLogger();
6 |
7 | private static ILogger _defaultLogger;
8 | private static ILogger _userLogger;
9 |
10 | public static ILogger GetLogger()
11 | {
12 | return _userLogger ?? _defaultLogger ?? Default;
13 | }
14 |
15 | public static void SetDefaultLogger(ILogger logger)
16 | {
17 | _defaultLogger = logger;
18 | }
19 |
20 | public static void RegisterLogger(ILogger logger)
21 | {
22 | _userLogger = logger;
23 | }
24 | }*/
25 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Log/NoopLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI.Common.Log
4 | {
5 | class NoopLogger : ILogger
6 | {
7 | public void Error(string format, params object[] args)
8 | {
9 | }
10 |
11 | public void Error(Exception ex, string format, params object[] args)
12 | {
13 | }
14 |
15 | public void Debug(string format, params object[] args)
16 | {
17 | }
18 |
19 | public void Debug(Exception ex, string format, params object[] args)
20 | {
21 | }
22 |
23 | public void Info(string format, params object[] args)
24 | {
25 | }
26 |
27 | public void Info(Exception ex, string format, params object[] args)
28 | {
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Utils/Ensure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace EventStore.ClientAPI.Common.Utils
4 | {
5 | static class Ensure
6 | {
7 | public static void NotNull(T argument, string argumentName) where T : class
8 | {
9 | if (argument == null)
10 | throw new ArgumentNullException(argumentName);
11 | }
12 |
13 | public static void NotNullOrEmpty(string argument, string argumentName)
14 | {
15 | if (string.IsNullOrEmpty(argument))
16 | throw new ArgumentNullException(argument, argumentName);
17 | }
18 |
19 | public static void Positive(int number, string argumentName)
20 | {
21 | if (number <= 0)
22 | throw new ArgumentOutOfRangeException(argumentName, argumentName + " should be positive.");
23 | }
24 |
25 | public static void Positive(long number, string argumentName)
26 | {
27 | if (number <= 0)
28 | throw new ArgumentOutOfRangeException(argumentName, argumentName + " should be positive.");
29 | }
30 |
31 | public static void Nonnegative(long number, string argumentName)
32 | {
33 | if (number < 0)
34 | throw new ArgumentOutOfRangeException(argumentName, argumentName + " should be non-negative.");
35 | }
36 |
37 | public static void Nonnegative(int number, string argumentName)
38 | {
39 | if (number < 0)
40 | throw new ArgumentOutOfRangeException(argumentName, argumentName + " should be non-negative.");
41 | }
42 |
43 | public static void NotEmptyGuid(Guid guid, string argumentName)
44 | {
45 | if (Guid.Empty == guid)
46 | throw new ArgumentException(argumentName, argumentName + " should be non-empty GUID.");
47 | }
48 |
49 | public static void Equal(int expected, int actual)
50 | {
51 | if (expected != actual)
52 | throw new Exception(string.Format("expected {0} actual {1}", expected, actual));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/EventStore.ClientAPI.NetCore/Common/Utils/Threading/ManualResetEventSlimExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace EventStore.ClientAPI.Common.Utils.Threading
5 | {
6 | internal static class ManualResetEventSlimExtensions
7 | {
8 | public static Task AsTask(this ManualResetEventSlim resetEvent)
9 | {
10 | return AsTask(resetEvent, Timeout.Infinite);
11 | }
12 |
13 | public static Task AsTask(this ManualResetEventSlim resetEvent, int timeoutMs)
14 | {
15 | TaskCompletionSource