Example #1
0
        private static async Task OnResponseCompleted(Guid votingResultSongId, IRootLifetimeScopeProvider rootLifetimeScopeProvider)
        {
            await Task.Delay(TimeSpan.FromSeconds(Constants.App.TIME_BEFORE_START_OF_NEXT_SONG_IN_SECONDS + Constants.App.CROSSFADE_DURATION_IN_SECONDS));

            var unitOfWorkFactory = rootLifetimeScopeProvider.Get().Resolve <IUnitOfWorkFactory <IVotingFinisher, IMessageQueueService> >();

            using (var unit = unitOfWorkFactory.Begin())
            {
                await unit.Dependent.ApplyResultAsync(votingResultSongId);

                await unit.CommitAsync();

                unit.Dependent2.Send(Message.NextSongMessage);
            }
        }