Subject Re: Another incompatible query generation of provider
Author Marco Aurelio Castro
>> Firebird .Net may generate some code, but you mixing it up with your
>> code with "OUTER APPLY", wich have completely nothing related with Firebird
.Net driver.
>> Keep in mind that Firebird .Net driver designed to work with Firebird
>> only, and, if it generates some code that Firebird does not
>> understand, this may be only the result of some bug in Firebird .Net
driver.
>> Since I know that author of this driver (Jiri Cincura) uses this
>> driver in his applications, I seriously doubt that he (Jiri) wrote
>> driver for Firebird incompatible with Firebird.

Sirs,

I'm not stupid! I program in the last 24 years and I know exactly what
I'm talking about. The Dot,Net provider FirebirdSql.Data.FirebirdClient.dll
is generating incompatible code to be processed by Firebird server.

My ORM code is this:

var r = from cc in ConnModelos.Context().CONTA_CORRENTE
from ie in cc.NOTAS_ENTRADA.ITENS_ENTRADA
where ie.PRODUTOS.ESTOQUES.Where(w => w.FILIAL == Filial).
FirstOrDefault().DATA_PRIMEIRA_COMPRA >= _from

The "w => w.FILIAL == Filial" in the where part of the code generates the
OUTER APPLY code

I'll show the provider's code where it happens (Jiri's code). It is not
the last provider's version but the code for sure is still there. I'm sure
that Jiri knows it because give me the solution - change the code because
Firebird can't process this code kind:

/* * Firebird ADO.NET Data provider for .NET and Mono * * The
contents of this file are subject to the Initial * Developer's
Public License Version 1.0 (the "License"); * you may not use
this file except in compliance with the * License. You may obtain
a copy of the License at *
http://www.firebirdsql.org/index.php?op=doc&id=idpl * * Software
distributed under the License is distributed on * an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied.
See the License for the specific * language governing rights and
limitations under the License. * * Copyright (c) 2008 Jiri Cincura
(jiri@...) * All Rights Reserved. * * Based on the
Microsoft Entity Framework Provider Sample SP1 Beta 1 */

/// <summary>
/// An apply is just like a join, so it shares the common join processing
/// in <see cref="VisitJoinExpression"/>
/// </summary>
/// <param name="e"></param>
/// <returns>A <see cref="SqlSelectStatement"/>.</returns>
public override ISqlFragment Visit(DbApplyExpression e)
{
List<DbExpressionBinding> inputs = new List<DbExpressionBinding>();
inputs.Add(e.Input);
inputs.Add(e.Apply);

string joinString;
switch (e.ExpressionKind)
{
case DbExpressionKind.CrossApply:
joinString = "CROSS APPLY";
break;

case DbExpressionKind.OuterApply:
joinString = "OUTER APPLY";
break;

default:
Debug.Assert(false);
throw new InvalidOperationException();
}

// The join condition does not exist in this case, so we use null.
// We do not have a on clause, so we use JoinType.CrossJoin.
return VisitJoinExpression(inputs, DbExpressionKind.CrossJoin,
joinString, null);

}

--

Regards,

Marco Aurélio Castro
Director
McSoft


[Non-text portions of this message have been removed]