Esempio n. 1
0
        public async Task <T> FirstOrDefaultAsync()
        {
            var context = GetContext();
            var result  = await GenericInMemoryMergeEngine <T> .Create(context).ExecuteAsync(async queryable => await EntityFrameworkQueryableExtensions.FirstOrDefaultAsync((IQueryable <T>)queryable));

            var q = result.Where(o => o != null).AsQueryable();

            if (context.Orders.Any())
            {
                return(q.OrderWithExpression(context.Orders).FirstOrDefault());
            }

            return(q.FirstOrDefault());
        }
Esempio n. 2
0
 private async Task <List <TResult> > GetGenericMergeEngine <TResult>(Func <IQueryable, Task <TResult> > efQuery)
 {
     return(await GenericInMemoryMergeEngine <T> .Create(GetContext()).ExecuteAsync(efQuery));
 }