コード例 #1
0
        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() }));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 public void Add(TKeyA keyA, TKeyB keyB, TKeyC keyC, TValue value)
 {
     base.Add(TripleKey.Create(keyA, keyB, keyC), value);
 }
コード例 #5
0
    public bool ContainsKey(TKeyA keyA, TKeyB keyB, TKeyC keyC)
    {
        var key = TripleKey.Create(keyA, keyB, keyC);

        return(base.ContainsKey(key));
    }