public IQueryResult <TEntity> Read(IQuery <TEntity> query) { try { CreateIfNotExists(typeof(TEntity).Name); using (var transaction = new Transaction(FilePath, null)) { Source = transaction.ReadStream(); } if (query.ActionType != ActionType.Select) { throw new InvalidOperationException(); } if (string.IsNullOrEmpty(Source)) { return(new QueryResult <TEntity>() { IsSuccess = true, Result = new List <TEntity>() }); } var lines = Source.Split(Line).Where(x => x != "\r\n" && !string.IsNullOrEmpty(x)).ToArray(); return(new QueryResult <TEntity>() { IsSuccess = true, Result = _interpreter.InterpreteToEntity(lines) }); } catch (Exception exception) { return(new QueryResult <TEntity>() { IsSuccess = false, Exception = exception, ErrorMessage = exception.Message }); } }