/// <inheritdoc/>
        public async Task <TModel> SingleOrDefaultAsync(object[] keyValues, CancellationToken ct)
        {
            var findExpression = EntityFrameworkHelper.FindExpression <TEntity>(keyValues);

            var item = await this.OnBaseEntityFindQuery(ct)
                       .SingleOrDefaultAsync(findExpression, ct)
                       .ConfigureAwait(false);

            return(this.OnConvert(item));
        }
        public void FindExpression_2()
        {
            var record = new DoubleKey {
                StudentKey = 1, AdmissionNum = "123"
            };

            var exp1 = EntityFrameworkHelper.FindExpression <DoubleKey>(new object[] { 1, "123" }).Compile();
            var exp2 = EntityFrameworkHelper.FindExpression <DoubleKey>(new object[] { 2, string.Empty }).Compile();

            Assert.IsTrue(exp1(record));
            Assert.IsFalse(exp2(record));
        }
        public void FindExpression_1()
        {
            var record = new SingleKey {
                StudentKey = 1
            };

            var exp1 = EntityFrameworkHelper.FindExpression <SingleKey>(1).Compile();
            var exp2 = EntityFrameworkHelper.FindExpression <SingleKey>(2).Compile();

            Assert.IsTrue(exp1(record));
            Assert.IsFalse(exp2(record));
        }
        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));
        }