Skip to content

Commit

Permalink
Merge pull request #59 from Cratis:upgrade-dolittle
Browse files Browse the repository at this point in the history
Upgrading to v11 of Dolittle SDK
  • Loading branch information
einari authored Nov 10, 2021
2 parents 9323c87 + b7ee3bd commit d2f972f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Samples/Dolittle/EventGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ namespace Sample
public class EventGenerator : Controller
{
static readonly Random _random = new();
static readonly Guid[] _accountGuids = new[]
static readonly string[] _accountGuids = new[]
{
Guid.Parse("626fb1ab-e74d-4bd9-a519-0e4268499fd6"),
Guid.Parse("37e3c5b9-206c-435c-98f1-8971895c5059"),
Guid.Parse("43e659e9-3d45-4600-a6db-c4d5b9f0d2b0"),
Guid.Parse("200e206f-2796-4e96-952a-5fe64c49f430")
"626fb1ab-e74d-4bd9-a519-0e4268499fd6",
"37e3c5b9-206c-435c-98f1-8971895c5059",
"43e659e9-3d45-4600-a6db-c4d5b9f0d2b0",
"200e206f-2796-4e96-952a-5fe64c49f430"
};
static readonly string[] _accountNames = new[]
{
Expand Down Expand Up @@ -112,8 +112,8 @@ async Task InsertNewEvent(uint? sequenceNumber = default, DateTimeOffset? occurr
new EventMetadata(
occurred.Value,
_accountGuids[account.Value],
eventType.EventType.Id,
eventType.EventType.Generation,
eventType.Identifier,
eventType.Generation,
false),
new Aggregate(false, Guid.Empty, 0, 0),
new EventHorizon(false, 0, DateTimeOffset.MinValue, Guid.Empty),
Expand Down
4 changes: 2 additions & 2 deletions Samples/Dolittle/EventLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public async Task Append(EventSourceId eventSourceId, object @event)
new EventMetadata(
DateTimeOffset.UtcNow,
eventSourceId,
eventType!.EventType.Id,
eventType!.EventType.Generation,
eventType!.Identifier,
eventType!.Generation,
false),
new Aggregate(false, Guid.Empty, 0, 0),
new EventHorizon(false, 0, DateTimeOffset.MinValue, Guid.Empty),
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/Dolittle/Dolittle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json.Schema" Version="$(NewtonsoftJsonSchema)" />
<PackageReference Include="Dolittle.SDK" Version="9.2.0" />
<PackageReference Include="Dolittle.SDK" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/Dolittle/EventStore/EventMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

namespace Cratis.Extensions.Dolittle.EventStore
{
public record EventMetadata(DateTimeOffset Occurred, Guid EventSource, Guid TypeId, uint TypeGeneration, bool Public);
public record EventMetadata(DateTimeOffset Occurred, string EventSource, Guid TypeId, uint TypeGeneration, bool Public);
}
2 changes: 1 addition & 1 deletion Source/Extensions/Dolittle/EventTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public EventTypes(ITypes types)
.ToDictionary(_ =>
{
var eventType = _.GetCustomAttribute<EventTypeAttribute>()!;
return new EventType(eventType.EventType.Id.Value, eventType.EventType.Generation.Value);
return new EventType(eventType.Identifier.Value, eventType.Generation.Value);
}, _ => _);

All = _typesByEventType.Keys.ToArray();
Expand Down
6 changes: 3 additions & 3 deletions Source/Extensions/Dolittle/Schemas/SchemaStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public EventSchema GenerateFor(Type type)

var typeSchema = _generator.Generate(type);
typeSchema.SetDisplayName(type.Name);
typeSchema.SetGeneration(eventTypeAttribute.EventType.Generation.Value);
typeSchema.SetGeneration(eventTypeAttribute.Generation.Value);

var eventSchema = new EventSchema(eventTypeAttribute.EventType, typeSchema);
var eventSchema = new EventSchema(new EventType(eventTypeAttribute.Identifier, eventTypeAttribute.Generation), typeSchema);
ExtendSchema(type, eventSchema, typeSchema);

return eventSchema;
Expand All @@ -111,7 +111,7 @@ public async Task<IEnumerable<EventSchema>> GetLatestForAllEventTypes()
}

/// <inheritdoc/>
public async Task<IEnumerable<EventSchema>> GetAllGenerationsForEventType(global::Dolittle.SDK.Events.EventType eventType)
public async Task<IEnumerable<EventSchema>> GetAllGenerationsForEventType(EventType eventType)
{
var filter = Builders<EventSchemaMongoDB>.Filter.Eq(_ => _.EventType, eventType.Id.Value);
var all = _collection.Find(_ => _.EventType == eventType.Id.Value).ToList();
Expand Down

0 comments on commit d2f972f

Please sign in to comment.