Beispiel #1
0
        public Task <OperationResultOf <TEntity> > TryGetSingleAsync(TKey key,
                                                                     CancellationToken cancellation = default,
                                                                     params Expression <Func <TEntity, object> >[] toBeIncluded)
        {
            var validationOpRes = _keyValueValidator.Validate(key);

            if (!validationOpRes)
            {
                return(Task.FromResult(validationOpRes.AsFailedOpResOf <TEntity>()));
            }

            return(_dbContextProvider.TryUseAsync(dbSession =>
                                                  InternalTryGetSingleAsync(dbSession, key,
                                                                            trackChanges: false,
                                                                            cancellation,
                                                                            toBeIncluded)));
        }