-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implicit usings on tests and file scoped namespaces
* added solution settings * major cleanup on tests
- Loading branch information
1 parent
fa00978
commit 33512f3
Showing
291 changed files
with
9,321 additions
and
9,223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<TargetFrameworks>net5.0;net6.0;net7.0</TargetFrameworks> | ||
<TargetFrameworks>net6.0;net7.0;net8.0;</TargetFrameworks> | ||
<Platform>x64</Platform> | ||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> | ||
<Nullable>enable</Nullable> | ||
<NullableContextOptions>enable</NullableContextOptions> | ||
<ImplicitUsings>true</ImplicitUsings> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<LangVersion>11</LangVersion> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<DebugType Condition=" '$(Configuration)' == 'Debug' ">full</DebugType> | ||
<DebugType Condition=" '$(Configuration)' == 'Release' ">pdbonly</DebugType> | ||
<!-- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>--> | ||
<!-- <DebugType Condition=" '$(Configuration)' == 'Debug' ">full</DebugType>--> | ||
<!-- <DebugType Condition=" '$(Configuration)' == 'Release' ">pdbonly</DebugType>--> | ||
<!-- <OutputPath>$(MSBuildThisFileDirectory)\bin\$(Configuration)\$(MSBuildProjectName)\</OutputPath>--> | ||
<RootNamespace>EventStore.Client</RootNamespace> | ||
|
||
<UseLinkBase>true</UseLinkBase> | ||
<GrpcPackageVersion>2.49.0</GrpcPackageVersion> | ||
<GrpcToolsPackageVersion>2.50.0</GrpcToolsPackageVersion> | ||
<GrpcPackageVersion>2.49.0</GrpcPackageVersion> | ||
<GrpcToolsPackageVersion>2.50.0</GrpcToolsPackageVersion> | ||
</PropertyGroup> | ||
</Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
namespace EventStore.Client { | ||
internal static class Constants { | ||
public static class Exceptions { | ||
public const string ExceptionKey = "exception"; | ||
|
||
public const string AccessDenied = "access-denied"; | ||
public const string InvalidTransaction = "invalid-transaction"; | ||
public const string StreamDeleted = "stream-deleted"; | ||
public const string WrongExpectedVersion = "wrong-expected-version"; | ||
public const string StreamNotFound = "stream-not-found"; | ||
public const string MaximumAppendSizeExceeded = "maximum-append-size-exceeded"; | ||
public const string MissingRequiredMetadataProperty = "missing-required-metadata-property"; | ||
public const string NotLeader = "not-leader"; | ||
|
||
public const string PersistentSubscriptionFailed = "persistent-subscription-failed"; | ||
public const string PersistentSubscriptionDoesNotExist = "persistent-subscription-does-not-exist"; | ||
public const string PersistentSubscriptionExists = "persistent-subscription-exists"; | ||
public const string MaximumSubscribersReached = "maximum-subscribers-reached"; | ||
public const string PersistentSubscriptionDropped = "persistent-subscription-dropped"; | ||
|
||
public const string UserNotFound = "user-not-found"; | ||
public const string UserConflict = "user-conflict"; | ||
|
||
public const string ScavengeNotFound = "scavenge-not-found"; | ||
|
||
public const string ExpectedVersion = "expected-version"; | ||
public const string ActualVersion = "actual-version"; | ||
public const string StreamName = "stream-name"; | ||
public const string GroupName = "group-name"; | ||
public const string Reason = "reason"; | ||
public const string MaximumAppendSize = "maximum-append-size"; | ||
public const string RequiredMetadataProperties = "required-metadata-properties"; | ||
public const string ScavengeId = "scavenge-id"; | ||
public const string LeaderEndpointHost = "leader-endpoint-host"; | ||
public const string LeaderEndpointPort = "leader-endpoint-port"; | ||
|
||
public const string LoginName = "login-name"; | ||
} | ||
|
||
public static class Metadata { | ||
public const string Type = "type"; | ||
public const string Created = "created"; | ||
public const string ContentType = "content-type"; | ||
public static readonly string[] RequiredMetadata = {Type, ContentType}; | ||
|
||
public static class ContentTypes { | ||
public const string ApplicationJson = "application/json"; | ||
public const string ApplicationOctetStream = "application/octet-stream"; | ||
} | ||
} | ||
|
||
public static class Headers { | ||
public const string Authorization = "authorization"; | ||
public const string BasicScheme = "Basic"; | ||
public const string BearerScheme = "Bearer"; | ||
|
||
public const string ConnectionName = "connection-name"; | ||
public const string RequiresLeader = "requires-leader"; | ||
} | ||
} | ||
} | ||
namespace EventStore.Client; | ||
|
||
internal static class Constants { | ||
public static class Exceptions { | ||
public const string ExceptionKey = "exception"; | ||
|
||
public const string AccessDenied = "access-denied"; | ||
public const string InvalidTransaction = "invalid-transaction"; | ||
public const string StreamDeleted = "stream-deleted"; | ||
public const string WrongExpectedVersion = "wrong-expected-version"; | ||
public const string StreamNotFound = "stream-not-found"; | ||
public const string MaximumAppendSizeExceeded = "maximum-append-size-exceeded"; | ||
public const string MissingRequiredMetadataProperty = "missing-required-metadata-property"; | ||
public const string NotLeader = "not-leader"; | ||
|
||
public const string PersistentSubscriptionFailed = "persistent-subscription-failed"; | ||
public const string PersistentSubscriptionDoesNotExist = "persistent-subscription-does-not-exist"; | ||
public const string PersistentSubscriptionExists = "persistent-subscription-exists"; | ||
public const string MaximumSubscribersReached = "maximum-subscribers-reached"; | ||
public const string PersistentSubscriptionDropped = "persistent-subscription-dropped"; | ||
|
||
public const string UserNotFound = "user-not-found"; | ||
public const string UserConflict = "user-conflict"; | ||
|
||
public const string ScavengeNotFound = "scavenge-not-found"; | ||
|
||
public const string ExpectedVersion = "expected-version"; | ||
public const string ActualVersion = "actual-version"; | ||
public const string StreamName = "stream-name"; | ||
public const string GroupName = "group-name"; | ||
public const string Reason = "reason"; | ||
public const string MaximumAppendSize = "maximum-append-size"; | ||
public const string RequiredMetadataProperties = "required-metadata-properties"; | ||
public const string ScavengeId = "scavenge-id"; | ||
public const string LeaderEndpointHost = "leader-endpoint-host"; | ||
public const string LeaderEndpointPort = "leader-endpoint-port"; | ||
|
||
public const string LoginName = "login-name"; | ||
} | ||
|
||
public static class Metadata { | ||
public const string Type = "type"; | ||
public const string Created = "created"; | ||
public const string ContentType = "content-type"; | ||
public static readonly string[] RequiredMetadata = {Type, ContentType}; | ||
|
||
public static class ContentTypes { | ||
public const string ApplicationJson = "application/json"; | ||
public const string ApplicationOctetStream = "application/octet-stream"; | ||
} | ||
} | ||
|
||
public static class Headers { | ||
public const string Authorization = "authorization"; | ||
public const string BasicScheme = "Basic"; | ||
public const string BearerScheme = "Bearer"; | ||
|
||
public const string ConnectionName = "connection-name"; | ||
public const string RequiresLeader = "requires-leader"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
using System; | ||
using System.Threading; | ||
using Grpc.Core; | ||
using Timeout_ = System.Threading.Timeout; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
using Grpc.Core; | ||
|
||
namespace EventStore.Client { | ||
internal static class MetadataExtensions { | ||
public static bool TryGetValue(this Metadata metadata, string key, out string? value) { | ||
value = default; | ||
namespace EventStore.Client; | ||
|
||
foreach (var entry in metadata) { | ||
if (entry.Key != key) { | ||
continue; | ||
} | ||
value = entry.Value; | ||
return true; | ||
} | ||
internal static class MetadataExtensions { | ||
public static bool TryGetValue(this Metadata metadata, string key, out string? value) { | ||
value = default; | ||
|
||
return false; | ||
} | ||
foreach (var entry in metadata) { | ||
if (entry.Key != key) { | ||
continue; | ||
} | ||
value = entry.Value; | ||
return true; | ||
} | ||
|
||
public static StreamRevision GetStreamRevision(this Metadata metadata, string key) | ||
=> metadata.TryGetValue(key, out var s) && ulong.TryParse(s, out var value) | ||
? new StreamRevision(value) | ||
: StreamRevision.None; | ||
return false; | ||
} | ||
|
||
public static int GetIntValueOrDefault(this Metadata metadata, string key) | ||
=> metadata.TryGetValue(key, out var s) && int.TryParse(s, out var value) | ||
? value | ||
: default; | ||
} | ||
} | ||
public static StreamRevision GetStreamRevision(this Metadata metadata, string key) | ||
=> metadata.TryGetValue(key, out var s) && ulong.TryParse(s, out var value) | ||
? new StreamRevision(value) | ||
: StreamRevision.None; | ||
|
||
public static int GetIntValueOrDefault(this Metadata metadata, string key) | ||
=> metadata.TryGetValue(key, out var s) && int.TryParse(s, out var value) | ||
? value | ||
: default; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 25 additions & 28 deletions
53
src/EventStore.Client.Streams/InvalidTransactionException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace EventStore.Client { | ||
/// <summary> | ||
/// Exception thrown if there is an attempt to operate inside a | ||
/// transaction which does not exist. | ||
/// </summary> | ||
public class InvalidTransactionException : Exception { | ||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException() { | ||
} | ||
namespace EventStore.Client; | ||
|
||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException(string message) : base(message) { | ||
} | ||
/// <summary> | ||
/// Exception thrown if there is an attempt to operate inside a | ||
/// transaction which does not exist. | ||
/// </summary> | ||
public class InvalidTransactionException : Exception { | ||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException() { } | ||
|
||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException(string message, Exception innerException) : base(message, innerException) { | ||
} | ||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException(string message) : base(message) { } | ||
|
||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
protected InvalidTransactionException(SerializationInfo info, StreamingContext context) : base(info, context) { | ||
} | ||
} | ||
} | ||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
public InvalidTransactionException(string message, Exception innerException) : base(message, innerException) { } | ||
|
||
/// <summary> | ||
/// Constructs a new <see cref="InvalidTransactionException"/>. | ||
/// </summary> | ||
[Obsolete("Obsolete")] | ||
protected InvalidTransactionException(SerializationInfo info, StreamingContext context) : base(info, context) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.