using System; using System.Configuration; using System.Diagnostics; namespace Txgy.EWS.Client.Common { public class FreeSqlTencent { static Lazy mySQLLazy = new Lazy(() => new FreeSql.FreeSqlBuilder() .UseMonitorCommand(cmd => Trace.WriteLine($"Sql:{cmd.CommandText}"))//监听SQL语句,Trace在输出选项卡中查看 .UseConnectionString(FreeSql.DataType.MySql, ConfigurationManager.ConnectionStrings["TencetnMySQL"].ConnectionString) .Build()); //自动同步实体结构到数据库,FreeSql不会扫描程序集,只有CRUD时才会生成表。 public static IFreeSql tencentRemoteMySQL => mySQLLazy.Value; } }