-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectProfile.cs
More file actions
32 lines (26 loc) · 1.13 KB
/
ProjectProfile.cs
File metadata and controls
32 lines (26 loc) · 1.13 KB
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
using Newtonsoft.Json;
namespace AzureDatabaseDownloader
{
internal class ProjectProfile
{
private const string ProfilePath = "profiles.json";
public string Name { get; set; }
public string FromConnectionString { get; set; }
public string ToConnectionString { get; set; }
public string[] DatabasesToSync { get; set; }
public string LocalDbUser { get; set; }
public string WorkingDirectory { get; set; }
public bool IsActive { get; set; }
public string[]? ExcludeTables { get; set; }
public static IEnumerable<ProjectProfile> List()
{
if (!File.Exists(ProfilePath))
{
throw new FileNotFoundException("Couldn't find profiles.json. This file is required when running in interactive mode. Please copy profiles.sample.json to profiles.json and add your sync profiles there.");
}
var strProfiles = File.ReadAllText(ProfilePath);
var profiles = JsonConvert.DeserializeObject<List<ProjectProfile>>(strProfiles).Where(p => p.IsActive);
return profiles;
}
}
}