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.

30 lines
811 B
C#

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