.Net provider Generates "Outer aplly statement"
-----------------------------------------------

                 Key: DNET-497
                 URL: http://tracker.firebirdsql.org/browse/DNET-497
             Project: .NET Data provider
          Issue Type: Bug
          Components: Entity Framework support
    Affects Versions: 3.0.2.0
         Environment: Win 7x64, 
            Reporter: Wojciech Kmiecik
            Assignee: Jiri Cincura


hi.

We are using Database First Approach, after linq query 
                    AIds = (from x in context.RISK_T_ASSESS_HIST
                            where (x.ID_RISKOBJECT.HasValue && x.F_CREATEDON >= 
Freq.StartDate && x.F_CREATEDON <= Freq.EndDate)
                            group x by x.ID_RISKOBJECT into gr
                            let lastCreated = gr.Max(p => p.F_CREATEDON)
                            select new
                            {
                                ObjId = gr.Key
                                ,
                                LastStatus = gr.Where(p => p.F_CREATEDON == 
lastCreated && p.ID_RISKOBJECT == gr.Key).Select(p => 
p.F_STATUS).FirstOrDefault()
                            }).Where(x => x.LastStatus == 0 || x.LastStatus == 
1).Select(x => x.ObjId.Value).ToArray();

FB receives query  with Outer Apply
Query generowane przez EF


SELECT 
"Project1"."ID_RISKOBJECT" AS "ID_RISKOBJECT"
FROM (SELECT 
    "GroupBy1"."A1" AS "C1", 
    "GroupBy1"."K1" AS "ID_RISKOBJECT"
    FROM ( SELECT 
        "Extent1"."ID_RISKOBJECT" AS "K1", 
        MAX("Extent1"."F_CREATEDON") AS "A1"
        FROM "RISK_T_ASSESS_HIST" AS "Extent1"
        WHERE (("Extent1"."ID_RISKOBJECT" IS NOT NULL) 
        AND ("Extent1"."F_CREATEDON" >= 2013-04-17)) 
        AND ("Extent1"."F_CREATEDON" <= 2013-04-17)
        GROUP BY "Extent1"."ID_RISKOBJECT"
    ) AS "GroupBy1" ) AS "Project1"
OUTER APPLY (SELECT FIRST (1) 
    "Extent2"."F_STATUS" AS "F_STATUS"
    FROM "RISK_T_ASSESS_HIST" AS "Extent2"
    WHERE (((("Extent2"."ID_RISKOBJECT" IS NOT NULL) 
    AND ("Extent2"."F_CREATEDON" >= 2013-04-17)) 
    AND ("Extent2"."F_CREATEDON" <= @2013-04-17)) 
    AND (("Project1"."ID_RISKOBJECT" = "Extent2"."ID_RISKOBJECT") OR 
(("Project1"."ID_RISKOBJECT" IS NULL) 
    AND ("Extent2"."ID_RISKOBJECT" IS NULL)))) AND (("Extent2"."F_CREATEDON" = 
"Project1"."C1") 
    AND ("Extent2"."ID_RISKOBJECT" = "Project1"."ID_RISKOBJECT")) ) AS "Limit1"
WHERE (0 = "Limit1"."F_STATUS") OR (1 = "Limit1"."F_STATUS")


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to