28810 e1e3e4a3b2 - 增加 Where In 表达式解析;
- 增加 FreeSqlBuilder.UseConnectionFactory 自定义数据库连接对象的创建方法;
2019-12-17 01:39:53 +08:00

29 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
public class g
{
static Lazy<IFreeSql> mysqlLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd_mysqlconnector;Charset=utf8;SslMode=none;Max pool size=10")
//.UseConnectionFactory(FreeSql.DataType.MySql, () => new MySql.Data.MySqlClient.MySqlConnection("Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd_mysqlconnector;Charset=utf8;SslMode=none;"))
.UseAutoSyncStructure(true)
//.UseGenerateCommandParameterWithLambda(true)
.UseMonitorCommand(
cmd =>
{
cmd.CommandTimeout = 200000;
Trace.WriteLine(cmd.CommandText);
}, //监听SQL命令对象在执行前
(cmd, traceLog) =>
{
Console.WriteLine(traceLog);
}) //监听SQL命令对象在执行后
.UseLazyLoading(true)
.Build());
public static IFreeSql mysql => mysqlLazy.Value;
}