using System; using System.IO; namespace Txgy.EWS.Client.Common { public class FreeSqlLocalSqLite { private static Lazy sqLiteLazy = CreateLazy(); public static IFreeSql freeLocalSqLite => sqLiteLazy.Value; public static void Reset() { if (sqLiteLazy.IsValueCreated) { sqLiteLazy.Value.Dispose(); } sqLiteLazy = CreateLazy(); } private static Lazy CreateLazy() { return new Lazy(() => new FreeSql.FreeSqlBuilder() .UseConnectionString(FreeSql.DataType.Sqlite, "Data Source=" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, BusinessConfigManager.Current.Paths.LocalSqLiteDb)) .Build()); } } }