Esempio n. 1
0
        public void Setup()
        {
            var servcies = new ServiceCollection();

            servcies.AddDbContext <TestDbContext>(opt => { opt.UseMySql("Server=localhost; Database=YunyongDataExchangeTestDB_20190109; Uid=SkyUser; Pwd=Sky@4321;SslMode=none;"); });

            var provider = servcies.BuildServiceProvider();

            var scope   = provider.CreateScope();
            var context = scope.ServiceProvider.GetService <TestDbContext>();

            context.Database.EnsureCreated();


            if (Conn.CountAsync <UserInfo>(a => true).Result == 0)
            {
                var rand = new Random();
                for (int i = 0; i < 100; i++)
                {
                    var tmp = EntityFactory.Create <UserInfo>();
                    tmp.Name = $"TestUser{rand.Next(1000, 9999):0000}";
                    Conn.CreateAsync(tmp).GetAwaiter().GetResult();
                }
            }
        }
Esempio n. 2
0
        public async Task Count_Star_Shortcut()
        {
            xx = string.Empty;

            var res1 = await Conn.CountAsync <Agent>(it => it.Name.Length > 3);

            Assert.True(res1 == 116);

            xx = string.Empty;
        }
Esempio n. 3
0
        public async Task test()
        {
            var xx1 = "";

            var res1 = await Conn.CountAsync <Agent>(it => it.Name.Length > 3);

            Assert.True(res1 == 116);

            var tuple1 = (XDebug.SQL, XDebug.Parameters, XDebug.SqlWithParams);

            var xx = "";
        }
Esempio n. 4
0
 public virtual async Task <int> CountAsync(IRepoQuery query)
 {
     return(await Conn.CountAsync(query));
 }