Repository navigation
Closed
Milestone
Description
Database: MSSQL
EntityFramework: EntityFramework.Core:7.0.0-rc1-final and Microsoft.EntityFrameworkCore:1.0.0-rc2-20261(aspnetcidev)
ctx.DeviceMsgUps
.GroupJoin(ctx.UserDeviceMaps.Where(udp => udp.UserId == 1025 && udp.Status == 0 && udp.DeviceId != null), dmu => dmu.DeviceId, udp => udp.DeviceId, (key, vals) => new { key, vals })
.Where(pair => pair.vals.Any())
.Select(pair=>pair.key)
.Select(key=>new { key.Format })
.Count()Get 3 result(the same with ToList).
ctx.DeviceMsgUps
.GroupJoin(ctx.UserDeviceMaps.Where(udp => udp.UserId == 1025 && udp.Status == 0 && udp.DeviceId != null), dmu => dmu.DeviceId, udp => udp.DeviceId, (key, vals) => new { key, vals })
.Where(pair => pair.vals.Any())
.Select(pair=>pair.key)
//.Select(key=>new { key.Format })
.Count()Get 57 result(the same with ToList).
ctx.DeviceMsgUps
.GroupJoin(ctx.UserDeviceMaps.Where(udp => udp.UserId == 1025 && udp.Status == 0 && udp.DeviceId != null), dmu => dmu.DeviceId, udp => udp.DeviceId, (key, vals) => new { key, vals })
.Where(pair => pair.vals.Any())
//.Select(pair=>pair.key)
//.Select(key=>new { key.Format })
.Count()Get 1 result(the same with ToList).
Model
[System.CodeDom.Compiler.GeneratedCodeAttribute("EF.Reverse.POCO.Generator", "2.18.1.0")]
public class DeviceMsgUp
{
public int MessageId { get; set; } // Message_ID (Primary key)
public int DeviceId { get; set; } // Device_ID
public byte Format { get; set; } // Format
public byte Action { get; set; } // Action
public string Data { get; set; } // Data (length: 1000)
public System.DateTime? ExpireTime { get; set; } // Expire_Time
public System.DateTime Update { get; set; } // Update
public byte ResultStatus { get; set; } // Result_Status
public string ResultData { get; set; } // Result_Data (length: 1000)
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("EF.Reverse.POCO.Generator", "2.18.1.0")]
public partial class UserDeviceMap
{
public int UdMapId { get; set; } // UDMap_ID (Primary key)
public int UserId { get; set; } // User_ID
public int? DeviceId { get; set; } // Device_ID
public int? StudentId { get; set; } // Student_ID
public int? ClassId { get; set; } // Class_ID
public string NickName { get; set; } // Nick_Name (length: 20)
public string Image { get; set; } // Image (length: 50)
public bool? Gender { get; set; } // Gender
public System.DateTime? BirthDate { get; set; } // Birth_Date
public System.DateTime? BindDate { get; set; } // Bind_Date
public byte Status { get; set; } // Status
public int Creator { get; set; } // Creator
public System.DateTime Upload { get; set; } // Upload
public int Login { get; set; } // Login
public System.DateTime Update { get; set; } // Update
public string CellPhoneNum { get; set; } // CellPhoneNum (length: 11)
// Reverse navigation
public virtual System.Collections.Generic.ICollection<UserWalkTarget> UserWalkTargets { get; set; } // Many to many mapping
// Foreign keys
public virtual Class Class { get; set; } // FK_User_Device_Map_Class_ID_Class_Class_ID
public virtual Device Device { get; set; } // FK_User_Device_Map_Device_ID_Device_Device_ID
public virtual Role Role { get; set; } // FK_User_Device_Map_User_ID_Role_Role_ID
public virtual Student Student { get; set; } // FK_User_Device_Map_Student_ID_Student_Student_ID
public UserDeviceMap()
{
UserWalkTargets = new System.Collections.Generic.List<UserWalkTarget>();
}
}
Activity
yyjdelete commentedon Apr 9, 2016
I paste an test code for both at #4860 (comment)
mikary commentedon Apr 12, 2016
This appears to be a bug (or multiple bugs) with the shape of the result from
GroupJoin. I restructured the sample to something closer to what we use inQueryTestBaseto compare the EF results with linq-to-objects. Note that the reference implementation has two results for each query.mikary commentedon Apr 12, 2016
Clearing milestone for triage
8 remaining items
Fix to #4858 - Select after complex GroupJoin lead to unpredictable r…
[-]Select after complex GroupJoin lead to unpredictable result?[/-][+]Select after complex GroupJoin lead to unpredictable result[/+]Eilon commentedon Aug 26, 2016
Approved for 1.0.1.
Fix to #4858 - Select after complex GroupJoin lead to unpredictable r…
maumar commentedon Aug 27, 2016
Fixed in: e514b49 (1.0.1) 1a46a54 (dev)
[-]Select after complex GroupJoin lead to unpredictable result[/-][+]Query: Select after complex GroupJoin lead to unpredictable result[/+][-]Query: Select after complex GroupJoin lead to unpredictable result[/-][+]Query: Select after complex GroupJoin leads to unpredictable results[/+]