1234567891011121314151617181920212223242526272829303132333435 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using Cksoft.Unity.Log4NetConfig;
- using System;
- using System.Threading.Tasks;
- namespace DbTest
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("开始读取数据库");
- string connStr = "server=localhost;Port=3306;Database=vipmanage;Uid=root;Pwd=1101210;Charset=utf8;Max Pool Size=100;Allow User Variables=True;SslMode=None;";
- Parallel.For(0, 20000, i =>
- {
- try
- {
- using (IDatabase db = DbFactory.Base(connStr, DatabaseType.MySql))
- {
- Console.WriteLine($"第{i + 1}次访问数据库");
- var sql = $"select * from function;";
- db.FindList<object>(sql);
- }
- }
- catch (Exception e)
- {
- LogHelper<Program>.LogFatal(e.Message, string.Empty, null);
- }
- });
- Console.ReadKey();
- }
- }
- }
|