私のモデル:
public partial class history_builds
{
public int ID { get; set; }
public int build { get; set; }
public int br { get; set; }
public int tag { get; set; }
public string line { get; set; }
public int rev { get; set; }
public int user_ID { get; set; }
public string distrib_path { get; set; }
public string setup_path { get; set; }
public System.DateTime build_date { get; set; }
public string product { get; set; }
}
public partial class history_uploads
{
public int ID { get; set; }
public int ID_user { get; set; }
public string Line { get; set; }
public int Build { get; set; }
public string Distrib { get; set; }
public System.DateTime Time_upload { get; set; }
public int Status { get; set; }
}
public partial class user
{
public int ID { get; set; }
public string Name { get; set; }
public int ID_group { get; set; }
}
環境:
public DbSet<history_builds> history_builds { get; set; }
public DbSet<history_uploads> history_uploads { get; set; }
public DbSet<user> users { get; set; }
このEntityフレームワークの左結合のように左結合を試みます
var items = entities.history_builds
.Join(
entities.users.DefaultIfEmpty(),
hb => hb.user_ID,
u => u.ID,
(hb, u) =>
new {
hb.distrib_path,
hb.setup_path,
hb.build_date,
hb.build,
User = (u == null ? String.Empty : u.Name),
hb.rev
}
)
.Join(entities.history_uploads.DefaultIfEmpty(),
hb => hb.build,
hu => hu.Build,
(hb, hu) =>
new HistoryBuidItem {
Revision = hb.rev,
Build = hb.build,
DistribPath = hb.distrib_path,
SetupPath = hb.setup_path,
BuildDate = hb.build_date,
User = hb.User,
IsUpload = (hu == null ? true : false)
}
)
.Where(x => ids.Contains(x.Revision))
.ToList();
しかし、それは機能しません.EFはまだ内部結合SQLコードを発行しています.何が問題なのですか?