blob: 04d22a7b67e3510b80900bea15195a1434338312 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tango.Core.Helpers;
namespace Tango.BL
{
public class ObservablesContextConfiguration : DbConfiguration
{
public static String FolderPath { get; private set; }
static ObservablesContextConfiguration()
{
FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "EFCache", Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName));
}
public ObservablesContextConfiguration() : base()
{
Directory.CreateDirectory(FolderPath);
var modelStore = new DefaultDbModelStore(FolderPath);
SetModelStore(modelStore);
}
public static void ClearModelStore()
{
try
{
Directory.Delete(FolderPath);
}
catch { }
}
}
}
|