数据库
首页 > 数据库> > 使用Chloe 连接MySql服务器

使用Chloe 连接MySql服务器

作者:互联网

1、需要安装的依赖

Chloe

Chloe.MySql

MySql.Data

 

 

代码:

public class DbConnectionFactory : IDbConnectionFactory
    {
        public IDbConnection CreateConnection()
        {
            return new MySql.Data.MySqlClient.MySqlConnection("server = 192.168.1.236; user id = root; password = 123456; database = zqhc");
        }
    }

  

IDbContext dbContext = new MySqlContext(new DbConnectionFactory());
            var m = dbContext.Query<zqhc_set_mail>();

 

标签:Chloe,MySql,dbContext,new,服务器,Data,public
来源: https://www.cnblogs.com/volts0302/p/16393378.html