Ejemplo n.º 1
0
 /// <summary>
 /// Execute Query[T].Where(query).First();
 /// </summary>
 public T First <T>(Query query = null, string collectionName = null)
 {
     using (var db = new LiteRepository(_configService.ConnectionString))
     {
         return(db.First <T>(query, collectionName));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Execute Query[T].Where(query).First();
 /// </summary>
 public T First <T>(Expression <Func <T, bool> > predicate, string collectionName = null)
 {
     using (var db = new LiteRepository(_configService.ConnectionString))
     {
         return(db.First <T>(predicate, collectionName));
     }
 }
Ejemplo n.º 3
0
        public Result <T> First(Query query = null, string collectionName = null)
        {
            var result = new Result <T>();

            try
            {
                result.ResultObject = _liteRepository.First <T>(query, collectionName);
            }
            catch (Exception ex)
            {
                result.ResultCode         = (int)ResultStatusCode.InternalServerError;
                result.ResultMessage      = "Hata Oluştu => " + ex;
                result.ResultInnerMessage = "Hata Oluştu => " + ex.InnerException;

                result.ResultStatus = false;
            }

            return(result);
        }
Ejemplo n.º 4
0
        public Todo Get(Guid id)
        {
            Todo result;

            using (var repo = new LiteRepository(_connectionString))
            {
                result = repo.First <Todo>(t => t.Id == id);
            }
            return(result);
        }
Ejemplo n.º 5
0
        protected TAggregate Get <TAggregate, TState>(Guid id, Func <TState, TAggregate> mapping)
            where TAggregate : class
            where TState : struct
        {
            using (var db = new LiteRepository(_connectionString, _mapper))
            {
                var state = db.First <StateWrapper <TState> >(
                    sw => sw.Id.Equals(id), _collectionName
                    ).State;

                var aggregate = mapping(state);

                return(aggregate);
            }
        }
 public TEntity Get(Expression <Func <TEntity, bool> > filter = null)
 {
     return(_liteRepository.First(filter));
 }
Ejemplo n.º 7
0
 public T First(Expression <Func <T, bool> > predicate)
 {
     return(_liteRepository.First(predicate));
 }