public async Task DeleteProjectionAsync(IDeletedEvent <TEntity> @event)
        {
            if (IgnoreEntityType())
            {
                return;
            }

            switch (@event)
            {
            case Delete <Course> d:
                var course = Context.Attach(new Course()
                {
                    Id = d.Id, PlayerId = d.PlayerId
                });
                Context.Remove(course);
                break;

            case Delete <Scorecard> d:
                var scorecard = Context.Attach(new Scorecard()
                {
                    Id = d.Id, PlayerId = d.PlayerId
                });
                Context.Remove(scorecard);
                break;
            }

            await Context.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task DeleteProjectionAsync(IDeletedEvent <TEntity> @event)
        {
            var result = await Options.ExecuteWithTableAsync(
                typeof(TEntity).Name,
                TableOperation.Delete(new DynamicTableEntity(
                                          @event.PlayerId,
                                          @event.Id.ToString())
            {
                ETag = "*"
            }));

            if (!result.HttpStatusCode.IsSuccessCode())
            {
                // TODO: log delete failure
            }
        }