예제 #1
0
        public async virtual Task <string> AddAsync(TAggregate aggregate)
        {
            try
            {
                aggregate.Id = ObjectId.GenerateNewId().ToString();
                await _provider.Collection <TAggregate, TEvent>().InsertOneAsync(aggregate);

                return(aggregate.Id.ToString());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 public async Task UpdateAsync(TAggregate aggregate)
 {
     await _provider.Collection <TAggregate, TEvent>().ReplaceOneAsync(x => x.Id == aggregate.Id, aggregate);
 }