score:1
Accepted answer
Ok. The only solution, which is what I found while reading in the initial table to the list. Unfortunately, not quite what I meant, but it works.
AIds = (from x in
(
context.RISK_T_ASSESS_HIST.Where(x => x.ID_RISKOBJECT.HasValue && x.F_CREATEDON >= Freq.StartDate && x.F_CREATEDON <= Freq.EndDate)
.Select(x => new { x.ID_RISKOBJECT, x.F_CREATEDON, x.F_STATUS }).ToList()
)
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();
This issue Entity Framework and will be passed as an error on their forum.
Source: stackoverflow.com
Related Articles
- OUTER APPLY in .net 4.5 and Entity Framework
- Simple outer apply not working in Entity Framework 6
- Avoiding OUTER APPLY in Entity Framework projections
- Join sub query table to table function with outer apply using Entity Framework
- Entity Framework 6 Code First Custom Functions
- Is an outer join possible with Linq to Entity Framework
- Entity Framework (4.2) HasRequired results in unexpected LEFT OUTER JOIN
- How to do a left outer join in Entity Framework without using the query syntax?
- Avoiding repeated projection code in Entity Framework
- Forcing Entity Framework to not generate NCLOB's when building Linq-to-Sql Code (Model First)
- Entity Framework Code First without app.config
- How can I implement a LEFT OUTER JOIN in LINQ using lambda syntax on Entity Framework Core 2.0?
- Entity Framework generating LEFT OUTER JOINs when it should be doing INNER JOINs (multiple tables)
- Entity Framework using Sqlite.NET complains that APPLY joins are not supported
- Entity Framework Code First using context in Controller
- many to many mapping in entity framework code first
- How to apply the SQL in keyword in Entity Framework method syntax?
- How to Create a Run-Time Computed (NotMapped) Value in Entity Framework Code First
- updating data in many-to-many relationship in entity framework in code first existing database
- Entity Framework Code First String Comparison with Oracle Db
- SQL subquery result in LINQ and Entity Framework Code First
- most efficient Entity Framework Code First method of flattening / projecting parent entity with specific child
- Entity Framework Code First - Get blog posts which have certain tags
- How to Query Icollections of Entity Framework Code First Data
- Entity Framework code first - Many to Many - Include conditional
- Right outer join using Entity framework
- Left Outer Join Entity Framework Core 1.1.0
- Entity Framework Code First ToList method timing out on SQL Azure
- Entity Framework Insert In Code
- How to make a property unique in Entity Framework Code First
- Performance of Skip (and similar functions, like Take)
- Linq - check if the any of the values present in an array exists in the database table
- Is there a way to get the data by day name in entityframework
- How to get values out of IGrouping?
- Operator "IN" by key field in Linq to OData
- Counting parent objects using Linq
- How to use dynamic Linq with List<dynamic> object
- RX Extension ToObservable() yields an exception when querying a nested IColletion
- Easy way to flatten XML file with LINQ
- Extract values from HttpContext.User.Claims
- SQL Virtual Column in Linq
- Where and join in LINQ is not working
- Using Group by in Linq to get array or Ienumerable of datatable
- SQL statement convert in LINQ
- Timespan between (2) other Timespan when adding / subtracting minutes C#
- DataTable to List in C#
- Join two fields with Linq query
- Inserting XML data into existing XML with LINQ
- How do I use Linq-to-sql to iterate db records?
- Total of two vallues - with one as nonzero - returning zero