Skip to content

Commit

Permalink
Restructured the demo applications into a single application.
Browse files Browse the repository at this point in the history
  • Loading branch information
chadgreen committed Oct 12, 2020
1 parent 8e795fe commit 01b34e4
Show file tree
Hide file tree
Showing 17 changed files with 651 additions and 47 deletions.
Binary file modified .vs/Ch-Ch-Ch-Changes/v16/.suo
Binary file not shown.
3 changes: 1 addition & 2 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"ExpandedNodes": [
"",
"\\Demos",
"\\Demos\\Common"
"\\Demos"
],
"SelectedNode": "\\Demos\\Ch-ch-ch-changes.sln",
"PreviewInSolutionExplorer": false
Expand Down
Binary file modified .vs/slnx.sqlite
Binary file not shown.
Binary file modified Ch-ch-ch-changes - Tracing Changes in Azure Cosmos DB.pptx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"ArchiveData-Function": {
"commandName": "Project",
"commandLineArgs": "host start --pause-on-error --port 7072"
}
}
}
56 changes: 14 additions & 42 deletions Demos/Ch-ch-ch-changes.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30524.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Archive Data", "Archive Data", "{DDD1150F-EB5F-4D40-90AB-86810CFB1D95}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{8716AE2A-4518-4E42-96ED-34255409A56E}"
ProjectSection(SolutionItems) = preProject
Data\CPL19.csv = Data\CPL19.csv
Expand All @@ -14,28 +12,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{8716AE2A-4
Data\QuestionInteractions.csv = Data\QuestionInteractions.csv
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Denormalize Data", "Denormalize Data", "{1B8C4C5F-51EB-4EF6-9735-E6AF5A1740BE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Replicating Data", "Replicating Data", "{94E11704-B8FE-4EDD-9168-A3B2AD601C2E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Event-Driven Architecture", "Event-Driven Architecture", "{98319DFD-EA37-4997-BB20-23B840572219}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQL Scripts", "SQL Scripts", "{DDFBC51A-02F2-4B31-A0B5-8700A57DDA97}"
ProjectSection(SolutionItems) = preProject
SQL Scripts\GetMetadata.sql = SQL Scripts\GetMetadata.sql
SQL Scripts\GetSessionDetails.sql = SQL Scripts\GetSessionDetails.sql
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DenormalizeData-Console", "Denormalize Data\DenormalizeData-Console\DenormalizeData-Console.csproj", "{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DenormalizeData-Function", "Denormalize Data\DenormalizeData-Function\DenormalizeData-Function.csproj", "{E3A1FA9C-AA31-438B-8B96-8DBC71011064}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArchiveData-Console", "Archive Data\ArchiveData-Console\ArchiveData-Console.csproj", "{BA8C8820-34DA-45EE-8F1A-4973A49A5289}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArchiveData-Function", "Archive Data\ArchiveData-Function\ArchiveData-Function.csproj", "{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventDrivenArchitecture-Console", "Event-Driven Architecture\EventDrivenArchitecture-Console\EventDrivenArchitecture-Console.csproj", "{400D9C3B-88DB-49F8-AB68-75AD4AA9920F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventDrivenArchitecture-Function-Inventory", "Event-Driven Architecture\EventDrivenArchitecture-Function-Inventory\EventDrivenArchitecture-Function-Inventory.csproj", "{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventDrivenArchitecture-Function-Notification", "Event-Driven Architecture\EventDrivenArchitecture-Function-Notification\EventDrivenArchitecture-Function-Notification.csproj", "{69A276BF-228B-4F1F-8EE8-4E7FA38B5076}"
Expand All @@ -44,36 +30,26 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventDrivenArchitecture-Fun
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{4FD9813D-67B9-4287-A746-35B282351217}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReplicatingData-Console", "Replicating Data\ReplicatingData-Console\ReplicatingData-Console.csproj", "{62A39531-2697-41FB-BBFE-AAC54E9C4B4E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReplicatingData-Function", "Replicating Data\ReplicatingData-Function\ReplicatingData-Function.csproj", "{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demonstrator", "Demonstrator\Demonstrator.csproj", "{864C947D-FEA3-4555-8614-A605C3575DC8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Functions", "Functions", "{47234F40-50A8-4366-8818-B2DCE4241F1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B}.Release|Any CPU.Build.0 = Release|Any CPU
{E3A1FA9C-AA31-438B-8B96-8DBC71011064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3A1FA9C-AA31-438B-8B96-8DBC71011064}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3A1FA9C-AA31-438B-8B96-8DBC71011064}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3A1FA9C-AA31-438B-8B96-8DBC71011064}.Release|Any CPU.Build.0 = Release|Any CPU
{BA8C8820-34DA-45EE-8F1A-4973A49A5289}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA8C8820-34DA-45EE-8F1A-4973A49A5289}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA8C8820-34DA-45EE-8F1A-4973A49A5289}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA8C8820-34DA-45EE-8F1A-4973A49A5289}.Release|Any CPU.Build.0 = Release|Any CPU
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF}.Release|Any CPU.Build.0 = Release|Any CPU
{400D9C3B-88DB-49F8-AB68-75AD4AA9920F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{400D9C3B-88DB-49F8-AB68-75AD4AA9920F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{400D9C3B-88DB-49F8-AB68-75AD4AA9920F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{400D9C3B-88DB-49F8-AB68-75AD4AA9920F}.Release|Any CPU.Build.0 = Release|Any CPU
{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -90,29 +66,25 @@ Global
{4FD9813D-67B9-4287-A746-35B282351217}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FD9813D-67B9-4287-A746-35B282351217}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FD9813D-67B9-4287-A746-35B282351217}.Release|Any CPU.Build.0 = Release|Any CPU
{62A39531-2697-41FB-BBFE-AAC54E9C4B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62A39531-2697-41FB-BBFE-AAC54E9C4B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62A39531-2697-41FB-BBFE-AAC54E9C4B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62A39531-2697-41FB-BBFE-AAC54E9C4B4E}.Release|Any CPU.Build.0 = Release|Any CPU
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6}.Release|Any CPU.Build.0 = Release|Any CPU
{864C947D-FEA3-4555-8614-A605C3575DC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{864C947D-FEA3-4555-8614-A605C3575DC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{864C947D-FEA3-4555-8614-A605C3575DC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{864C947D-FEA3-4555-8614-A605C3575DC8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B7515995-F5CC-490F-A5AC-0DBBC0A70C5B} = {1B8C4C5F-51EB-4EF6-9735-E6AF5A1740BE}
{E3A1FA9C-AA31-438B-8B96-8DBC71011064} = {1B8C4C5F-51EB-4EF6-9735-E6AF5A1740BE}
{BA8C8820-34DA-45EE-8F1A-4973A49A5289} = {DDD1150F-EB5F-4D40-90AB-86810CFB1D95}
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF} = {DDD1150F-EB5F-4D40-90AB-86810CFB1D95}
{400D9C3B-88DB-49F8-AB68-75AD4AA9920F} = {98319DFD-EA37-4997-BB20-23B840572219}
{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC} = {98319DFD-EA37-4997-BB20-23B840572219}
{69A276BF-228B-4F1F-8EE8-4E7FA38B5076} = {98319DFD-EA37-4997-BB20-23B840572219}
{565F0E7B-DC6C-45B6-9025-DAE3128DD2EA} = {98319DFD-EA37-4997-BB20-23B840572219}
{62A39531-2697-41FB-BBFE-AAC54E9C4B4E} = {94E11704-B8FE-4EDD-9168-A3B2AD601C2E}
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6} = {94E11704-B8FE-4EDD-9168-A3B2AD601C2E}
{E3A1FA9C-AA31-438B-8B96-8DBC71011064} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
{5192D72A-4BB7-4035-B7C0-CA8A4DBCFBFF} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
{24A4F97F-6C0D-458D-AFDA-FCB38AD08FBC} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
{69A276BF-228B-4F1F-8EE8-4E7FA38B5076} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
{565F0E7B-DC6C-45B6-9025-DAE3128DD2EA} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
{D4C35F1A-CD1A-4542-B5D5-F4C6DB4760B6} = {47234F40-50A8-4366-8818-B2DCE4241F1C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1B250357-A6D7-4256-B401-B5E4B604343B}
Expand Down
89 changes: 89 additions & 0 deletions Demos/Demonstrator/ArchivalDemo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Azure.Cosmos;
using ShellProgressBar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TaleLearnCode.ChChChChanges.Common;

namespace TaleLearnCode.ChChChChanges.Demonstrator
{

public class ArchivalDemo
{

private readonly CosmosContainer _container;

private ArchivalDemo(CosmosClient cosmosClient)
{
_container = cosmosClient
.GetDatabase(Settings.MoveDataDatabasebaseName)
.GetContainer(Settings.ArchivalContainerName);
}

public static async Task ExecuteAsync(CosmosClient cosmosClient)
{
await new ArchivalDemo(cosmosClient).ExecuteAsync();
}

private async Task ExecuteAsync()
{
WelcomeUser();
await AddDataToCosmosAsync(GetQuestionInteractions());
}

private void WelcomeUser()
{
Console.Clear();
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(@" _____ .__ .__ .__ ");
Console.WriteLine(@" / _ \_______ ____ | |__ |__|__ _______ | | ");
Console.WriteLine(@" / /_\ \_ __ \_/ ___\| | \| \ \/ /\__ \ | | ");
Console.WriteLine(@"/ | \ | \/\ \___| Y \ |\ / / __ \| |__");
Console.WriteLine(@"\____|__ /__| \___ >___| /__| \_/ (____ /____/");
Console.WriteLine(@" \/ \/ \/ \/ ");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White;
}

private List<QuestionInteraction> GetQuestionInteractions()
{
Console.WriteLine();
Console.WriteLine();
return QuestionInteraction.GetListOfInteractions($"{Settings.DataFolderPath}QuestionInteractions.csv");
}

private async Task AddDataToCosmosAsync(List<QuestionInteraction> questionInteractions)
{

Console.WriteLine();
Console.WriteLine("Press any key to start the writing data to Cosmos...");
Console.ReadKey();

Console.WriteLine();
Console.WriteLine();
using var progressBar = new ProgressBar(questionInteractions.Count, "Connecting to database");

int index = 0;
do
{
while (!Console.KeyAvailable && index < questionInteractions.Count)
{
progressBar.Tick($"Writing interaction {index + 1:n0} of {questionInteractions.Count:n0}");
await _container.CreateItemAsync(questionInteractions[index]);
var delay = questionInteractions[index + 1].InteractionDateTime.Subtract(questionInteractions[index].InteractionDateTime);
await Task.Delay(Convert.ToInt32(delay.TotalMilliseconds));
index++;
}
if (index >= questionInteractions.Count - 1) break;
} while (Console.ReadKey(true).Key != ConsoleKey.Escape);

Console.WriteLine();
Console.WriteLine();
Console.WriteLine($"Finished writing data to the {Settings.ArchivalContainerName} container");

}

}

}
18 changes: 18 additions & 0 deletions Demos/Demonstrator/DemoOption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Demonstrator
{

public enum DemoOption
{
Exit = 0,
ArchivingData = 1,
ReplicatingContainers = 2,
DenormalizingData = 3,
EventDrivenArchitecture = 4,
RealTimeReporting = 5
}

}
19 changes: 19 additions & 0 deletions Demos/Demonstrator/Demonstrator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>TaleLearnCode.ChChChChanges.Demonstrator</AssemblyName>
<RootNamespace>TaleLearnCode.ChChChChanges.Demonstrator</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
<PackageReference Include="ShellProgressBar" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 01b34e4

Please sign in to comment.