You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
872 B
C#

using System;
using System.Configuration;
using System.Diagnostics;
namespace Txgy.EWS.Client.Common
{
public class FreeSqlLocalSqLite
{
static Lazy<IFreeSql> sqLiteLazy = new Lazy<IFreeSql>(() => new FreeSql.FreeSqlBuilder()
//.UseMonitorCommand(cmd => Trace.WriteLine($"Sql{cmd.CommandText}"))//监听SQL语句,Trace在输出选项卡中查看
.UseConnectionString(FreeSql.DataType.Sqlite, "Data Source="+ System.AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.AppSettings["LocalSqLiteDb"].ToString())
//.UseConnectionString(FreeSql.DataType.Sqlite, "Data Source=EwsLocalSqLite.db")
.Build()); //自动同步实体结构到数据库FreeSql不会扫描程序集只有CRUD时才会生成表。
public static IFreeSql freeLocalSqLite => sqLiteLazy.Value;
}
}