Beispiel #1
0
        public async Task <IEnumerable <TEntity> > GetAllAsync()
        {
            CreateUpdateActions();

            IEnumerable <int> excludedIds = Current.Select(p => p.Entity.Id);

            string selectAllQuery = _sqlGeneratorBase.BuildGetAllSqlQuery(typeof(TEntity));

            IEnumerable <TEntity> resultSet = (await _connection.QueryAsync <TEntity>(selectAllQuery, new { ExcludedIds = excludedIds }).ConfigureAwait(false)).ToList();

            IEnumerable <CleanEntity <TEntity> > propertiesDictionaries = from entity in resultSet
                                                                          let cleanEntity = _dataComparer.ConvertObjectToPropertiesDictionary(entity)
                                                                                            select new CleanEntity <TEntity>(entity, cleanEntity);

            Current.AddRange(propertiesDictionaries);

            return(Current.Select(p => p.Entity));
        }