Esempio n. 1
0
        public async Task <TEntity[]> SelectArrayAsync <TEntity>(Expression <Func <TEntity, object> > newExpression = null) where TEntity : Entity, new()
        {
            var properties = typeof(TEntity).GetReadWriteProperties();
            var members    = (newExpression?.Body as NewExpression)?.Members;
            var builder    = new QueryBuilder <TEntity>(connectorQuery, properties, members);

            using (var dataReader = await SelectAsync(members != null ? builder.BuildSelect(members) : builder.BuildSelectAll()))
                return(entityBuilder.CreateEntities(dataReader, builder));
        }
Esempio n. 2
0
        public async ValueTask <TEntity[]> SelectAsync <TEntity>(Expression <Func <TEntity, object> > newExpression = null) where TEntity : Entity, new()
        {
            var properties = typeof(TEntity).GetReadWriteProperties();
            var members    = (newExpression?.Body as NewExpression)?.Members;
            var builder    = new QueryBuilder <TEntity>(Connector.Query, properties, members);

            if (members != null)
            {
                builder.BuildSelect(members);
            }
            else
            {
                builder.BuildSelectAll();
            }

            var rowData = await SelectAsync(builder);

            return(entityBuilder.CreateEntities(rowData, builder));
        }