Skip to content

Revert "[DEVEX-222] Add built-in auto-serialization" #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Kurrent.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client", "src\Kurre
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.Common", "test\Kurrent.Client.Tests.Common\Kurrent.Client.Tests.Common.csproj", "{47BF715B-A0BF-4044-B335-717E56422550}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.NeverLoadedAssembly", "test\Kurrent.Client.Tests.NeverLoadedAssembly\Kurrent.Client.Tests.NeverLoadedAssembly.csproj", "{0AC8A7E9-6839-4B4C-B299-950C376DF71F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurrent.Client.Tests.ExternalAssembly", "test\Kurrent.Client.Tests.ExternalAssembly\Kurrent.Client.Tests.ExternalAssembly.csproj", "{829AF806-1144-408A-85FE-763835775086}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -38,20 +34,10 @@ Global
{47BF715B-A0BF-4044-B335-717E56422550}.Debug|x64.Build.0 = Debug|Any CPU
{47BF715B-A0BF-4044-B335-717E56422550}.Release|x64.ActiveCfg = Release|Any CPU
{47BF715B-A0BF-4044-B335-717E56422550}.Release|x64.Build.0 = Release|Any CPU
{0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Debug|x64.ActiveCfg = Debug|Any CPU
{0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Debug|x64.Build.0 = Debug|Any CPU
{0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Release|x64.ActiveCfg = Release|Any CPU
{0AC8A7E9-6839-4B4C-B299-950C376DF71F}.Release|x64.Build.0 = Release|Any CPU
{829AF806-1144-408A-85FE-763835775086}.Debug|x64.ActiveCfg = Debug|Any CPU
{829AF806-1144-408A-85FE-763835775086}.Debug|x64.Build.0 = Debug|Any CPU
{829AF806-1144-408A-85FE-763835775086}.Release|x64.ActiveCfg = Release|Any CPU
{829AF806-1144-408A-85FE-763835775086}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FC829F1B-43AD-4C96-9002-23D04BBA3AF3} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
{762EECAA-122E-4B0C-BC50-5AA4F72CA4E0} = {EA59C1CB-16DA-4F68-AF8A-642A969B4CF8}
{47BF715B-A0BF-4044-B335-717E56422550} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
{0AC8A7E9-6839-4B4C-B299-950C376DF71F} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
{829AF806-1144-408A-85FE-763835775086} = {C51F2C69-45A9-4D0D-A708-4FC319D5D340}
EndGlobalSection
EndGlobal
360 changes: 0 additions & 360 deletions src/Kurrent.Client/Core/KurrentClientSerializationSettings.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/Kurrent.Client/Core/KurrentClientSettings.ConnectionString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ public partial class KurrentClientSettings {
public static KurrentClientSettings Create(string connectionString) =>
ConnectionStringParser.Parse(connectionString);

/// <summary>
/// Creates client settings from a connection string with additional configuration
/// </summary>
/// <param name="connectionString"></param>
/// <param name="configure">allows you to make additional customization of client settings</param>
/// <returns></returns>
public static KurrentClientSettings Create(string connectionString, Action<KurrentClientSettings> configure) {
var settings = ConnectionStringParser.Parse(connectionString);

configure(settings);

return settings;
}

private static class ConnectionStringParser {
private const string SchemeSeparator = "://";
private const string UserInfoSeparator = "@";
Expand Down
6 changes: 0 additions & 6 deletions src/Kurrent.Client/Core/KurrentClientSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,5 @@ public partial class KurrentClientSettings {
/// The default deadline for calls. Will not be applied to reads or subscriptions.
/// </summary>
public TimeSpan? DefaultDeadline { get; set; } = TimeSpan.FromSeconds(10);

/// <summary>
/// Provides configuration options for messages serialization and deserialization in the KurrentDB client.
/// If null, default settings are used.
/// </summary>
public KurrentClientSerializationSettings Serialization { get; set; } = KurrentClientSerializationSettings.Default();
}
}
57 changes: 3 additions & 54 deletions src/Kurrent.Client/Core/ResolvedEvent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Kurrent.Client.Core.Serialization;

namespace EventStore.Client {
/// <summary>
/// A structure representing a single event or a resolved link event.
Expand All @@ -24,23 +22,6 @@ public readonly struct ResolvedEvent {
/// </summary>
public EventRecord OriginalEvent => Link ?? Event;

/// <summary>
/// Returns the deserialized message
/// It will be provided or equal to null, depending on the automatic deserialization settings you choose.
/// If it's null, you can use <see cref="OriginalEvent"/> to deserialize it manually.
/// </summary>
public readonly Message? Message;

/// <summary>
/// Returns the deserialized message data.
/// </summary>
public object? DeserializedData => Message?.Data;

/// <summary>
/// Returns the deserialized message metadata.
/// </summary>
public object? DeserializedMetadata => Message?.Metadata;

/// <summary>
/// Position of the <see cref="OriginalEvent"/> if available.
/// </summary>
Expand Down Expand Up @@ -68,44 +49,12 @@ public readonly struct ResolvedEvent {
/// <param name="event"></param>
/// <param name="link"></param>
/// <param name="commitPosition"></param>
public ResolvedEvent(EventRecord @event, EventRecord? link, ulong? commitPosition) : this(
@event,
link,
null,
commitPosition
) { }

/// <summary>
/// Constructs a new <see cref="ResolvedEvent"/>.
/// </summary>
/// <param name="event"></param>
/// <param name="link"></param>
/// <param name="message"></param>
/// <param name="commitPosition"></param>
ResolvedEvent(
EventRecord @event,
EventRecord? link,
Message? message,
ulong? commitPosition
) {
Event = @event;
Link = link;
Message = message;
public ResolvedEvent(EventRecord @event, EventRecord? link, ulong? commitPosition) {
Event = @event;
Link = link;
OriginalPosition = commitPosition.HasValue
? new Position(commitPosition.Value, (link ?? @event).Position.PreparePosition)
: new Position?();
}

internal static ResolvedEvent From(
EventRecord @event,
EventRecord? link,
ulong? commitPosition,
IMessageSerializer messageSerializer
) {
var originalEvent = link ?? @event;
return messageSerializer.TryDeserialize(originalEvent, out var message)
? new ResolvedEvent(@event, link, message, commitPosition)
: new ResolvedEvent(@event, link, commitPosition);
}
}
}
30 changes: 0 additions & 30 deletions src/Kurrent.Client/Core/Serialization/ISerializer.cs

This file was deleted.

62 changes: 0 additions & 62 deletions src/Kurrent.Client/Core/Serialization/Message.cs

This file was deleted.

148 changes: 0 additions & 148 deletions src/Kurrent.Client/Core/Serialization/MessageSerializer.cs

This file was deleted.

Loading
Loading