私はこれを試すことができませんが、このwhere句のようなものを使ってみてください。
from e in ctx.CompositeEntities
where ids.Where(i => e.KeyA == i.Item1 && e.KeyB == i.Item2).Count() > 0
select e;
=====編集=====
よく同じ例外で失敗します、励ましに感謝します。
キーがintであり、bigintではないと仮定すると、次はどうでしょうか。
public class e1 {
public int KeyA { get; set; }
public int KeyB { get; set; }
}
public class e1Configuration : EntityTypeConfiguration<e1> {
public e1Configuration()
: base() {
HasKey(x => new { x.KeyA, x.KeyB });
}
}
public class TestEFContext : DbContext {
public IDbSet<e1> es { get; set; }
public TestEFContext(String cs)
: base(cs) {
Database.SetInitializer<TestEFContext>(new DropCreateDatabaseAlways<TestEFContext>());
}
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
modelBuilder.Configurations.Add(new e1Configuration());
}
}
class Program {
static void Main(String[] args) {
using (TestEFContext c = new TestEFContext(@"Data Source=ALIASTVALK;Initial Catalog=TestEF;Integrated Security=True; MultipleActiveResultSets=True")) {
c.es.Add(new e1 { KeyA = 1, KeyB = 1 });
c.es.Add(new e1 { KeyA = 1, KeyB = 2 });
c.es.Add(new e1 { KeyA = Int32.MaxValue, KeyB = 2 });
c.SaveChanges();
}
List<Tuple<int, int>> ids = new List<Tuple<int, int>> {
new Tuple<int, int>(1, 1),
new Tuple<int, int>(Int32.MaxValue, 2),};
List<Int64> lis = (from t in ids select (Int64)t.Item1 * 2^ 32 + t.Item2).ToList();
using (TestEFContext c0 = new TestEFContext(@"Data Source=ALIASTVALK;Initial Catalog=TestEF;Integrated Security=True; MultipleActiveResultSets=True")) {
var v = from e in c0.es
where lis.Contains((Int64)e.KeyA * 2 ^ 32 + e.KeyB)
select e;
Console.WriteLine(v.Count());
}
}
}