Exemplo n.º 1
0
        public async Task Concat_Multi_ST()
        {
            xx = string.Empty;

            var userId    = "08d6036b-0a7e-b07d-b9bd-af03841b3baa";
            var firstName = "伏";

            var where = Conn2.Queryer <Agent>().WhereSegment;

            // 条件1
            if (!userId.IsNullStr())
            {
                where = where.And(it => it.UserId == Guid.Parse(userId));
            }
            // 条件2
            if (!firstName.IsNullStr())
            {
                where = where.And(it => it.Name.StartsWith(firstName));
            }

            var res1 = await where.QueryListAsync();

            Assert.IsTrue(res1.Count == 1);



            xx = string.Empty;
        }
Exemplo n.º 2
0
        public async Task SqlAction_Distinct_Count_SpecialColumn_ST()
        {
            xx = string.Empty;

            var res1 = await Conn2
                       .Queryer <Agent>()
                       .Distinct()
                       .CountAsync(it => it.AgentLevel);

            Assert.AreEqual(3, res1);

            xx = string.Empty;
        }
Exemplo n.º 3
0
        public async Task Concat_None_ST()
        {
            xx = string.Empty;

            var where = Conn2.Queryer <Agent>().WhereSegment;

            var res1 = await where.TopAsync(1);

            Assert.IsNotNull(res1);



            xx = string.Empty;
        }
Exemplo n.º 4
0
        public async Task Sum_Nullable_ST()
        {
            xx = string.Empty;

            var res1 = await Conn2
                       .Queryer <AgentInventoryRecord>()
                       .Where(it => it.Id != Guid.Parse("df2b788e-6b1a-4a74-ac1d-016551f76dc9"))
                       .SumAsync(it => it.TotalSaleCount);

            Assert.IsTrue(res1 == 589);



            xx = string.Empty;
        }