public void PrimaryKeyExpression_3() { var g = Guid.NewGuid(); var record = new TripleKey { StudentKey = 33, AdmissionNum = "1123223", Guid = g }; var exp = EntityFrameworkHelper.PrimaryKeyExpression <TripleKey>(); Assert.IsTrue(exp(record, new object[] { 33, "1123223", g })); Assert.IsFalse(exp(record, new object[] { 33, "1123223", Guid.NewGuid() })); }
public void FindExpression_3() { var g = Guid.NewGuid(); var record = new TripleKey { StudentKey = 33, AdmissionNum = "1123223", Guid = g }; var exp1 = EntityFrameworkHelper.FindExpression <TripleKey>(new object[] { 33, "1123223", g }).Compile(); var exp2 = EntityFrameworkHelper.FindExpression <TripleKey>(new object[] { 33, "1123223", Guid.NewGuid() }).Compile(); Assert.IsTrue(exp1(record)); Assert.IsFalse(exp2(record)); }
public TValue this[TKeyA keyA, TKeyB keyB, TKeyC keyC] { get { var key = TripleKey.Create(keyA, keyB, keyC); return(base.ContainsKey(key) ? base[key] : default(TValue)); } set { var key = TripleKey.Create(keyA, keyB, keyC); if (!ContainsKey(key)) { base.Add(key, value); } this[key] = value; } }
public void Add(TKeyA keyA, TKeyB keyB, TKeyC keyC, TValue value) { base.Add(TripleKey.Create(keyA, keyB, keyC), value); }
public bool ContainsKey(TKeyA keyA, TKeyB keyB, TKeyC keyC) { var key = TripleKey.Create(keyA, keyB, keyC); return(base.ContainsKey(key)); }