Exemplo n.º 1
0
        object IQueryProvider.Execute(Expression expression)
        {
            // if session is null, it means that query is not executable - it should be used only to DEFINE a query and translate it to SQL
            // but not execute it. Example: DbView definition
            Util.Check(Session != null, "The query is not executable. Query: {0}", expression);
            var elemType = expression.Type.IsGenericType ? expression.Type.GenericTypeArguments[0] : typeof(object);
            var query    = new EntityQuery(this, elemType, expression);
            var command  = new LinqCommand(query, LinqCommandType.Select, LinqCommandKind.DynamicSql, null);
            var result   = Session.ExecuteLinqCommand(command);

            return(result);
        }