<commit_before>﻿using DragonSpark.Compose;
using DragonSpark.Model.Operations;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DragonSpark.Application.Entities.Selection
{
	public class WhereSelection<TKey, T> : WhereSelection<TKey, T, T>
	{
		public WhereSelection(IQueryable<T> queryable, Query<TKey, T> query,
		                      Func<IQueryable<T>, IQueryable<T>> selection)
			: base(queryable, query, selection) {}
	}

	public class WhereSelection<TKey, TEntity, T> : ISelecting<TKey, List<T>>
	{
		readonly IQueryable<TEntity>                      _queryable;
		readonly Query<TKey, TEntity>                     _query;
		readonly Func<IQueryable<TEntity>, IQueryable<T>> _selection;

		public WhereSelection(IQueryable<TEntity> queryable, Query<TKey, TEntity> query,
		                      Func<IQueryable<TEntity>, IQueryable<T>> selection)
		{
			_queryable = queryable;
			_query     = query;
			_selection = selection;
		}

		public ValueTask<List<T>> Get(TKey parameter)
		{
			var query     = _queryable.Where(_query(parameter));
			var selection = _selection(query);
			var result    = selection.ToListAsync().ToOperation();
			return result;
		}
	}


}<commit_msg>ToList -> ToArray<commit_after>﻿using DragonSpark.Model.Operations;
using DragonSpark.Model.Sequences;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace DragonSpark.Application.Entities.Selection
{
	public class WhereSelection<TKey, T> : WhereSelection<TKey, T, T>
	{
		public WhereSelection(IQueryable<T> queryable, Query<TKey, T> query,
		                      Func<IQueryable<T>, IQueryable<T>> selection)
			: base(queryable, query, selection) {}
	}

	public class WhereSelection<TKey, TEntity, T> : ISelecting<TKey, Array<T>>
	{
		readonly IQueryable<TEntity>                      _queryable;
		readonly Query<TKey, TEntity>                     _query;
		readonly Func<IQueryable<TEntity>, IQueryable<T>> _selection;

		public WhereSelection(IQueryable<TEntity> queryable, Query<TKey, TEntity> query,
		                      Func<IQueryable<TEntity>, IQueryable<T>> selection)
		{
			_queryable = queryable;
			_query     = query;
			_selection = selection;
		}

		public async ValueTask<Array<T>> Get(TKey parameter)
		{
			var query     = _queryable.Where(_query(parameter));
			var selection = _selection(query);
			var result    = await selection.ToArrayAsync().ConfigureAwait(false);
			return result;
		}
	}


}
{'fraction_non_alphanumeric': 0.10682261208576999, 'fraction_numerical': 0.0, 'mean_word_length': 3.673952641165756, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7658181', 'n_tokens_mistral': 879, 'n_tokens_neox': 799, 'n_words': 167}