private void OnEntryCreatedWithType(IDbTransaction tx, ICommit commit, EntryCreatedWithType @event) { var sqlParams = @event.ToDynamic(); sqlParams.Id = commit.AggregateId(); const string sql = @" UPDATE [PlacementProjector.Entry] SET [TypeName] = [EntryType].[Name] FROM ( SELECT [Id], [Name] FROM [dbo].[EntryType]) AS EntryType WHERE [EntryType].[Id] = @TypeId AND [PlacementProjector.Entry].[Id] = @Id" ; tx.Connection.Execute(sql, (object)sqlParams, tx); }
void Apply(EntryCreatedWithType @event) { TypeId = @event.TypeId; }