src/Inflatable/DbContext.cs
/// <summary>
/// Executes the query represented by a specified expression tree.
/// </summary>
/// <param name="expression">An expression tree that represents a LINQ query.</param>
/// <returns>The value that results from executing the specified query.</returns>
Executes the query represented by a specified expression tree.
Executes the query represented by a specified expression tree .
public override object? Execute(Expression expression)
        {
            var Results = Translate(expression);
            var TempSession = Canister.Builder.Bootstrapper?.Resolve<ISession>();
            if (TempSession is null)
                return null;
            if (Results.Values.Any(x => x?.Count ?? false))
                return Task.Run(async () => await TempSession.ExecuteCountAsync(Results).ConfigureAwait(false)).GetAwaiter().GetResult();
            var DatabaseValues = Task.Run(async () => await TempSession.ExecuteAsync(Results).ConfigureAwait(false)).GetAwaiter().GetResult() ?? Array.Empty<dynamic>();
            return Results.Values.Any(x => (x?.Top ?? 0) == 1) ? DatabaseValues.FirstOrDefault() : DatabaseValues;
        }
public override object ? Execute ( Expression expression ) { var Results = Translate ( expression ) ; var TempSession = Canister . Builder . Bootstrapper ? . Resolve < ISession > ( ) ; if ( TempSession is null ) return null ; if ( Results . Values . Any ( x => x ? . Count ?? false ) ) return Task . Run ( async ( ) => await TempSession . ExecuteCountAsync ( Results ) . ConfigureAwait ( false ) ) . GetAwaiter ( ) . GetResult ( ) ; var DatabaseValues = Task . Run ( async ( ) => await TempSession . ExecuteAsync ( Results ) . ConfigureAwait ( false ) ) . GetAwaiter ( ) . GetResult ( ) ?? Array . Empty < dynamic > ( ) ; return Results . Values . Any ( x => ( x ? . Top ?? 0 ) == 1 ) ? DatabaseValues . FirstOrDefault ( ) : DatabaseValues ; }
Executes the query represented by a specified expression tree.
Executes the query represented by a specified expression tree .
The value that results from executing the specified query.
The value that results from executing the specified query .
expression
Expression
An expression tree that represents a LINQ query.
An expression tree that represents a LINQ query .