Skip to content
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
6 changes: 3 additions & 3 deletions docs/documents/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public class Reservation: IRevisioned

// other properties

public int Version { get; set; }
public long Version { get; set; }
}
```
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/Marten.Testing/Examples/RevisionedDocuments.cs#L83-L99' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_versioned_reservation' title='Start of snippet'>anchor</a></sup>
Expand All @@ -200,11 +200,11 @@ public class Order
{
public Guid Id { get; set; }

// Marking an integer as the "version"
// Marking a long as the "version"
// of the document, and making Marten
// opt this document into the numeric revisioning
[Version]
public int Version { get; set; }
public long Version { get; set; }
}
```
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/Marten.Testing/Examples/RevisionedDocuments.cs#L68-L81' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_versioned_order' title='Start of snippet'>anchor</a></sup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task start_as_inline_move_to_async_and_just_continue()
public class SimpleAggregate : IRevisioned
{
// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }

public Guid Id { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions src/DaemonTests/Aggregations/side_effects_in_aggregations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public class SideEffects1: IRevisioned
public int B { get; set; }
public int C { get; set; }
public int D { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

public record WasDeleted(Guid Id);
Expand Down Expand Up @@ -460,7 +460,7 @@ public class SideEffects2: IRevisioned
public int B { get; set; }
public int C { get; set; }
public int D { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

public class RecordingMessageOutbox: IMessageOutbox
Expand Down
2 changes: 1 addition & 1 deletion src/DaemonTests/TeleHealth/Appointments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Appointment
{
public Guid Id { get; set; }

public int Version { get; set; }
public long Version { get; set; }
public DateTimeOffset Created { get; set; }
public string SpecialtyCode { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/DaemonTests/TeleHealth/ProviderShift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace DaemonTests.TeleHealth;
public class ProviderShift(Guid boardId, Provider provider)
{
public Guid Id { get; set; }
public int Version { get; set; }
public long Version { get; set; }
public Guid BoardId { get; private set; } = boardId;
public Guid ProviderId => Provider.Id;
public ProviderStatus Status { get; set; } = ProviderStatus.Paused;
Expand Down
2 changes: 1 addition & 1 deletion src/DaemonTests/TestingSupport/Trip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override string ToString()
return $"{nameof(Id)}: {Id}, {nameof(EndedOn)}: {EndedOn}, {nameof(Traveled)}: {Traveled}, {nameof(State)}: {State}, {nameof(Active)}: {Active}, {nameof(StartedOn)}: {StartedOn}";
}

public int Version { get; set; }
public long Version { get; set; }
}


Expand Down
2 changes: 1 addition & 1 deletion src/DocumentDbTests/Bugs/Bug_3778_schema_name_issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public async Task TestSchemaNameEndingWith_d_In_Index(string schemaName)
}

public record User3778(Guid Id, string Name, DateTimeOffset D1, DateOnly D2, User3778 Manager,
DateTimeOffset LastModifiedOn, DateTimeOffset CreatedOn, int Version, bool IsArchived);
DateTimeOffset LastModifiedOn, DateTimeOffset CreatedOn, long Version, bool IsArchived);
6 changes: 3 additions & 3 deletions src/DocumentDbTests/Concurrency/numeric_revisioning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public class RevisionedDoc: IRevisioned
public Guid Id { get; set; }
public string Name { get; set; }

public int Version { get; set; }
public long Version { get; set; }
}

public class OtherRevisionedDoc
Expand All @@ -584,7 +584,7 @@ public class OtherRevisionedDoc
public string Name { get; set; }

[Version]
public int Version { get; set; }
public long Version { get; set; }
}

public class UnconventionallyVersionedDoc
Expand All @@ -593,5 +593,5 @@ public class UnconventionallyVersionedDoc

public string Name { get; set; }

public int UnconventionalVersion { get; set; }
public long UnconventionalVersion { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = _serializer.FromJson<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 0);
var version = reader.GetFieldValue<int>(1);
var version = reader.GetFieldValue<long>(1);
document.Version = version;
return document;
}
Expand All @@ -248,7 +248,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = await _serializer.FromJsonAsync<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 0, token).ConfigureAwait(false);
var version = await reader.GetFieldValueAsync<int>(1, token);
var version = await reader.GetFieldValueAsync<long>(1, token);
document.Version = version;
return document;
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = _serializer.FromJson<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1);
var version = reader.GetFieldValue<int>(2);
var version = reader.GetFieldValue<long>(2);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
return document;
Expand All @@ -292,7 +292,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = await _serializer.FromJsonAsync<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1, token).ConfigureAwait(false);
var version = await reader.GetFieldValueAsync<int>(2, token);
var version = await reader.GetFieldValueAsync<long>(2, token);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
return document;
Expand Down Expand Up @@ -325,7 +325,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = _serializer.FromJson<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1);
var version = reader.GetFieldValue<int>(2);
var version = reader.GetFieldValue<long>(2);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
_identityMap[id] = document;
Expand All @@ -340,7 +340,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = await _serializer.FromJsonAsync<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1, token).ConfigureAwait(false);
var version = await reader.GetFieldValueAsync<int>(2, token);
var version = await reader.GetFieldValueAsync<long>(2, token);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
_identityMap[id] = document;
Expand Down Expand Up @@ -374,7 +374,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = _serializer.FromJson<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1);
var version = reader.GetFieldValue<int>(2);
var version = reader.GetFieldValue<long>(2);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
_identityMap[id] = document;
Expand All @@ -390,7 +390,7 @@ public DocumentDbTests.Concurrency.RevisionedDoc Resolve(System.Data.Common.DbDa

DocumentDbTests.Concurrency.RevisionedDoc document;
document = await _serializer.FromJsonAsync<DocumentDbTests.Concurrency.RevisionedDoc>(reader, 1, token).ConfigureAwait(false);
var version = await reader.GetFieldValueAsync<int>(2, token);
var version = await reader.GetFieldValueAsync<long>(2, token);
document.Version = version;
_session.MarkAsDocumentLoaded(id, document);
_identityMap[id] = document;
Expand Down Expand Up @@ -1055,7 +1055,7 @@ public RevisionedDocBulkLoader1212098993(Marten.Internal.Storage.IDocumentStorag

public const string OVERWRITE_WITH_VERSION_SQL = "update numeric_revisioning.mt_doc_revisioneddoc target SET data = source.data, mt_dotnet_type = source.mt_dotnet_type, mt_version = source.mt_version, mt_last_modified = transaction_timestamp() FROM mt_doc_revisioneddoc_temp source WHERE source.id = target.id and target.mt_version = source.mt_expected_version";

public const string CREATE_TEMP_TABLE_FOR_COPYING_SQL = "create temporary table mt_doc_revisioneddoc_temp (like numeric_revisioning.mt_doc_revisioneddoc including defaults, \"mt_expected_version\" integer)";
public const string CREATE_TEMP_TABLE_FOR_COPYING_SQL = "create temporary table mt_doc_revisioneddoc_temp (like numeric_revisioning.mt_doc_revisioneddoc including defaults, \"mt_expected_version\" bigint)";


public override string CreateTempTableForCopying()
Expand Down Expand Up @@ -1086,7 +1086,7 @@ public override async System.Threading.Tasks.Task LoadRowAsync(Npgsql.NpgsqlBina
{
await writer.WriteAsync(document.GetType().FullName, NpgsqlTypes.NpgsqlDbType.Varchar, cancellation);
await writer.WriteAsync(((DocumentDbTests.Concurrency.RevisionedDoc)document).Id, NpgsqlTypes.NpgsqlDbType.Uuid, cancellation);
await writer.WriteAsync(1, NpgsqlTypes.NpgsqlDbType.Integer, cancellation);
await writer.WriteAsync((long)1, NpgsqlTypes.NpgsqlDbType.Bigint, cancellation);
await writer.WriteAsync(serializer.ToJson(document), NpgsqlTypes.NpgsqlDbType.Jsonb, cancellation);
}

Expand All @@ -1095,8 +1095,8 @@ public override async System.Threading.Tasks.Task LoadTempRowAsync(Npgsql.Npgsql
{
await writer.WriteAsync(document.GetType().FullName, NpgsqlTypes.NpgsqlDbType.Varchar, cancellation);
await writer.WriteAsync(((DocumentDbTests.Concurrency.RevisionedDoc)document).Id, NpgsqlTypes.NpgsqlDbType.Uuid, cancellation);
writer.Write(document.Version <= 0 ? (object)System.DBNull.Value : (object)document.Version, NpgsqlTypes.NpgsqlDbType.Integer);
await writer.WriteAsync(1, NpgsqlTypes.NpgsqlDbType.Integer, cancellation);
writer.Write(document.Version <= 0 ? (object)System.DBNull.Value : (object)(long)document.Version, NpgsqlTypes.NpgsqlDbType.Bigint);
await writer.WriteAsync((long)1, NpgsqlTypes.NpgsqlDbType.Bigint, cancellation);
await writer.WriteAsync(serializer.ToJson(document), NpgsqlTypes.NpgsqlDbType.Jsonb, cancellation);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DocumentDbTests/Writing/bulk_loading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,6 @@ public class RevisionedBulkDoc : IRevisioned
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public int Version { get; set; }
public long Version { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class MyAggregate


// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }


public Guid Id { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/EventSourcingTests/Aggregation/OrderAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class OrderAggregate

// This would be set automatically by Marten if
// used as the target of a SingleStreamAggregation
public int Version { get; set; }
public long Version { get; set; }

public void Apply(OrderShipped shipped) => HasShipped = true;
public bool HasShipped { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public async Task set_version_on_aggregate_with_explicit_Version_attribute()
public class MyAggregateWithDifferentVersionProperty
{
[Version]
public int SpecialVersion { get; set; }
public long SpecialVersion { get; set; }


public Guid Id { get; set; }
Expand Down
6 changes: 3 additions & 3 deletions src/EventSourcingTests/Aggregation/stream_compacting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public class Letters : IRevisioned
public int BCount { get; set; }
public int CCount { get; set; }
public int DCount { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

public class LetterCounts: IRevisioned
Expand All @@ -371,7 +371,7 @@ public class LetterCounts: IRevisioned
public int BCount { get; set; }
public int CCount { get; set; }
public int DCount { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

public class LetterCountsByString: IRevisioned
Expand All @@ -381,7 +381,7 @@ public class LetterCountsByString: IRevisioned
public int BCount { get; set; }
public int CCount { get; set; }
public int DCount { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

public class LetterCountsByStringProjection: SingleStreamProjection<LetterCountsByString, string>
Expand Down
2 changes: 1 addition & 1 deletion src/EventSourcingTests/Aggregation/using_apply_metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public class Item
public string LastModifiedBy { get; set; }
public DateTimeOffset? LastModified { get; set; }

public int Version { get; set; }
public long Version { get; set; }
}

public record ItemStarted(string Description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public async Task finding_last_aggregate_using_string()

public record DeleteYourself;

public class SimpleMaybeDeletedAggregate : IRevisioned
public class SimpleMaybeDeletedAggregate : Marten.Metadata.IRevisioned
{
// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }

public bool ShouldDelete(DeleteYourself _) => true;

Expand Down Expand Up @@ -160,7 +160,7 @@ public override string ToString()
}
}

public class SimpleAsStringMaybeDeletedAggregate : IRevisioned
public class SimpleAsStringMaybeDeletedAggregate : Marten.Metadata.IRevisioned
{
protected bool Equals(SimpleAsStringMaybeDeletedAggregate other)
{
Expand Down Expand Up @@ -193,7 +193,7 @@ public override int GetHashCode()
}

// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }

public bool ShouldDelete(DeleteYourself _) => true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public record LoadTestInlineProjection
public Guid LastValue { get; init; }
public long Sum { get; init; }
[Version]
public int Version { get; set; }
public long Version { get; set; }

public LoadTestInlineProjection Apply(LoadTestEvent @event, LoadTestInlineProjection current)
{
Expand All @@ -228,7 +228,7 @@ public record LoadTestUnrelatedInlineProjection
public string StreamKey { get; init; }
public long Count { get; init; }
[Version]
public int Version { get; set; }
public long Version { get; set; }

public LoadTestUnrelatedInlineProjection Apply(LoadTestUnrelatedEvent @event, LoadTestUnrelatedInlineProjection current)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Order

// This is important, by Marten convention this would
// be the
public int Version { get; set; }
public long Version { get; set; }

public Order(OrderCreated created)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,5 @@ public class VersionedGuy
public int CCount { get; set; }
public int DCount { get; set; }

public int Version { get; set; }
public long Version { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ public async Task work_correctly_for_multiple_calls_with_identity_map()
public class SimpleAggregate : IRevisioned
{
// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }

public Guid Id { get;
set; }
Expand Down Expand Up @@ -848,7 +848,7 @@ public override int GetHashCode()
public class SimpleAggregate2
{
// This will be the aggregate version
public int Version { get; set; }
public long Version { get; set; }

public Guid Id { get; set; }

Expand Down Expand Up @@ -987,13 +987,13 @@ public class SomeProjection : IRevisioned
public Guid Id { get; set; }
public int A { get; set; }
public void Apply(EventA e) => A++;
public int Version { get; set; }
public long Version { get; set; }
}

public class SomeOtherProjection : IRevisioned
{
public Guid Id { get; set; }
public int A { get; set; }
public void Apply(EventA e) => A++;
public int Version { get; set; }
public long Version { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Data
public int C { get; set; }
public int D { get; set; }
public string Status { get; set; }
public int Version { get; set; }
public long Version { get; set; }
public Guid Guid { get; set; }
public DateTimeOffset Time { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Data
public int C { get; set; }
public int D { get; set; }
public string Status { get; set; }
public int Version { get; set; }
public long Version { get; set; }
}

private async Task<Data> readData(DbDataReader reader)
Expand Down
Loading
Loading