private FabricDatabase CreateTestingDb(bool deleteOld = true) { var databaseDir = Path.Combine(Directory.GetCurrentDirectory(), "TestingDB"); if (deleteOld) { if (Directory.Exists(databaseDir)) { Directory.Delete(databaseDir, true); } Directory.CreateDirectory(databaseDir); } var database = new FabricDatabase(databaseDir); database.Initialise(); _basicSerializerSettings = new JsonSerializerSettings { Converters = new List <JsonConverter> { new DataPageSerializer(database.Resolver) } }; return(database); }
private static void CreateTestWorkflows(FabricDatabase database) { const string schemaPath = "Fabric.Core.DebugResources.Pages."; var workflowNames = new [] { "workflow1" }; foreach (var workflowName in workflowNames) { var json = GetJsonFromResourcePath($"{schemaPath}{workflowName}.json"); database.Root.AddChild(workflowName, "workflow", json); } }
private static void CreateTestDoors(FabricDatabase database) { const string schemaPath = "Fabric.Core.DebugResources.Pages."; var doorNames = new [] { "door1", "door2" }; foreach (var doorName in doorNames) { var json = GetJsonFromResourcePath($"{schemaPath}{doorName}.json"); database.Root.AddChild(doorName, "door", json); } }
private static void CreateTestProjects(FabricDatabase database) { const string schemaPath = "Fabric.Core.DebugResources.Pages."; var projectNames = new[] { "project1", "project2" }; foreach (var projectName in projectNames) { var json = GetJsonFromResourcePath($"{schemaPath}{projectName}.json"); database.Root.AddChild(projectName, "project", json); } }
internal static void SeedDebugData(FabricDatabase database) { var schemas = GetDebugSchemas(); foreach (var schema in schemas) { database.Resolver.Resolve <ISchemaManager>().Add(schema.schemaName, schema.schemaRawJson); } CreateTestProjects(database); CreateTestDoors(database); CreateTestWorkflows(database); }
public FabricStore(FabricOptions options) { FabricOptions = options; Database = new FabricDatabase(FabricOptions.DataFolderName); #if DEBUG var directoryInfo = new DirectoryInfo(Database.FullDataBaseRoot); if (directoryInfo.Exists) { directoryInfo.DeleteDirectory(); directoryInfo.Create(); } #endif Database.Initialise(); #if DEBUG DebugDataSeeder.SeedDebugData(Database); #endif }