diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..0f482d1
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,19 @@
+name: Build
+
+on:
+ workflow_call:
+
+jobs:
+ build:
+ runs-on: windows-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v6
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v5
+ with:
+ dotnet-version: 10.0.x
+
+ - name: Build
+ run: dotnet build Examples.slnx --configuration Release
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..b563f2a
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,15 @@
+name: Continuous Integration
+
+on:
+ push:
+ branches:
+ - master
+ - develop
+ - "feature/**"
+ pull_request:
+ branches:
+ - develop
+
+jobs:
+ build:
+ uses: ./.github/workflows/build.yml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..8066618
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,21 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
+ hooks:
+ - id: check-json
+ - id: check-yaml
+ - id: check-merge-conflict
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - repo: https://github.com/igorshubovych/markdownlint-cli
+ rev: "e72a3ca1632f0b11a07d171449fe447a7ff6795e" # frozen: v0.48.0
+ hooks:
+ - id: markdownlint
+ args:
+ - --fix
+ - repo: https://github.com/tillig/json-sort-cli
+ rev: "2b7e147e0933bd30b58133b6f287e5c695ff4f0e" # frozen: v3.0.1
+ hooks:
+ - id: json-sort
+ args:
+ - --autofix
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 4fe879c..4c8df8c 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -1,24 +1,24 @@
-{
- "tasks": [
- {
- "args": [
- "build",
- "Examples.sln",
- "/property:GenerateFullPaths=true",
- "/consoleloggerparameters:NoSummary"
- ],
- "command": "dotnet",
- "group": {
- "isDefault": true,
- "kind": "build"
- },
- "label": "build",
- "presentation": {
- "reveal": "silent"
- },
- "problemMatcher": "$msCompile",
- "type": "shell"
- }
- ],
- "version": "2.0.0"
-}
\ No newline at end of file
+{
+ "tasks": [
+ {
+ "args": [
+ "build",
+ "Examples.slnx",
+ "/property:GenerateFullPaths=true",
+ "/consoleloggerparameters:NoSummary"
+ ],
+ "command": "dotnet",
+ "group": {
+ "isDefault": true,
+ "kind": "build"
+ },
+ "label": "build",
+ "presentation": {
+ "reveal": "silent"
+ },
+ "problemMatcher": "$msCompile",
+ "type": "shell"
+ }
+ ],
+ "version": "2.0.0"
+}
diff --git a/Examples.sln b/Examples.sln
deleted file mode 100644
index dea08c2..0000000
--- a/Examples.sln
+++ /dev/null
@@ -1,202 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30907.101
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultitenantExample.ConsoleApplication", "src\MultitenantExample.ConsoleApplication\MultitenantExample.ConsoleApplication.csproj", "{7DC9BFB3-8F43-437D-81E2-BE540A017E70}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultitenantExample.MvcApplication", "src\MultitenantExample.MvcApplication\MultitenantExample.MvcApplication.csproj", "{6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultitenantExample.WcfService", "src\MultitenantExample.WcfService\MultitenantExample.WcfService.csproj", "{637C4B18-56BE-4E75-A7CD-7B79C489D33C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApiExample.OwinSelfHost", "src\WebApiExample.OwinSelfHost\WebApiExample.OwinSelfHost.csproj", "{07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AttributeMetadataExample", "src\AttributeMetadataExample\AttributeMetadataExample.csproj", "{38DDAE6D-0D1D-40D6-BF57-CAFED0322222}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MvcExample", "src\MvcExample\MvcExample.csproj", "{49C746F1-53F4-433C-ABE0-1938D8B508B2}"
- ProjectSection(ProjectDependencies) = postProject
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A} = {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WcfExample", "src\WcfExample\WcfExample.csproj", "{91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebFormsExample", "src\WebFormsExample\WebFormsExample.csproj", "{F966402C-3F18-4FC4-B5E6-8049C79614B8}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore3Example", "src\AspNetCore3Example\AspNetCore3Example.csproj", "{D07BC865-AD15-4859-AEA7-C58389DAB1F0}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericHostBuilderExample", "src\GenericHostBuilderExample\GenericHostBuilderExample.csproj", "{CE027ADF-C798-4989-B42C-BB571EBDAB03}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationExample", "src\ConfigurationExample\ConfigurationExample.csproj", "{40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}"
- ProjectSection(ProjectDependencies) = postProject
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5} = {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationExamplePlugin", "src\ConfigurationExamplePlugin\ConfigurationExamplePlugin.csproj", "{DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationExampleInterface", "src\ConfigurationExampleInterface\ConfigurationExampleInterface.csproj", "{477A33C0-33EE-4176-BA3F-7EF56B46A811}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCoreExample", "src\AspNetCoreExample\AspNetCoreExample.csproj", "{C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore3ChildLifetimeScope", "src\AspNetCore3ChildLifetimeScope\AspNetCore3ChildLifetimeScope.csproj", "{E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{211BCB83-5603-4B9F-855D-F383FF68278A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore3NoStartupExample", "src\AspNetCore3NoStartupExample\AspNetCore3NoStartupExample.csproj", "{3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Debug|x86.ActiveCfg = Debug|x86
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Debug|x86.Build.0 = Debug|x86
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Release|Any CPU.Build.0 = Release|Any CPU
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Release|x86.ActiveCfg = Release|x86
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70}.Release|x86.Build.0 = Release|x86
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Release|Any CPU.Build.0 = Release|Any CPU
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F}.Release|x86.ActiveCfg = Release|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Debug|x86.ActiveCfg = Debug|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Release|Any CPU.Build.0 = Release|Any CPU
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C}.Release|x86.ActiveCfg = Release|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Release|Any CPU.Build.0 = Release|Any CPU
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B}.Release|x86.ActiveCfg = Release|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Debug|x86.ActiveCfg = Debug|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Debug|x86.Build.0 = Debug|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Release|Any CPU.Build.0 = Release|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Release|x86.ActiveCfg = Release|Any CPU
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222}.Release|x86.Build.0 = Release|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Debug|x86.Build.0 = Debug|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Release|Any CPU.Build.0 = Release|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Release|x86.ActiveCfg = Release|Any CPU
- {49C746F1-53F4-433C-ABE0-1938D8B508B2}.Release|x86.Build.0 = Release|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Debug|x86.Build.0 = Debug|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Release|Any CPU.Build.0 = Release|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Release|x86.ActiveCfg = Release|Any CPU
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A}.Release|x86.Build.0 = Release|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Debug|x86.Build.0 = Debug|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Release|Any CPU.Build.0 = Release|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Release|x86.ActiveCfg = Release|Any CPU
- {F966402C-3F18-4FC4-B5E6-8049C79614B8}.Release|x86.Build.0 = Release|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Debug|x86.ActiveCfg = Debug|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Debug|x86.Build.0 = Debug|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Release|Any CPU.Build.0 = Release|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Release|x86.ActiveCfg = Release|Any CPU
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0}.Release|x86.Build.0 = Release|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Debug|x86.ActiveCfg = Debug|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Debug|x86.Build.0 = Debug|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Release|Any CPU.Build.0 = Release|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Release|x86.ActiveCfg = Release|Any CPU
- {CE027ADF-C798-4989-B42C-BB571EBDAB03}.Release|x86.Build.0 = Release|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Debug|x86.Build.0 = Debug|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Release|Any CPU.Build.0 = Release|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Release|x86.ActiveCfg = Release|Any CPU
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E}.Release|x86.Build.0 = Release|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Debug|x86.Build.0 = Debug|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Release|Any CPU.Build.0 = Release|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Release|x86.ActiveCfg = Release|Any CPU
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5}.Release|x86.Build.0 = Release|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Debug|x86.ActiveCfg = Debug|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Debug|x86.Build.0 = Debug|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Release|Any CPU.Build.0 = Release|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Release|x86.ActiveCfg = Release|Any CPU
- {477A33C0-33EE-4176-BA3F-7EF56B46A811}.Release|x86.Build.0 = Release|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Debug|x86.ActiveCfg = Debug|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Debug|x86.Build.0 = Debug|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Release|Any CPU.Build.0 = Release|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Release|x86.ActiveCfg = Release|Any CPU
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0}.Release|x86.Build.0 = Release|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Debug|x86.Build.0 = Debug|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Release|Any CPU.Build.0 = Release|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Release|x86.ActiveCfg = Release|Any CPU
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5}.Release|x86.Build.0 = Release|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Debug|x86.ActiveCfg = Debug|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Debug|x86.Build.0 = Debug|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Release|Any CPU.Build.0 = Release|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Release|x86.ActiveCfg = Release|Any CPU
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {7DC9BFB3-8F43-437D-81E2-BE540A017E70} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {6F1BD5E2-8195-40AD-85B5-CF1BFB3CCE7F} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {637C4B18-56BE-4E75-A7CD-7B79C489D33C} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {07EC4968-EE0B-4EA9-9ED8-165CED3BB62B} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {38DDAE6D-0D1D-40D6-BF57-CAFED0322222} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {49C746F1-53F4-433C-ABE0-1938D8B508B2} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {91212914-7EAF-4FC7-88E8-5C8ED9A9DB4A} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {F966402C-3F18-4FC4-B5E6-8049C79614B8} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {D07BC865-AD15-4859-AEA7-C58389DAB1F0} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {CE027ADF-C798-4989-B42C-BB571EBDAB03} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {40F6A888-F5E2-4B1E-8913-1E8ED3E6621E} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {DA92D3F1-CCA8-45EA-BB95-74F0158E76C5} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {477A33C0-33EE-4176-BA3F-7EF56B46A811} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {C04A5FDD-89B4-43EC-9E1F-F82238DFFCA0} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {E044B08C-477E-4ED9-9E70-8E5C6F47E9D5} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- {3BBDC1BE-E4E3-40AA-B5B8-3C7A078985DB} = {211BCB83-5603-4B9F-855D-F383FF68278A}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {1E9DBCC0-68AB-41C0-80C9-0848F7FE65A6}
- EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\EnterpriseLibrary.ExceptionHandling.5.0.505.0\lib\NET35;packages\Unity.2.1.505.2\lib\NET35;packages\Unity.Interception.2.1.505.2\lib\NET35
- EndGlobalSection
-EndGlobal
diff --git a/Examples.slnx b/Examples.slnx
new file mode 100644
index 0000000..1ba0db1
--- /dev/null
+++ b/Examples.slnx
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NuGet.Config b/NuGet.Config
deleted file mode 100644
index 69355ae..0000000
--- a/NuGet.Config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 49816d4..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-image:
-- Visual Studio 2022
-- Ubuntu
-- macOS
-
-configuration: Release
-
-environment:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
- NUGET_XMLDOC_MODE: skip
-
-skip_tags: true
-
-clone_depth: 1
-
-test: false
-
-build_script:
-- pwsh: .\build.ps1
diff --git a/build.ps1 b/build.ps1
deleted file mode 100644
index 6cccff0..0000000
--- a/build.ps1
+++ /dev/null
@@ -1,43 +0,0 @@
-########################
-# THE BUILD!
-########################
-
-Push-Location $PSScriptRoot
-try {
- Import-Module $PSScriptRoot/build/Autofac.Build.psd1 -Force
-
- $globalJson = (Get-Content "$PSScriptRoot/global.json" | ConvertFrom-Json -NoEnumerate);
-
- $sdkVersion = $globalJson.sdk.version
-
- # Install dotnet SDK versions during CI. In a local build we assume you have
- # everything installed; on CI we'll force the install. If you install _any_
- # SDKs, you have to install _all_ of them because you can't install SDKs in
- # two different locations. dotnet CLI locates SDKs relative to the
- # executable.
- if ($Null -ne $env:APPVEYOR_BUILD_NUMBER) {
- Install-DotNetCli -Version $sdkVersion
- foreach ($additional in $globalJson.additionalSdks)
- {
- Install-DotNetCli -Version $additional;
- }
- }
-
- # Write out dotnet information
- & dotnet --info
-
- # Build/package
- Write-Message "Building projects"
- &dotnet build $PSScriptRoot\Examples.sln
- if ($NULL -eq $env:APPVEYOR_BUILD_NUMBER -and $IsWindows) {
- # Only build the Service Fabric demo when it's not AppVeyor and the current environment is Windows.
- nuget restore $PSScriptRoot\src\ServiceFabricDemo\AutofacServiceFabricDemo.sln
- msbuild $PSScriptRoot\src\ServiceFabricDemo\AutofacServiceFabricDemo.sln /t:Rebuild /verbosity:Minimal /p:Configuration=Release /p:Platform=x64
- }
-
- # Finished
- Write-Message "Build finished"
-}
-finally {
- Pop-Location
-}
diff --git a/build/Autofac.Build.psd1 b/build/Autofac.Build.psd1
deleted file mode 100644
index 8a5bfac..0000000
--- a/build/Autofac.Build.psd1
+++ /dev/null
@@ -1,15 +0,0 @@
-@{
- RootModule = '.\Autofac.Build.psm1'
- ModuleVersion = '0.3.0'
- GUID = '55d3f738-f48f-4497-9b2c-ecd90ec1f978'
- Author = 'Autofac Contributors'
- CompanyName = 'Autofac'
- Description = 'Build support for Autofac projects.'
- FunctionsToExport = '*'
- CmdletsToExport = '*'
- VariablesToExport = '*'
- AliasesToExport = '*'
- ModuleList = @()
- FileList = @()
- PrivateData = ''
-}
diff --git a/build/Autofac.Build.psm1 b/build/Autofac.Build.psm1
deleted file mode 100644
index d61358b..0000000
--- a/build/Autofac.Build.psm1
+++ /dev/null
@@ -1,257 +0,0 @@
-# EXIT CODES
-# 1: dotnet packaging failure
-# 2: dotnet publishing failure
-# 3: Unit test failure
-# 4: dotnet / NuGet package restore failure
-
-<#
-.SYNOPSIS
- Gets the set of directories in which projects are available for compile/processing.
-
-.PARAMETER RootPath
- Path where searching for project directories should begin.
-#>
-function Get-DotNetProjectDirectory {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $False)]
- [ValidateNotNullOrEmpty()]
- [string]
- $RootPath
- )
-
- Get-ChildItem -Path $RootPath -Recurse -Include "*.csproj" | Select-Object @{ Name = "ParentFolder"; Expression = { $_.Directory.FullName.TrimEnd("\") } } | Select-Object -ExpandProperty ParentFolder
-}
-
-<#
-.SYNOPSIS
- Runs the dotnet CLI install script from GitHub to install a project-local
- copy of the CLI.
-#>
-function Install-DotNetCli {
- [CmdletBinding()]
- Param(
- [string]
- $Version = "Latest"
- )
- Write-Message "Installing .NET SDK version $Version"
-
- $callerPath = Split-Path $MyInvocation.PSCommandPath
- $installDir = Join-Path -Path $callerPath -ChildPath ".dotnet/cli"
- if (!(Test-Path $installDir)) {
- New-Item -ItemType Directory -Path "$installDir" | Out-Null
- }
-
- # Download the dotnet CLI install script
- if ($IsWindows) {
- if (!(Test-Path ./.dotnet/dotnet-install.ps1)) {
- Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./.dotnet/dotnet-install.ps1"
- }
-
- & ./.dotnet/dotnet-install.ps1 -InstallDir "$installDir" -Version $Version
- } else {
- if (!(Test-Path ./.dotnet/dotnet-install.sh)) {
- Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./.dotnet/dotnet-install.sh"
- }
-
- & bash ./.dotnet/dotnet-install.sh --install-dir "$installDir" --version $Version
- }
-
- Add-Path "$installDir"
-}
-
-<#
-.SYNOPSIS
- Appends a given value to the path but only if the value does not yet exist within the path.
-.PARAMETER Path
- The path to append.
-#>
-function Add-Path {
- [CmdletBinding()]
- Param(
- [ValidateNotNullOrEmpty()]
- [string]
- $Path
- )
-
- $pathSeparator = ":";
-
- if ($IsWindows) {
- $pathSeparator = ";";
- }
-
- $pathValues = $env:PATH.Split($pathSeparator);
- if ($pathValues -Contains $Path) {
- return;
- }
-
- $env:PATH = "${Path}${pathSeparator}$env:PATH"
-}
-
-<#
-.SYNOPSIS
- Builds a project using dotnet cli.
-.DESCRIPTION
- Builds a project in a specified directory using the dotnet cli.
-.PARAMETER DirectoryName
- The path to the directory containing the project to build.
-#>
-function Invoke-DotNetBuild {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process {
- foreach ($Project in $ProjectDirectory) {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release
- if ($LASTEXITCODE -ne 0) {
- exit 1
- }
- }
- }
-}
-
-<#
-.SYNOPSIS
- Invokes the dotnet utility to package a project.
-
-.PARAMETER ProjectDirectory
- Path to the directory containing the project to package.
-
-.PARAMETER PackagesPath
- Path to the "artifacts/packages" folder where packages should go.
-
-.PARAMETER VersionSuffix
- The version suffix to use for the NuGet package version.
-#>
-function Invoke-DotNetPack {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory,
-
- [Parameter(Mandatory = $True, ValueFromPipeline = $False)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo]
- $PackagesPath,
-
- [Parameter(Mandatory = $True, ValueFromPipeline = $False)]
- [AllowEmptyString()]
- [string]
- $VersionSuffix
- )
- Begin {
- New-Item -Path $PackagesPath -ItemType Directory -Force | Out-Null
- }
- Process {
- foreach ($Project in $ProjectDirectory) {
- if ($VersionSuffix -eq "") {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release
- }
- else {
- & dotnet build ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix
- }
- if ($LASTEXITCODE -ne 0) {
- exit 1
- }
-
- if ($VersionSuffix -eq "") {
- & dotnet pack ("""" + $Project.FullName + """") --configuration Release --output $PackagesPath
- }
- else {
- & dotnet pack ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix --output $PackagesPath
- }
- if ($LASTEXITCODE -ne 0) {
- exit 1
- }
- }
- }
-}
-
-<#
-.SYNOPSIS
- Invokes dotnet test command.
-
-.PARAMETER ProjectDirectory
- Path to the directory containing the project to package.
-#>
-function Invoke-Test {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process {
- foreach ($Project in $ProjectDirectory) {
- Push-Location $Project
-
- & dotnet test `
- --configuration Release `
- --logger:trx `
- /p:CollectCoverage=true `
- /p:CoverletOutput="../../artifacts/coverage/$($Project.Name)/" `
- /p:CoverletOutputFormat="json%2clcov" `
- /p:ExcludeByAttribute=CompilerGeneratedAttribute `
- /p:ExcludeByAttribute=GeneratedCodeAttribute `
- /p:Exclude="[Autofac.Test.Scenarios.ScannedAssembly]*"
-
- if ($LASTEXITCODE -ne 0) {
- Pop-Location
- exit 3
- }
-
- Pop-Location
- }
- }
-}
-
-<#
-.SYNOPSIS
- Restores dependencies using the dotnet utility.
-
-.PARAMETER ProjectDirectory
- Path to the directory containing the project with dependencies to restore.
-#>
-function Restore-DependencyPackages {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
- [ValidateNotNull()]
- [System.IO.DirectoryInfo[]]
- $ProjectDirectory
- )
- Process {
- foreach ($Project in $ProjectDirectory) {
- & dotnet restore ("""" + $Project.FullName + """") --no-cache
- if ($LASTEXITCODE -ne 0) {
- exit 4
- }
- }
- }
-}
-
-<#
-.SYNOPSIS
- Writes a build progress message to the host.
-
-.PARAMETER Message
- The message to write.
-#>
-function Write-Message {
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory = $True, ValueFromPipeline = $False, ValueFromPipelineByPropertyName = $False)]
- [ValidateNotNullOrEmpty()]
- [string]
- $Message
- )
-
- Write-Host "[BUILD] $Message" -ForegroundColor Cyan
-}
diff --git a/global.json b/global.json
index 29e23da..513d0b4 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,6 @@
-{
- "sdk": {
- "rollForward": "latestFeature",
- "version": "6.0.403"
- },
- "additionalSdks": [
- "3.1.425"
- ]
-}
+{
+ "sdk": {
+ "rollForward": "latestFeature",
+ "version": "10.0.203"
+ }
+}
diff --git a/src/AspNetCore3ChildLifetimeScope/ApplicationAStartup.cs b/src/AspNetCore3ChildLifetimeScope/ApplicationAStartup.cs
deleted file mode 100644
index cf011bf..0000000
--- a/src/AspNetCore3ChildLifetimeScope/ApplicationAStartup.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using AspNetCore3ChildLifetimeScope.Services;
-using Autofac;
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3ChildLifetimeScope
-{
- public class ApplicationAStartup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddControllers();
- }
-
- public void Configure(IApplicationBuilder app)
- {
- app.UseRouting();
-
- app.UseEndpoints(builder => builder.MapControllers());
- }
-
- ///
- /// This method is called by the since we are registering for Host A.
- ///
- /// An adapter that can take several registrations for the scope used in Application A.
- public void ConfigureContainer(AutofacChildLifetimeScopeConfigurationAdapter configurationAdapter)
- {
- // You must use an AutofacChildLifetimeScopeConfigurationAdapter
- // here instead of a ContainerBuilder.
- configurationAdapter.Add(
- builder => builder
- .RegisterType()
- .AsSelf()
- .InstancePerLifetimeScope()
- );
- }
- }
-}
diff --git a/src/AspNetCore3ChildLifetimeScope/ApplicationBStartup.cs b/src/AspNetCore3ChildLifetimeScope/ApplicationBStartup.cs
deleted file mode 100644
index a49ec61..0000000
--- a/src/AspNetCore3ChildLifetimeScope/ApplicationBStartup.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using AspNetCore3ChildLifetimeScope.Services;
-using Autofac;
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3ChildLifetimeScope
-{
- public class ApplicationBStartup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddControllers();
- }
-
- public void Configure(IApplicationBuilder app)
- {
- app.UseRouting();
-
- app.UseEndpoints(builder => builder.MapControllers());
- }
-
- ///
- /// This method is called by the since we are registering for Host B.
- ///
- /// An adapter that can take several registrations for the scope used in Application B.
- public void ConfigureContainer(AutofacChildLifetimeScopeConfigurationAdapter configurationAdapter)
- {
- // You must use an AutofacChildLifetimeScopeConfigurationAdapter
- // here instead of a ContainerBuilder.
- configurationAdapter.Add(
- builder => builder
- .RegisterType()
- .AsSelf()
- .InstancePerLifetimeScope()
- );
- }
- }
-}
diff --git a/src/AspNetCore3ChildLifetimeScope/AspNetCore3ChildLifetimeScope.csproj b/src/AspNetCore3ChildLifetimeScope/AspNetCore3ChildLifetimeScope.csproj
deleted file mode 100644
index 5fd98bb..0000000
--- a/src/AspNetCore3ChildLifetimeScope/AspNetCore3ChildLifetimeScope.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- netcoreapp3.1
-
-
-
-
-
-
-
-
diff --git a/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationAController.cs b/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationAController.cs
deleted file mode 100644
index 3b6e9cf..0000000
--- a/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationAController.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using AspNetCore3ChildLifetimeScope.Services;
-using Autofac;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3ChildLifetimeScope.Controllers
-{
- [ApiController]
- [Route("api/[controller]")]
- public class ApplicationAController : ControllerBase
- {
- private readonly ApplicationAScopedDependency _applicationAScopedDependency;
- private readonly TransientChildScopeDependency _transientRootChildScopeDependency;
- private readonly SingletonRootDependency _singletonRootDependency;
-
- public ApplicationAController(
- ApplicationAScopedDependency applicationAScopedDependency,
- TransientChildScopeDependency transientRootChildScopeDependency,
- SingletonRootDependency singletonRootDependency)
- {
- _applicationAScopedDependency = applicationAScopedDependency;
- _transientRootChildScopeDependency = transientRootChildScopeDependency;
- _singletonRootDependency = singletonRootDependency;
- }
-
- [HttpGet]
- public IActionResult ShowMessage() => Ok(new
- {
- Message =
- $"Resolved {nameof(ApplicationAScopedDependency)} from application-container. Resolved {nameof(TransientChildScopeDependency)} from {nameof(ILifetimeScope)} passed to the {nameof(IHost)}. Resolved {nameof(SingletonRootDependency)} from the container itself.",
- ApplicationBScopedDependency = _applicationAScopedDependency.ToString(),
- TransientRootChildScopeDependency = _transientRootChildScopeDependency.ToString(),
- TransientRootDependency = _singletonRootDependency.ToString(),
- });
- }
-}
diff --git a/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationBController.cs b/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationBController.cs
deleted file mode 100644
index a401fa1..0000000
--- a/src/AspNetCore3ChildLifetimeScope/Controllers/ApplicationBController.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using AspNetCore3ChildLifetimeScope.Services;
-using Autofac;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3ChildLifetimeScope.Controllers
-{
- [ApiController]
- [Route("api/[controller]")]
- public class ApplicationBController : ControllerBase
- {
- private readonly ApplicationBScopedDependency _applicationBScopedDependency;
- private readonly TransientChildScopeDependency _transientChildScopeDependency;
- private readonly SingletonRootDependency _singletonRootDependency;
-
- public ApplicationBController(
- ApplicationBScopedDependency applicationBScopedDependency,
- TransientChildScopeDependency transientChildScopeDependency,
- SingletonRootDependency singletonRootDependency)
- {
- _applicationBScopedDependency = applicationBScopedDependency;
- _transientChildScopeDependency = transientChildScopeDependency;
- _singletonRootDependency = singletonRootDependency;
- }
-
- [HttpGet]
- public IActionResult ShowMessage() => Ok(new
- {
- Message =
- $"Resolved {nameof(ApplicationBScopedDependency)} from application-container. Resolved {nameof(TransientChildScopeDependency)} from {nameof(ILifetimeScope)} passed to the {nameof(IHost)}. Resolved {nameof(SingletonRootDependency)} from the container itself.",
- ApplicationBScopedDependency = _applicationBScopedDependency.ToString(),
- TransientRootChildScopeDependency = _transientChildScopeDependency.ToString(),
- TransientRootDependency = _singletonRootDependency.ToString(),
- });
- }
-}
diff --git a/src/AspNetCore3ChildLifetimeScope/Program.cs b/src/AspNetCore3ChildLifetimeScope/Program.cs
deleted file mode 100644
index 376d1cd..0000000
--- a/src/AspNetCore3ChildLifetimeScope/Program.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System.Threading.Tasks;
-using AspNetCore3ChildLifetimeScope.Services;
-using Autofac;
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3ChildLifetimeScope
-{
- public static class Program
- {
- public static async Task Main(string[] args)
- {
- var containerBuilder = new ContainerBuilder();
-
- containerBuilder.RegisterType()
- .AsSelf()
- .SingleInstance();
-
- var container = containerBuilder.Build();
-
- await using var scopeApplicationA = container.BeginLifetimeScope("ScopeApplicationA", builder =>
- builder.RegisterType().AsSelf().InstancePerDependency());
-
- await using var scopeApplicationB = container.BeginLifetimeScope("ScopeApplicationB", builder =>
- builder.RegisterType().AsSelf().InstancePerDependency());
-
- using var hostApplicationA = CreateHostForApplicationA(scopeApplicationA, args);
-
- using var hostApplicationB = CreateHostForApplicationB(scopeApplicationB, args);
-
- await Task.WhenAll(hostApplicationA.RunAsync(), hostApplicationB.RunAsync());
- }
-
- private static IHost CreateHostForApplicationA(ILifetimeScope scope, string[] args)
- {
- // This shows how each application can use a separate lifetime scope
- // as the "root" for the application, whilst sharing a common container
- // for common dependencies. Each application can get app-specific
- // dependencies, but common items can be registered outside the app.
-
- return Host.CreateDefaultBuilder(args)
- .UseServiceProviderFactory(new AutofacChildLifetimeScopeServiceProviderFactory(scope))
- .ConfigureWebHostDefaults(builder => builder.UseStartup().UseUrls("http://localhost:5000"))
- .Build();
- }
-
- private static IHost CreateHostForApplicationB(ILifetimeScope scope, string[] args)
- {
- // This shows how each application can use a separate lifetime scope
- // as the "root" for the application, whilst sharing a common container
- // for common dependencies. Each application can get app-specific
- // dependencies, but common items can be registered outside the app.
-
- return Host.CreateDefaultBuilder(args)
- .UseServiceProviderFactory(new AutofacChildLifetimeScopeServiceProviderFactory(scope))
- .ConfigureWebHostDefaults(builder => builder.UseStartup().UseUrls("http://localhost:5001"))
- .Build();
- }
- }
-}
diff --git a/src/AspNetCore3Example/AspNetCore3Example.csproj b/src/AspNetCore3Example/AspNetCore3Example.csproj
deleted file mode 100644
index 581a717..0000000
--- a/src/AspNetCore3Example/AspNetCore3Example.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- netcoreapp3.1
-
-
-
-
-
-
diff --git a/src/AspNetCore3Example/AutofacModule.cs b/src/AspNetCore3Example/AutofacModule.cs
deleted file mode 100644
index 92fd9e6..0000000
--- a/src/AspNetCore3Example/AutofacModule.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using AspNetCore3Example.Services;
-using Autofac;
-using Microsoft.Extensions.Logging;
-
-namespace AspNetCore3Example
-{
- public class AutofacModule : Module
- {
- protected override void Load(ContainerBuilder builder)
- {
- // The generic ILogger service was added to the ServiceCollection by ASP.NET Core.
- // It was then registered with Autofac using the Populate method. All of this starts
- // with the `UseServiceProviderFactory(new AutofacServiceProviderFactory())` that happens in Program and registers Autofac
- // as the service provider.
- builder.Register(c => new ValuesService(c.Resolve>()))
- .As()
- .InstancePerLifetimeScope();
- }
- }
-}
diff --git a/src/AspNetCore3Example/Controllers/ValuesController.cs b/src/AspNetCore3Example/Controllers/ValuesController.cs
deleted file mode 100644
index bb97e85..0000000
--- a/src/AspNetCore3Example/Controllers/ValuesController.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Generic;
-using AspNetCore3Example.Services;
-using Microsoft.AspNetCore.Mvc;
-
-namespace AspNetCore3Example.Controllers
-{
- ///
- /// Simple REST API controller that shows Autofac injecting dependencies.
- ///
- ///
- [ApiController]
- [Route("api/[controller]")]
- public class ValuesController : ControllerBase
- {
- private readonly IValuesService _valuesService;
-
- public ValuesController(IValuesService valuesService)
- {
- _valuesService = valuesService;
- }
-
- // GET api/values
- [HttpGet]
- public IEnumerable Get()
- {
- return _valuesService.FindAll();
- }
-
- // GET api/values/5
- [HttpGet("{id}")]
- public string Get(int id)
- {
- return _valuesService.Find(id);
- }
- }
-}
diff --git a/src/AspNetCore3Example/Program.cs b/src/AspNetCore3Example/Program.cs
deleted file mode 100644
index b1f4af6..0000000
--- a/src/AspNetCore3Example/Program.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Threading.Tasks;
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-
-namespace AspNetCore3Example
-{
- public class Program
- {
- public static async Task Main(string[] args)
- {
- // The `UseServiceProviderFactory(new AutofacServiceProviderFactory())` call here allows for
- // ConfigureContainer to be supported in Startup with
- // a strongly-typed ContainerBuilder. If you don't
- // have the call to AddAutofac here, you won't get
- // ConfigureContainer support. This also automatically
- // calls Populate to put services you register during
- // ConfigureServices into Autofac.
- var host = Host.CreateDefaultBuilder(args)
- .UseServiceProviderFactory(new AutofacServiceProviderFactory())
- .ConfigureWebHostDefaults(webHostBuilder => webHostBuilder.UseStartup())
- .Build();
-
- await host.RunAsync();
- }
- }
-}
diff --git a/src/AspNetCore3Example/Properties/launchSettings.json b/src/AspNetCore3Example/Properties/launchSettings.json
deleted file mode 100644
index 84a75cc..0000000
--- a/src/AspNetCore3Example/Properties/launchSettings.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "iisSettings": {
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:38305/",
- "sslPort": 0
- },
- "windowsAuthentication": false
- },
- "profiles": {
- "AspNetCore3Example": {
- "commandName": "Project",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "launchBrowser": true,
- "launchUrl": "http://localhost:5000/api/values"
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "launchBrowser": true,
- "launchUrl": "api/values"
- }
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCore3Example/Services/IValuesService.cs b/src/AspNetCore3Example/Services/IValuesService.cs
deleted file mode 100644
index dfe00fb..0000000
--- a/src/AspNetCore3Example/Services/IValuesService.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-
-namespace AspNetCore3Example.Services
-{
- public interface IValuesService
- {
- IEnumerable FindAll();
-
- string Find(int id);
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCore3Example/Services/ValuesService.cs b/src/AspNetCore3Example/Services/ValuesService.cs
deleted file mode 100644
index fe669bf..0000000
--- a/src/AspNetCore3Example/Services/ValuesService.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Collections.Generic;
-using Microsoft.Extensions.Logging;
-
-namespace AspNetCore3Example.Services
-{
- public class ValuesService : IValuesService
- {
- private readonly ILogger _logger;
-
- public ValuesService(ILogger logger)
- {
- _logger = logger;
- }
-
- public IEnumerable FindAll()
- {
- _logger.LogDebug("{method} called", nameof(this.FindAll));
-
- return new[] { "value1", "value2" };
- }
-
- public string Find(int id)
- {
- _logger.LogDebug("{method} called with {id}", nameof(this.Find), id);
-
- return $"value{id}";
- }
- }
-}
diff --git a/src/AspNetCore3Example/Startup.cs b/src/AspNetCore3Example/Startup.cs
deleted file mode 100644
index 3bbf838..0000000
--- a/src/AspNetCore3Example/Startup.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using Autofac;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace AspNetCore3Example
-{
- // ASP.NET Core docs for Autofac are here:
- // https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html
- public class Startup
- {
- public void Configure(IApplicationBuilder app)
- {
- app.UseRouting();
- app.UseEndpoints(builder => builder.MapControllers());
- }
-
- public void ConfigureContainer(ContainerBuilder builder)
- {
- // Add any Autofac modules or registrations.
- // This is called AFTER ConfigureServices so things you
- // register here OVERRIDE things registered in ConfigureServices.
- //
- // You must have the call to `UseServiceProviderFactory(new AutofacServiceProviderFactory())`
- // when building the host or this won't be called.
- builder.RegisterModule(new AutofacModule());
-
- // If you want to enable diagnostics, you can do that via a build
- // callback. Diagnostics aren't free, so you shouldn't just do this
- // by default. Note: since you're diagnosing the container you can't
- // ALSO resolve the logger to which the diagnostics get written, so
- // writing directly to the log destination is the way to go.
- /*
- var tracer = new DefaultDiagnosticTracer();
- tracer.OperationCompleted += (sender, args) =>
- {
- Console.WriteLine(args.TraceContent);
- };
-
- builder.RegisterBuildCallback(c =>
- {
- var container = c as IContainer;
- container.SubscribeToDiagnostics(tracer);
- });
- */
- }
-
- public void ConfigureServices(IServiceCollection services)
- {
- // Use extensions from libraries to register services in the
- // collection. These will be automatically added to the
- // Autofac container.
- services.AddControllers();
- }
- }
-}
diff --git a/src/AspNetCore3Example/appsettings.json b/src/AspNetCore3Example/appsettings.json
deleted file mode 100644
index 8a5b8de..0000000
--- a/src/AspNetCore3Example/appsettings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Logging": {
- "IncludeScopes": false,
- "LogLevel": {
- "Default": "Debug",
- "Microsoft": "Information",
- "System": "Information"
- }
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCore3NoStartupExample/AspNetCore3NoStartupExample.csproj b/src/AspNetCore3NoStartupExample/AspNetCore3NoStartupExample.csproj
deleted file mode 100644
index 581a717..0000000
--- a/src/AspNetCore3NoStartupExample/AspNetCore3NoStartupExample.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- netcoreapp3.1
-
-
-
-
-
-
diff --git a/src/AspNetCore3NoStartupExample/AutofacModule.cs b/src/AspNetCore3NoStartupExample/AutofacModule.cs
deleted file mode 100644
index f94ce1b..0000000
--- a/src/AspNetCore3NoStartupExample/AutofacModule.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using AspNetCore3NoStartupExample.Services;
-using Autofac;
-using Microsoft.Extensions.Logging;
-
-namespace AspNetCore3NoStartupExample
-{
- public class AutofacModule : Module
- {
- protected override void Load(ContainerBuilder builder)
- {
- // The generic ILogger service was added to the ServiceCollection by ASP.NET Core.
- // It was then registered with Autofac using the Populate method. All of this starts
- // with the `UseServiceProviderFactory(new AutofacServiceProviderFactory())` that happens in Program and registers Autofac
- // as the service provider.
- builder.Register(c => new ValuesService(c.Resolve>()))
- .As()
- .InstancePerLifetimeScope();
- }
- }
-}
diff --git a/src/AspNetCore3NoStartupExample/Controllers/ValuesController.cs b/src/AspNetCore3NoStartupExample/Controllers/ValuesController.cs
deleted file mode 100644
index 3c12a57..0000000
--- a/src/AspNetCore3NoStartupExample/Controllers/ValuesController.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Generic;
-using AspNetCore3NoStartupExample.Services;
-using Microsoft.AspNetCore.Mvc;
-
-namespace AspNetCore3NoStartupExample.Controllers
-{
- ///
- /// Simple REST API controller that shows Autofac injecting dependencies.
- ///
- ///
- [ApiController]
- [Route("api/[controller]")]
- public class ValuesController : ControllerBase
- {
- private readonly IValuesService _valuesService;
-
- public ValuesController(IValuesService valuesService)
- {
- _valuesService = valuesService;
- }
-
- // GET api/values
- [HttpGet]
- public IEnumerable Get()
- {
- return _valuesService.FindAll();
- }
-
- // GET api/values/5
- [HttpGet("{id}")]
- public string Get(int id)
- {
- return _valuesService.Find(id);
- }
- }
-}
diff --git a/src/AspNetCore3NoStartupExample/Program.cs b/src/AspNetCore3NoStartupExample/Program.cs
deleted file mode 100644
index 1975433..0000000
--- a/src/AspNetCore3NoStartupExample/Program.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System.Threading.Tasks;
-using Autofac;
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace AspNetCore3NoStartupExample
-{
- public class Program
- {
- public static async Task Main(string[] args)
- {
- // The example here is exactly the same as AspNetCore3Example, but this
- // shows how you'd use the AutofacServiceProviderFactory and container
- // configuration when you don't have a Startup class. The
- // GenericHostBuilderExample shows how you do this when it's generic
- // hosted services and not ASP.NET Core.
- var host = Host.CreateDefaultBuilder(args)
- .UseServiceProviderFactory(new AutofacServiceProviderFactory())
- .ConfigureWebHostDefaults(webHostBuilder =>
- {
- webHostBuilder.Configure(app =>
- {
- app.UseRouting();
- app.UseEndpoints(builder => builder.MapControllers());
- });
-
- webHostBuilder.ConfigureServices(services => services.AddControllers());
- })
- .ConfigureContainer(builder => builder.RegisterModule(new AutofacModule()))
- .Build();
-
- await host.RunAsync();
- }
- }
-}
diff --git a/src/AspNetCore3NoStartupExample/Properties/launchSettings.json b/src/AspNetCore3NoStartupExample/Properties/launchSettings.json
deleted file mode 100644
index 6d8dd8d..0000000
--- a/src/AspNetCore3NoStartupExample/Properties/launchSettings.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "iisSettings": {
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:38305/",
- "sslPort": 0
- },
- "windowsAuthentication": false
- },
- "profiles": {
- "AspNetCore3NoStartupExample": {
- "commandName": "Project",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "launchBrowser": true,
- "launchUrl": "http://localhost:5000/api/values"
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "launchBrowser": true,
- "launchUrl": "api/values"
- }
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCore3NoStartupExample/Services/IValuesService.cs b/src/AspNetCore3NoStartupExample/Services/IValuesService.cs
deleted file mode 100644
index f5c1a89..0000000
--- a/src/AspNetCore3NoStartupExample/Services/IValuesService.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System.Collections.Generic;
-
-namespace AspNetCore3NoStartupExample.Services
-{
- public interface IValuesService
- {
- IEnumerable FindAll();
-
- string Find(int id);
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCore3NoStartupExample/Services/ValuesService.cs b/src/AspNetCore3NoStartupExample/Services/ValuesService.cs
deleted file mode 100644
index ce2c416..0000000
--- a/src/AspNetCore3NoStartupExample/Services/ValuesService.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System.Collections.Generic;
-using Microsoft.Extensions.Logging;
-
-namespace AspNetCore3NoStartupExample.Services
-{
- public class ValuesService : IValuesService
- {
- private readonly ILogger _logger;
-
- public ValuesService(ILogger logger)
- {
- _logger = logger;
- }
-
- public IEnumerable FindAll()
- {
- _logger.LogDebug("{method} called", nameof(this.FindAll));
-
- return new[] { "value1", "value2" };
- }
-
- public string Find(int id)
- {
- _logger.LogDebug("{method} called with {id}", nameof(this.Find), id);
-
- return $"value{id}";
- }
- }
-}
diff --git a/src/AspNetCore3NoStartupExample/appsettings.json b/src/AspNetCore3NoStartupExample/appsettings.json
deleted file mode 100644
index 8a5b8de..0000000
--- a/src/AspNetCore3NoStartupExample/appsettings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Logging": {
- "IncludeScopes": false,
- "LogLevel": {
- "Default": "Debug",
- "Microsoft": "Information",
- "System": "Information"
- }
- }
-}
\ No newline at end of file
diff --git a/src/AspNetCoreChildLifetimeScope/ApplicationAStartup.cs b/src/AspNetCoreChildLifetimeScope/ApplicationAStartup.cs
new file mode 100644
index 0000000..c3fb233
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/ApplicationAStartup.cs
@@ -0,0 +1,34 @@
+using AspNetCoreChildLifetimeScope.Services;
+using Autofac;
+using Autofac.Extensions.DependencyInjection;
+
+namespace AspNetCoreChildLifetimeScope;
+
+public class ApplicationAStartup
+{
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddControllers();
+ }
+
+ public void Configure(IApplicationBuilder app)
+ {
+ app.UseRouting();
+ app.UseEndpoints(builder => builder.MapControllers());
+ }
+
+ ///
+ /// When using AutofacChildLifetimeScopeServiceProviderFactory, the
+ /// ConfigureContainer method receives an adapter instead of a
+ /// ContainerBuilder. The adapter collects registrations that will be
+ /// applied to the child lifetime scope for this application.
+ ///
+ public void ConfigureContainer(AutofacChildLifetimeScopeConfigurationAdapter configurationAdapter)
+ {
+ configurationAdapter.Add(
+ builder => builder
+ .RegisterType()
+ .AsSelf()
+ .InstancePerLifetimeScope());
+ }
+}
diff --git a/src/AspNetCoreChildLifetimeScope/ApplicationBStartup.cs b/src/AspNetCoreChildLifetimeScope/ApplicationBStartup.cs
new file mode 100644
index 0000000..b7c6ac5
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/ApplicationBStartup.cs
@@ -0,0 +1,28 @@
+using AspNetCoreChildLifetimeScope.Services;
+using Autofac;
+using Autofac.Extensions.DependencyInjection;
+
+namespace AspNetCoreChildLifetimeScope;
+
+public class ApplicationBStartup
+{
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddControllers();
+ }
+
+ public void Configure(IApplicationBuilder app)
+ {
+ app.UseRouting();
+ app.UseEndpoints(builder => builder.MapControllers());
+ }
+
+ public void ConfigureContainer(AutofacChildLifetimeScopeConfigurationAdapter configurationAdapter)
+ {
+ configurationAdapter.Add(
+ builder => builder
+ .RegisterType()
+ .AsSelf()
+ .InstancePerLifetimeScope());
+ }
+}
diff --git a/src/AspNetCoreChildLifetimeScope/AspNetCoreChildLifetimeScope.csproj b/src/AspNetCoreChildLifetimeScope/AspNetCoreChildLifetimeScope.csproj
new file mode 100644
index 0000000..7942b78
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/AspNetCoreChildLifetimeScope.csproj
@@ -0,0 +1,12 @@
+
+
+
+ net10.0
+ enable
+
+
+
+
+
+
+
diff --git a/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationAController.cs b/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationAController.cs
new file mode 100644
index 0000000..286dc30
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationAController.cs
@@ -0,0 +1,34 @@
+using AspNetCoreChildLifetimeScope.Services;
+using Autofac;
+using Microsoft.AspNetCore.Mvc;
+
+namespace AspNetCoreChildLifetimeScope.Controllers;
+
+[ApiController]
+[Route("api/[controller]")]
+public class ApplicationAController : ControllerBase
+{
+ private readonly ApplicationAScopedDependency _applicationAScopedDependency;
+ private readonly TransientChildScopeDependency _transientRootChildScopeDependency;
+ private readonly SingletonRootDependency _singletonRootDependency;
+
+ public ApplicationAController(
+ ApplicationAScopedDependency applicationAScopedDependency,
+ TransientChildScopeDependency transientRootChildScopeDependency,
+ SingletonRootDependency singletonRootDependency)
+ {
+ _applicationAScopedDependency = applicationAScopedDependency;
+ _transientRootChildScopeDependency = transientRootChildScopeDependency;
+ _singletonRootDependency = singletonRootDependency;
+ }
+
+ [HttpGet]
+ public IActionResult ShowMessage() => Ok(new
+ {
+ Message =
+ $"Resolved {nameof(ApplicationAScopedDependency)} from application-container. Resolved {nameof(TransientChildScopeDependency)} from {nameof(ILifetimeScope)} passed to the {nameof(IHost)}. Resolved {nameof(SingletonRootDependency)} from the container itself.",
+ ApplicationAScopedDependency = _applicationAScopedDependency.ToString(),
+ TransientRootChildScopeDependency = _transientRootChildScopeDependency.ToString(),
+ SingletonRootDependency = _singletonRootDependency.ToString(),
+ });
+}
diff --git a/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationBController.cs b/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationBController.cs
new file mode 100644
index 0000000..201e772
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/Controllers/ApplicationBController.cs
@@ -0,0 +1,34 @@
+using AspNetCoreChildLifetimeScope.Services;
+using Autofac;
+using Microsoft.AspNetCore.Mvc;
+
+namespace AspNetCoreChildLifetimeScope.Controllers;
+
+[ApiController]
+[Route("api/[controller]")]
+public class ApplicationBController : ControllerBase
+{
+ private readonly ApplicationBScopedDependency _applicationBScopedDependency;
+ private readonly TransientChildScopeDependency _transientChildScopeDependency;
+ private readonly SingletonRootDependency _singletonRootDependency;
+
+ public ApplicationBController(
+ ApplicationBScopedDependency applicationBScopedDependency,
+ TransientChildScopeDependency transientChildScopeDependency,
+ SingletonRootDependency singletonRootDependency)
+ {
+ _applicationBScopedDependency = applicationBScopedDependency;
+ _transientChildScopeDependency = transientChildScopeDependency;
+ _singletonRootDependency = singletonRootDependency;
+ }
+
+ [HttpGet]
+ public IActionResult ShowMessage() => Ok(new
+ {
+ Message =
+ $"Resolved {nameof(ApplicationBScopedDependency)} from application-container. Resolved {nameof(TransientChildScopeDependency)} from {nameof(ILifetimeScope)} passed to the {nameof(IHost)}. Resolved {nameof(SingletonRootDependency)} from the container itself.",
+ ApplicationBScopedDependency = _applicationBScopedDependency.ToString(),
+ TransientRootChildScopeDependency = _transientChildScopeDependency.ToString(),
+ SingletonRootDependency = _singletonRootDependency.ToString(),
+ });
+}
diff --git a/src/AspNetCoreChildLifetimeScope/Program.cs b/src/AspNetCoreChildLifetimeScope/Program.cs
new file mode 100644
index 0000000..2d61229
--- /dev/null
+++ b/src/AspNetCoreChildLifetimeScope/Program.cs
@@ -0,0 +1,51 @@
+using AspNetCoreChildLifetimeScope.Services;
+using Autofac;
+using Autofac.Extensions.DependencyInjection;
+
+namespace AspNetCoreChildLifetimeScope;
+
+public static class Program
+{
+ public static async Task Main(string[] args)
+ {
+ // Build a root container with shared/singleton dependencies.
+ var containerBuilder = new ContainerBuilder();
+ containerBuilder.RegisterType()
+ .AsSelf()
+ .SingleInstance();
+
+ var container = containerBuilder.Build();
+
+ // Create child lifetime scopes for each application. Each scope
+ // can have its own registrations while sharing the root container.
+ await using var scopeApplicationA = container.BeginLifetimeScope("ScopeApplicationA", builder =>
+ builder.RegisterType().AsSelf().InstancePerDependency());
+
+ await using var scopeApplicationB = container.BeginLifetimeScope("ScopeApplicationB", builder =>
+ builder.RegisterType().AsSelf().InstancePerDependency());
+
+ using var hostApplicationA = CreateHostForApplicationA(scopeApplicationA, args);
+ using var hostApplicationB = CreateHostForApplicationB(scopeApplicationB, args);
+
+ await Task.WhenAll(hostApplicationA.RunAsync(), hostApplicationB.RunAsync());
+ }
+
+ private static IHost CreateHostForApplicationA(ILifetimeScope scope, string[] args)
+ {
+ // Each application uses a separate lifetime scope as the "root"
+ // for the application, while sharing the common container for
+ // common dependencies.
+ return Host.CreateDefaultBuilder(args)
+ .UseServiceProviderFactory(new AutofacChildLifetimeScopeServiceProviderFactory(scope))
+ .ConfigureWebHostDefaults(builder => builder.UseStartup().UseUrls("http://localhost:5000"))
+ .Build();
+ }
+
+ private static IHost CreateHostForApplicationB(ILifetimeScope scope, string[] args)
+ {
+ return Host.CreateDefaultBuilder(args)
+ .UseServiceProviderFactory(new AutofacChildLifetimeScopeServiceProviderFactory(scope))
+ .ConfigureWebHostDefaults(builder => builder.UseStartup().UseUrls("http://localhost:5001"))
+ .Build();
+ }
+}
diff --git a/src/AspNetCore3ChildLifetimeScope/Properties/launchSettings.json b/src/AspNetCoreChildLifetimeScope/Properties/launchSettings.json
similarity index 82%
rename from src/AspNetCore3ChildLifetimeScope/Properties/launchSettings.json
rename to src/AspNetCoreChildLifetimeScope/Properties/launchSettings.json
index 82e3158..8bdc88f 100644
--- a/src/AspNetCore3ChildLifetimeScope/Properties/launchSettings.json
+++ b/src/AspNetCoreChildLifetimeScope/Properties/launchSettings.json
@@ -1,6 +1,6 @@
{
"profiles": {
- "AspNetCore3ChildLifetimeScope": {
+ "AspNetCoreChildLifetimeScope": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
diff --git a/src/AspNetCore3ChildLifetimeScope/Services/ApplicationAScopedDependency.cs b/src/AspNetCoreChildLifetimeScope/Services/ApplicationAScopedDependency.cs
similarity index 80%
rename from src/AspNetCore3ChildLifetimeScope/Services/ApplicationAScopedDependency.cs
rename to src/AspNetCoreChildLifetimeScope/Services/ApplicationAScopedDependency.cs
index 4b134c5..65beb09 100644
--- a/src/AspNetCore3ChildLifetimeScope/Services/ApplicationAScopedDependency.cs
+++ b/src/AspNetCoreChildLifetimeScope/Services/ApplicationAScopedDependency.cs
@@ -1,4 +1,4 @@
-namespace AspNetCore3ChildLifetimeScope.Services
+namespace AspNetCoreChildLifetimeScope.Services
{
public class ApplicationAScopedDependency
{
diff --git a/src/AspNetCore3ChildLifetimeScope/Services/ApplicationBScopedDependency.cs b/src/AspNetCoreChildLifetimeScope/Services/ApplicationBScopedDependency.cs
similarity index 80%
rename from src/AspNetCore3ChildLifetimeScope/Services/ApplicationBScopedDependency.cs
rename to src/AspNetCoreChildLifetimeScope/Services/ApplicationBScopedDependency.cs
index ecce2da..de8d8ac 100644
--- a/src/AspNetCore3ChildLifetimeScope/Services/ApplicationBScopedDependency.cs
+++ b/src/AspNetCoreChildLifetimeScope/Services/ApplicationBScopedDependency.cs
@@ -1,4 +1,4 @@
-namespace AspNetCore3ChildLifetimeScope.Services
+namespace AspNetCoreChildLifetimeScope.Services
{
public class ApplicationBScopedDependency
{
diff --git a/src/AspNetCore3ChildLifetimeScope/Services/SingletonRootDependency.cs b/src/AspNetCoreChildLifetimeScope/Services/SingletonRootDependency.cs
similarity index 82%
rename from src/AspNetCore3ChildLifetimeScope/Services/SingletonRootDependency.cs
rename to src/AspNetCoreChildLifetimeScope/Services/SingletonRootDependency.cs
index 2e7f84a..24c2563 100644
--- a/src/AspNetCore3ChildLifetimeScope/Services/SingletonRootDependency.cs
+++ b/src/AspNetCoreChildLifetimeScope/Services/SingletonRootDependency.cs
@@ -1,4 +1,4 @@
-namespace AspNetCore3ChildLifetimeScope.Services
+namespace AspNetCoreChildLifetimeScope.Services
{
public class SingletonRootDependency
{
diff --git a/src/AspNetCore3ChildLifetimeScope/Services/TransientChildScopeDependency.cs b/src/AspNetCoreChildLifetimeScope/Services/TransientChildScopeDependency.cs
similarity index 82%
rename from src/AspNetCore3ChildLifetimeScope/Services/TransientChildScopeDependency.cs
rename to src/AspNetCoreChildLifetimeScope/Services/TransientChildScopeDependency.cs
index e822e32..4a6a589 100644
--- a/src/AspNetCore3ChildLifetimeScope/Services/TransientChildScopeDependency.cs
+++ b/src/AspNetCoreChildLifetimeScope/Services/TransientChildScopeDependency.cs
@@ -1,4 +1,4 @@
-namespace AspNetCore3ChildLifetimeScope.Services
+namespace AspNetCoreChildLifetimeScope.Services
{
public class TransientChildScopeDependency
{
diff --git a/src/AspNetCoreExample/AspNetCoreExample.csproj b/src/AspNetCoreExample/AspNetCoreExample.csproj
index 6f19c9c..7942b78 100644
--- a/src/AspNetCoreExample/AspNetCoreExample.csproj
+++ b/src/AspNetCoreExample/AspNetCoreExample.csproj
@@ -1,9 +1,12 @@
-
+
+
- net6.0
+ net10.0
+ enable
+
-
-
+
+
diff --git a/src/AspNetCoreExample/AutofacModule.cs b/src/AspNetCoreExample/AutofacModule.cs
index 8802ae1..51e1ee4 100644
--- a/src/AspNetCoreExample/AutofacModule.cs
+++ b/src/AspNetCoreExample/AutofacModule.cs
@@ -1,6 +1,5 @@
-using Autofac;
+using Autofac;
using AspNetCoreExample.Services;
-using Microsoft.Extensions.Logging;
namespace AspNetCoreExample;
@@ -8,10 +7,10 @@ public class AutofacModule : Module
{
protected override void Load(ContainerBuilder builder)
{
- // The generic ILogger service was added to the ServiceCollection by ASP.NET Core.
- // It was then registered with Autofac using the Populate method. All of this starts
- // with the services.AddAutofac() that happens in Program and registers Autofac
- // as the service provider.
+ // The generic ILogger service was added to the
+ // ServiceCollection by ASP.NET Core. It was then registered with
+ // Autofac using the Populate method, which happens automatically
+ // when using the AutofacServiceProviderFactory.
builder.Register(c => new ValuesService(c.Resolve>()))
.As()
.InstancePerLifetimeScope();
diff --git a/src/AspNetCoreExample/Controllers/ValuesController.cs b/src/AspNetCoreExample/Controllers/ValuesController.cs
index bf70192..d9c4f92 100644
--- a/src/AspNetCoreExample/Controllers/ValuesController.cs
+++ b/src/AspNetCoreExample/Controllers/ValuesController.cs
@@ -1,15 +1,11 @@
-using System.Collections.Generic;
using AspNetCoreExample.Services;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCoreExample.Controllers;
-///
-/// Simple REST API controller that shows Autofac injecting dependencies.
-///
-///
+[ApiController]
[Route("api/[controller]")]
-public class ValuesController : Controller
+public class ValuesController : ControllerBase
{
private readonly IValuesService _valuesService;
@@ -18,14 +14,12 @@ public ValuesController(IValuesService valuesService)
_valuesService = valuesService;
}
- // GET api/values
[HttpGet]
public IEnumerable Get()
{
return _valuesService.FindAll();
}
- // GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
diff --git a/src/AspNetCoreExample/Program.cs b/src/AspNetCoreExample/Program.cs
index 518c1b5..57b45ef 100644
--- a/src/AspNetCoreExample/Program.cs
+++ b/src/AspNetCoreExample/Program.cs
@@ -1,7 +1,4 @@
-using Autofac.Extensions.DependencyInjection;
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
+using Autofac.Extensions.DependencyInjection;
namespace AspNetCoreExample;
@@ -9,18 +6,14 @@ public class Program
{
public static void Main(string[] args)
{
- // The ConfigureServices call here allows for
- // ConfigureContainer to be supported in Startup with
- // a strongly-typed ContainerBuilder. If you don't
- // have the call to AddAutofac here, you won't get
- // ConfigureContainer support. This also automatically
- // calls Populate to put services you register during
- // ConfigureServices into Autofac.
- var host = WebHost.CreateDefaultBuilder(args)
- .ConfigureServices(services => services.AddAutofac())
- .UseStartup()
- .Build();
-
- host.Run();
+ // UseServiceProviderFactory enables the ConfigureContainer method
+ // in the Startup class to receive a strongly-typed ContainerBuilder.
+ // Autofac automatically calls Populate to move services registered
+ // during ConfigureServices into the Autofac container.
+ Host.CreateDefaultBuilder(args)
+ .UseServiceProviderFactory(new AutofacServiceProviderFactory())
+ .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup())
+ .Build()
+ .Run();
}
}
diff --git a/src/AspNetCoreExample/Properties/launchSettings.json b/src/AspNetCoreExample/Properties/launchSettings.json
index 02a5303..2f633c7 100644
--- a/src/AspNetCoreExample/Properties/launchSettings.json
+++ b/src/AspNetCoreExample/Properties/launchSettings.json
@@ -1,12 +1,4 @@
{
- "iisSettings": {
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:38305/",
- "sslPort": 0
- },
- "windowsAuthentication": false
- },
"profiles": {
"AspNetCoreExample": {
"commandName": "Project",
@@ -15,14 +7,6 @@
},
"launchBrowser": true,
"launchUrl": "http://localhost:5000/api/values"
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "launchBrowser": true,
- "launchUrl": "api/values"
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AspNetCoreExample/Startup.cs b/src/AspNetCoreExample/Startup.cs
index 267ff07..28581d1 100644
--- a/src/AspNetCoreExample/Startup.cs
+++ b/src/AspNetCoreExample/Startup.cs
@@ -1,8 +1,4 @@
-using Autofac;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
+using Autofac;
namespace AspNetCoreExample;
@@ -10,21 +6,19 @@ namespace AspNetCoreExample;
// https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html
public class Startup
{
- public Startup(IWebHostEnvironment env)
+ public Startup(IConfiguration configuration)
{
- var builder = new ConfigurationBuilder()
- .SetBasePath(env.ContentRootPath)
- .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
- .AddEnvironmentVariables();
- Configuration = builder.Build();
+ Configuration = configuration;
}
- public IConfigurationRoot Configuration { get; private set; }
+ public IConfiguration Configuration { get; }
- public void Configure(IApplicationBuilder app)
+ public void ConfigureServices(IServiceCollection services)
{
- app.UseRouting()
- .UseEndpoints(opt => opt.MapControllers());
+ // Use extensions from libraries to register services in the
+ // collection. These will be automatically added to the
+ // Autofac container.
+ services.AddControllers();
}
public void ConfigureContainer(ContainerBuilder builder)
@@ -32,20 +26,12 @@ public void ConfigureContainer(ContainerBuilder builder)
// Add any Autofac modules or registrations.
// This is called AFTER ConfigureServices so things you
// register here OVERRIDE things registered in ConfigureServices.
- //
- // You must have the call to AddAutofac in the Program.Main
- // method or this won't be called.
builder.RegisterModule(new AutofacModule());
}
- public void ConfigureServices(IServiceCollection services)
+ public void Configure(IApplicationBuilder app)
{
- // Use extensions from libraries to register services in the
- // collection. These will be automatically added to the
- // Autofac container.
- //
- // Note if you have this method return an IServiceProvider
- // then ConfigureContainer will not be called.
- services.AddMvc();
+ app.UseRouting();
+ app.UseEndpoints(endpoints => endpoints.MapControllers());
}
}
diff --git a/src/AspNetCoreExample/appsettings.json b/src/AspNetCoreExample/appsettings.json
index 8a5b8de..34f00ef 100644
--- a/src/AspNetCoreExample/appsettings.json
+++ b/src/AspNetCoreExample/appsettings.json
@@ -1,10 +1,8 @@
-{
+{
"Logging": {
- "IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
- "Microsoft": "Information",
- "System": "Information"
+ "Microsoft.AspNetCore": "Information"
}
}
-}
\ No newline at end of file
+}
diff --git a/src/AspNetCoreNoStartupExample/AspNetCoreNoStartupExample.csproj b/src/AspNetCoreNoStartupExample/AspNetCoreNoStartupExample.csproj
new file mode 100644
index 0000000..7942b78
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/AspNetCoreNoStartupExample.csproj
@@ -0,0 +1,12 @@
+
+
+
+ net10.0
+ enable
+
+
+
+
+
+
+
diff --git a/src/AspNetCoreNoStartupExample/AutofacModule.cs b/src/AspNetCoreNoStartupExample/AutofacModule.cs
new file mode 100644
index 0000000..33306c1
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/AutofacModule.cs
@@ -0,0 +1,19 @@
+using AspNetCoreNoStartupExample.Services;
+using Autofac;
+using Microsoft.Extensions.Logging;
+
+namespace AspNetCoreNoStartupExample;
+
+public class AutofacModule : Module
+{
+ protected override void Load(ContainerBuilder builder)
+ {
+ // The generic ILogger service was added to the
+ // ServiceCollection by ASP.NET Core. It was then registered with
+ // Autofac using the Populate method, which happens automatically
+ // when using the AutofacServiceProviderFactory.
+ builder.Register(c => new ValuesService(c.Resolve>()))
+ .As()
+ .InstancePerLifetimeScope();
+ }
+}
diff --git a/src/AspNetCoreNoStartupExample/Controllers/ValuesController.cs b/src/AspNetCoreNoStartupExample/Controllers/ValuesController.cs
new file mode 100644
index 0000000..1812a87
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/Controllers/ValuesController.cs
@@ -0,0 +1,28 @@
+using AspNetCoreNoStartupExample.Services;
+using Microsoft.AspNetCore.Mvc;
+
+namespace AspNetCoreNoStartupExample.Controllers;
+
+[ApiController]
+[Route("api/[controller]")]
+public class ValuesController : ControllerBase
+{
+ private readonly IValuesService _valuesService;
+
+ public ValuesController(IValuesService valuesService)
+ {
+ _valuesService = valuesService;
+ }
+
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ return _valuesService.FindAll();
+ }
+
+ [HttpGet("{id}")]
+ public string Get(int id)
+ {
+ return _valuesService.Find(id);
+ }
+}
diff --git a/src/AspNetCoreNoStartupExample/Program.cs b/src/AspNetCoreNoStartupExample/Program.cs
new file mode 100644
index 0000000..ae7fb80
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/Program.cs
@@ -0,0 +1,29 @@
+using Autofac;
+using Autofac.Extensions.DependencyInjection;
+using AspNetCoreNoStartupExample;
+
+// This example shows how to use Autofac with the minimal hosting model
+// (no Startup class). Everything is configured inline in Program.cs.
+// Compare with the AspNetCoreExample which uses a Startup class.
+
+var builder = WebApplication.CreateBuilder(args);
+
+// Use Autofac as the service provider factory. This replaces the
+// default Microsoft DI container with Autofac.
+builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
+
+// ConfigureContainer gives you a strongly-typed ContainerBuilder.
+// This is called AFTER ConfigureServices, so registrations here
+// override those from ConfigureServices.
+builder.Host.ConfigureContainer(containerBuilder =>
+{
+ containerBuilder.RegisterModule(new AutofacModule());
+});
+
+builder.Services.AddControllers();
+
+var app = builder.Build();
+
+app.MapControllers();
+
+app.Run();
diff --git a/src/AspNetCoreNoStartupExample/Properties/launchSettings.json b/src/AspNetCoreNoStartupExample/Properties/launchSettings.json
new file mode 100644
index 0000000..a0a02e7
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "profiles": {
+ "AspNetCoreNoStartupExample": {
+ "commandName": "Project",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "launchBrowser": true,
+ "launchUrl": "http://localhost:5000/api/values"
+ }
+ }
+}
diff --git a/src/AspNetCoreNoStartupExample/Services/IValuesService.cs b/src/AspNetCoreNoStartupExample/Services/IValuesService.cs
new file mode 100644
index 0000000..b357b32
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/Services/IValuesService.cs
@@ -0,0 +1,8 @@
+namespace AspNetCoreNoStartupExample.Services;
+
+public interface IValuesService
+{
+ IEnumerable FindAll();
+
+ string Find(int id);
+}
diff --git a/src/AspNetCoreNoStartupExample/Services/ValuesService.cs b/src/AspNetCoreNoStartupExample/Services/ValuesService.cs
new file mode 100644
index 0000000..e264e99
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/Services/ValuesService.cs
@@ -0,0 +1,25 @@
+using Microsoft.Extensions.Logging;
+
+namespace AspNetCoreNoStartupExample.Services;
+
+public class ValuesService : IValuesService
+{
+ private readonly ILogger _logger;
+
+ public ValuesService(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ public IEnumerable FindAll()
+ {
+ _logger.LogDebug("{Method} called", nameof(FindAll));
+ return ["value1", "value2"];
+ }
+
+ public string Find(int id)
+ {
+ _logger.LogDebug("{Method} called with {Id}", nameof(Find), id);
+ return $"value{id}";
+ }
+}
diff --git a/src/AspNetCoreNoStartupExample/appsettings.json b/src/AspNetCoreNoStartupExample/appsettings.json
new file mode 100644
index 0000000..34f00ef
--- /dev/null
+++ b/src/AspNetCoreNoStartupExample/appsettings.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Debug",
+ "Microsoft.AspNetCore": "Information"
+ }
+ }
+}
diff --git a/src/AttributeMetadataExample/AttributeMetadataExample.csproj b/src/AttributeMetadataExample/AttributeMetadataExample.csproj
index d60f8c8..aff71a3 100644
--- a/src/AttributeMetadataExample/AttributeMetadataExample.csproj
+++ b/src/AttributeMetadataExample/AttributeMetadataExample.csproj
@@ -1,12 +1,14 @@
-
+
+
Exe
- net6.0
- AttributeMetadataExample
- AttributeMetadataExample
+ net10.0
+ enable
+
-
+
+
diff --git a/src/ConfigurationExample/ConfigurationExample.csproj b/src/ConfigurationExample/ConfigurationExample.csproj
index ced1a39..3a14ac1 100644
--- a/src/ConfigurationExample/ConfigurationExample.csproj
+++ b/src/ConfigurationExample/ConfigurationExample.csproj
@@ -2,13 +2,14 @@
Exe
- net6.0
+ net10.0
+ enable
-
-
-
+
+
+
@@ -27,4 +28,5 @@
+
diff --git a/src/DomainServicesExample/App.xaml b/src/DomainServicesExample/App.xaml
deleted file mode 100644
index ed9e27c..0000000
--- a/src/DomainServicesExample/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/src/DomainServicesExample/App.xaml.cs b/src/DomainServicesExample/App.xaml.cs
deleted file mode 100644
index e505311..0000000
--- a/src/DomainServicesExample/App.xaml.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-
-namespace DomainServicesExample
-{
- public partial class App : Application
- {
-
- public App()
- {
- this.Startup += this.Application_Startup;
- this.Exit += this.Application_Exit;
- this.UnhandledException += this.Application_UnhandledException;
-
- InitializeComponent();
- }
-
- private void Application_Startup(object sender, StartupEventArgs e)
- {
- this.RootVisual = new MainPage();
- }
-
- private void Application_Exit(object sender, EventArgs e)
- {
-
- }
-
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- // If the app is running outside of the debugger then report the exception using
- // the browser's exception mechanism. On IE this will display it a yellow alert
- // icon in the status bar and Firefox will display a script error.
- if (!System.Diagnostics.Debugger.IsAttached)
- {
-
- // NOTE: This will allow the application to continue running after an exception has been thrown
- // but not handled.
- // For production applications this error handling should be replaced with something that will
- // report the error to the website and stop the application.
- e.Handled = true;
- Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
- }
- }
-
- private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
- {
- try
- {
- string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
- errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
-
- System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
- }
- catch (Exception)
- {
- }
- }
- }
-}
diff --git a/src/DomainServicesExample/DomainServicesExample.csproj b/src/DomainServicesExample/DomainServicesExample.csproj
deleted file mode 100644
index e739829..0000000
--- a/src/DomainServicesExample/DomainServicesExample.csproj
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.50727
- 2.0
- {4EAB58EC-EEA6-4183-90B6-847183C9A75F}
- {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- DomainServicesExample
- DomainServicesExample
- Silverlight
- v5.0
- $(TargetFrameworkVersion)
- true
-
-
- true
- true
- DomainServicesExample.xap
- Properties\AppManifest.xml
- DomainServicesExample.App
- DomainServicesExampleTestPage.html
- true
- true
- false
- Properties\OutOfBrowserSettings.xml
- false
- true
- ..\Remember.Web\Remember.Web.csproj
-
-
-
- v3.5
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
- $(TargetFrameworkDirectory)System.Core.dll
-
-
-
-
-
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/DomainServicesExample/MainPage.xaml b/src/DomainServicesExample/MainPage.xaml
deleted file mode 100644
index 42d6fda..0000000
--- a/src/DomainServicesExample/MainPage.xaml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/DomainServicesExample/MainPage.xaml.cs b/src/DomainServicesExample/MainPage.xaml.cs
deleted file mode 100644
index 9e40c0a..0000000
--- a/src/DomainServicesExample/MainPage.xaml.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.ServiceModel.DomainServices.Client;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-using Remember.Model;
-using Remember.Web;
-
-namespace DomainServicesExample
-{
- public partial class MainPage : UserControl
- {
- private TaskDomainContext _taskContext = new TaskDomainContext();
-
- public MainPage()
- {
- InitializeComponent();
- var op = this._taskContext.GetTasks(this.LoadResultsIntoGrid, null);
- }
-
- private void LoadResultsIntoGrid(InvokeOperation> op)
- {
- this.TaskGrid.ItemsSource = op.Value;
- }
- }
-}
diff --git a/src/DomainServicesExample/Properties/AppManifest.xml b/src/DomainServicesExample/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/src/DomainServicesExample/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/src/DomainServicesExample/Properties/AssemblyInfo.cs b/src/DomainServicesExample/Properties/AssemblyInfo.cs
deleted file mode 100644
index de17664..0000000
--- a/src/DomainServicesExample/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyTitle("DomainServicesExample")]
diff --git a/src/GenericHostBuilderExample/GenericHostBuilderExample.csproj b/src/GenericHostBuilderExample/GenericHostBuilderExample.csproj
index 6b3df5a..fa7bb1e 100644
--- a/src/GenericHostBuilderExample/GenericHostBuilderExample.csproj
+++ b/src/GenericHostBuilderExample/GenericHostBuilderExample.csproj
@@ -1,14 +1,14 @@
-
+
Exe
- net6.0
+ net10.0
+ enable
-
-
-
+
+
diff --git a/src/MultitenantExample.ConsoleApplication/MultitenantExample.ConsoleApplication.csproj b/src/MultitenantExample.ConsoleApplication/MultitenantExample.ConsoleApplication.csproj
index 727742f..81b6895 100644
--- a/src/MultitenantExample.ConsoleApplication/MultitenantExample.ConsoleApplication.csproj
+++ b/src/MultitenantExample.ConsoleApplication/MultitenantExample.ConsoleApplication.csproj
@@ -1,11 +1,14 @@
-
+
+
Exe
- net6.0
- MultitenantExample.ConsoleApplication
+ net10.0
+ enable
+
-
-
+
+
+
diff --git a/src/ServiceFabricDemo/.gitattributes b/src/ServiceFabricDemo/.gitattributes
deleted file mode 100644
index 1ff0c42..0000000
--- a/src/ServiceFabricDemo/.gitattributes
+++ /dev/null
@@ -1,63 +0,0 @@
-###############################################################################
-# Set default behavior to automatically normalize line endings.
-###############################################################################
-* text=auto
-
-###############################################################################
-# Set default behavior for command prompt diff.
-#
-# This is need for earlier builds of msysgit that does not have it on by
-# default for csharp files.
-# Note: This is only used by command line
-###############################################################################
-#*.cs diff=csharp
-
-###############################################################################
-# Set the merge driver for project and solution files
-#
-# Merging from the command prompt will add diff markers to the files if there
-# are conflicts (Merging from VS is not affected by the settings below, in VS
-# the diff markers are never inserted). Diff markers may cause the following
-# file extensions to fail to load in VS. An alternative would be to treat
-# these files as binary and thus will always conflict and require user
-# intervention with every merge. To do so, just uncomment the entries below
-###############################################################################
-#*.sln merge=binary
-#*.csproj merge=binary
-#*.vbproj merge=binary
-#*.vcxproj merge=binary
-#*.vcproj merge=binary
-#*.dbproj merge=binary
-#*.fsproj merge=binary
-#*.lsproj merge=binary
-#*.wixproj merge=binary
-#*.modelproj merge=binary
-#*.sqlproj merge=binary
-#*.wwaproj merge=binary
-
-###############################################################################
-# behavior for image files
-#
-# image files are treated as binary by default.
-###############################################################################
-#*.jpg binary
-#*.png binary
-#*.gif binary
-
-###############################################################################
-# diff behavior for common document formats
-#
-# Convert binary document formats to text before diffing them. This feature
-# is only available from the command line. Turn it on by uncommenting the
-# entries below.
-###############################################################################
-#*.doc diff=astextplain
-#*.DOC diff=astextplain
-#*.docx diff=astextplain
-#*.DOCX diff=astextplain
-#*.dot diff=astextplain
-#*.DOT diff=astextplain
-#*.pdf diff=astextplain
-#*.PDF diff=astextplain
-#*.rtf diff=astextplain
-#*.RTF diff=astextplain
diff --git a/src/ServiceFabricDemo/.gitignore b/src/ServiceFabricDemo/.gitignore
deleted file mode 100644
index 1c9a181..0000000
--- a/src/ServiceFabricDemo/.gitignore
+++ /dev/null
@@ -1,242 +0,0 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-[Xx]64/
-[Xx]86/
-[Bb]uild/
-bld/
-[Bb]in/
-[Oo]bj/
-
-# Visual Studio 2015 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# DNX
-project.lock.json
-artifacts/
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-
-# TODO: Un-comment the next line if you do not want to checkin
-# your web deploy settings because they may include unencrypted
-# passwords
-#*.pubxml
-*.publishproj
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/packages/repositories.config
-# NuGet v3's project.json files produces more ignoreable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directory
-AppPackages/
-BundleArtifacts/
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-[Ss]tyle[Cc]op.*
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.pfx
-*.publishsettings
-node_modules/
-orleans.codegen.cs
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-*.mdf
-*.ldf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# LightSwitch generated files
-GeneratedArtifacts/
-ModelManifest.xml
-
-# Paket dependency manager
-.paket/paket.exe
-
-# FAKE - F# Make
-.fake/
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo.sln b/src/ServiceFabricDemo/AutofacServiceFabricDemo.sln
deleted file mode 100644
index 23cb381..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo.sln
+++ /dev/null
@@ -1,54 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26403.3
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{A07B5EB6-E848-4116-A8D0-A826331D98C6}") = "AutofacServiceFabricDemo", "AutofacServiceFabricDemo\AutofacServiceFabricDemo.sfproj", "{F79DAB83-DEE7-4BAC-889E-3AF038845958}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoActor", "DemoActor\DemoActor.csproj", "{3686B69D-8F0D-468C-A842-743C30C6F92A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoActor.Interfaces", "DemoActor.Interfaces\DemoActor.Interfaces.csproj", "{79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoStatefulService", "DemoStatefulService\DemoStatefulService.csproj", "{CE6A795A-970A-4792-8ADE-0F0D5432154B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoStatelessService", "DemoStatelessService\DemoStatelessService.csproj", "{E695E6B8-9FDC-48F7-B3A1-14395708F71D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoShared", "DemoShared\DemoShared.csproj", "{1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Debug|x64.ActiveCfg = Debug|x64
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Debug|x64.Build.0 = Debug|x64
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Debug|x64.Deploy.0 = Debug|x64
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Release|x64.ActiveCfg = Release|x64
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Release|x64.Build.0 = Release|x64
- {F79DAB83-DEE7-4BAC-889E-3AF038845958}.Release|x64.Deploy.0 = Release|x64
- {3686B69D-8F0D-468C-A842-743C30C6F92A}.Debug|x64.ActiveCfg = Debug|x64
- {3686B69D-8F0D-468C-A842-743C30C6F92A}.Debug|x64.Build.0 = Debug|x64
- {3686B69D-8F0D-468C-A842-743C30C6F92A}.Release|x64.ActiveCfg = Release|x64
- {3686B69D-8F0D-468C-A842-743C30C6F92A}.Release|x64.Build.0 = Release|x64
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}.Debug|x64.ActiveCfg = Debug|x64
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}.Debug|x64.Build.0 = Debug|x64
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}.Release|x64.ActiveCfg = Release|x64
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}.Release|x64.Build.0 = Release|x64
- {CE6A795A-970A-4792-8ADE-0F0D5432154B}.Debug|x64.ActiveCfg = Debug|x64
- {CE6A795A-970A-4792-8ADE-0F0D5432154B}.Debug|x64.Build.0 = Debug|x64
- {CE6A795A-970A-4792-8ADE-0F0D5432154B}.Release|x64.ActiveCfg = Release|x64
- {CE6A795A-970A-4792-8ADE-0F0D5432154B}.Release|x64.Build.0 = Release|x64
- {E695E6B8-9FDC-48F7-B3A1-14395708F71D}.Debug|x64.ActiveCfg = Debug|x64
- {E695E6B8-9FDC-48F7-B3A1-14395708F71D}.Debug|x64.Build.0 = Debug|x64
- {E695E6B8-9FDC-48F7-B3A1-14395708F71D}.Release|x64.ActiveCfg = Release|x64
- {E695E6B8-9FDC-48F7-B3A1-14395708F71D}.Release|x64.Build.0 = Release|x64
- {1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}.Debug|x64.ActiveCfg = Debug|x64
- {1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}.Debug|x64.Build.0 = Debug|x64
- {1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}.Release|x64.ActiveCfg = Release|x64
- {1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationPackageRoot/ApplicationManifest.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationPackageRoot/ApplicationManifest.xml
deleted file mode 100644
index f92f8ea..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationPackageRoot/ApplicationManifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Cloud.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Cloud.xml
deleted file mode 100644
index 974468b..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Cloud.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.1Node.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.1Node.xml
deleted file mode 100644
index f9406f6..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.1Node.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.5Node.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.5Node.xml
deleted file mode 100644
index a4d7fe9..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/ApplicationParameters/Local.5Node.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/AutofacServiceFabricDemo.sfproj b/src/ServiceFabricDemo/AutofacServiceFabricDemo/AutofacServiceFabricDemo.sfproj
deleted file mode 100644
index 29f8bc6..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/AutofacServiceFabricDemo.sfproj
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
- f79dab83-dee7-4bac-889e-3af038845958
- 1.6
- 1.5
- false
-
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.targets
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Cloud.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Cloud.xml
deleted file mode 100644
index 1301dd8..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Cloud.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.1Node.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.1Node.xml
deleted file mode 100644
index 6e1403e..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.1Node.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.5Node.xml b/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.5Node.xml
deleted file mode 100644
index f42d759..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/PublishProfiles/Local.5Node.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/Scripts/Deploy-FabricApplication.ps1 b/src/ServiceFabricDemo/AutofacServiceFabricDemo/Scripts/Deploy-FabricApplication.ps1
deleted file mode 100644
index 2897b10..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/Scripts/Deploy-FabricApplication.ps1
+++ /dev/null
@@ -1,258 +0,0 @@
-<#
-.SYNOPSIS
-Deploys a Service Fabric application type to a cluster.
-
-.DESCRIPTION
-This script deploys a Service Fabric application type to a cluster. It is invoked by Visual Studio when deploying a Service Fabric Application project.
-
-.NOTES
-WARNING: This script file is invoked by Visual Studio. Its parameters must not be altered but its logic can be customized as necessary.
-
-.PARAMETER PublishProfileFile
-Path to the file containing the publish profile.
-
-.PARAMETER ApplicationPackagePath
-Path to the folder of the packaged Service Fabric application.
-
-.PARAMETER DeployOnly
-Indicates that the Service Fabric application should not be created or upgraded after registering the application type.
-
-.PARAMETER ApplicationParameter
-Hashtable of the Service Fabric application parameters to be used for the application.
-
-.PARAMETER UnregisterUnusedApplicationVersionsAfterUpgrade
-Indicates whether to unregister any unused application versions that exist after an upgrade is finished.
-
-.PARAMETER OverrideUpgradeBehavior
-Indicates the behavior used to override the upgrade settings specified by the publish profile.
-'None' indicates that the upgrade settings will not be overridden.
-'ForceUpgrade' indicates that an upgrade will occur with default settings, regardless of what is specified in the publish profile.
-'VetoUpgrade' indicates that an upgrade will not occur, regardless of what is specified in the publish profile.
-
-.PARAMETER UseExistingClusterConnection
-Indicates that the script should make use of an existing cluster connection that has already been established in the PowerShell session. The cluster connection parameters configured in the publish profile are ignored.
-
-.PARAMETER OverwriteBehavior
-Overwrite Behavior if an application exists in the cluster with the same name. Available Options are Never, Always, SameAppTypeAndVersion. This setting is not applicable when upgrading an application.
-'Never' will not remove the existing application. This is the default behavior.
-'Always' will remove the existing application even if its Application type and Version is different from the application being created.
-'SameAppTypeAndVersion' will remove the existing application only if its Application type and Version is same as the application being created.
-
-.PARAMETER SkipPackageValidation
-Switch signaling whether the package should be validated or not before deployment.
-
-.PARAMETER SecurityToken
-A security token for authentication to cluster management endpoints. Used for silent authentication to clusters that are protected by Azure Active Directory.
-
-.PARAMETER CopyPackageTimeoutSec
-Timeout in seconds for copying application package to image store.
-
-.EXAMPLE
-. Scripts\Deploy-FabricApplication.ps1 -ApplicationPackagePath 'pkg\Debug'
-
-Deploy the application using the default package location for a Debug build.
-
-.EXAMPLE
-. Scripts\Deploy-FabricApplication.ps1 -ApplicationPackagePath 'pkg\Debug' -DoNotCreateApplication
-
-Deploy the application but do not create the application instance.
-
-.EXAMPLE
-. Scripts\Deploy-FabricApplication.ps1 -ApplicationPackagePath 'pkg\Debug' -ApplicationParameter @{CustomParameter1='MyValue'; CustomParameter2='MyValue'}
-
-Deploy the application by providing values for parameters that are defined in the application manifest.
-#>
-
-Param
-(
- [String]
- $PublishProfileFile,
-
- [String]
- $ApplicationPackagePath,
-
- [Switch]
- $DeployOnly,
-
- [Hashtable]
- $ApplicationParameter,
-
- [Boolean]
- $UnregisterUnusedApplicationVersionsAfterUpgrade,
-
- [String]
- [ValidateSet('None', 'ForceUpgrade', 'VetoUpgrade')]
- $OverrideUpgradeBehavior = 'None',
-
- [Switch]
- $UseExistingClusterConnection,
-
- [String]
- [ValidateSet('Never','Always','SameAppTypeAndVersion')]
- $OverwriteBehavior = 'Never',
-
- [Switch]
- $SkipPackageValidation,
-
- [String]
- $SecurityToken,
-
- [int]
- $CopyPackageTimeoutSec
-)
-
-function Read-XmlElementAsHashtable
-{
- Param (
- [System.Xml.XmlElement]
- $Element
- )
-
- $hashtable = @{}
- if ($Element.Attributes)
- {
- $Element.Attributes |
- ForEach-Object {
- $boolVal = $null
- if ([bool]::TryParse($_.Value, [ref]$boolVal)) {
- $hashtable[$_.Name] = $boolVal
- }
- else {
- $hashtable[$_.Name] = $_.Value
- }
- }
- }
-
- return $hashtable
-}
-
-function Read-PublishProfile
-{
- Param (
- [ValidateScript({Test-Path $_ -PathType Leaf})]
- [String]
- $PublishProfileFile
- )
-
- $publishProfileXml = [Xml] (Get-Content $PublishProfileFile)
- $publishProfile = @{}
-
- $publishProfile.ClusterConnectionParameters = Read-XmlElementAsHashtable $publishProfileXml.PublishProfile.Item("ClusterConnectionParameters")
- $publishProfile.UpgradeDeployment = Read-XmlElementAsHashtable $publishProfileXml.PublishProfile.Item("UpgradeDeployment")
- $publishProfile.CopyPackageParameters = Read-XmlElementAsHashtable $publishProfileXml.PublishProfile.Item("CopyPackageParameters")
-
- if ($publishProfileXml.PublishProfile.Item("UpgradeDeployment"))
- {
- $publishProfile.UpgradeDeployment.Parameters = Read-XmlElementAsHashtable $publishProfileXml.PublishProfile.Item("UpgradeDeployment").Item("Parameters")
- if ($publishProfile.UpgradeDeployment["Mode"])
- {
- $publishProfile.UpgradeDeployment.Parameters[$publishProfile.UpgradeDeployment["Mode"]] = $true
- }
- }
-
- $publishProfileFolder = (Split-Path $PublishProfileFile)
- $publishProfile.ApplicationParameterFile = [System.IO.Path]::Combine($PublishProfileFolder, $publishProfileXml.PublishProfile.ApplicationParameterFile.Path)
-
- return $publishProfile
-}
-
-$LocalFolder = (Split-Path $MyInvocation.MyCommand.Path)
-
-if (!$PublishProfileFile)
-{
- $PublishProfileFile = "$LocalFolder\..\PublishProfiles\Local.xml"
-}
-
-if (!$ApplicationPackagePath)
-{
- $ApplicationPackagePath = "$LocalFolder\..\pkg\Release"
-}
-
-$ApplicationPackagePath = Resolve-Path $ApplicationPackagePath
-
-$publishProfile = Read-PublishProfile $PublishProfileFile
-
-if (-not $UseExistingClusterConnection)
-{
- $ClusterConnectionParameters = $publishProfile.ClusterConnectionParameters
- if ($SecurityToken)
- {
- $ClusterConnectionParameters["SecurityToken"] = $SecurityToken
- }
-
- try
- {
- [void](Connect-ServiceFabricCluster @ClusterConnectionParameters)
- }
- catch [System.Fabric.FabricObjectClosedException]
- {
- Write-Warning "Service Fabric cluster may not be connected."
- throw
- }
-}
-
-$RegKey = "HKLM:\SOFTWARE\Microsoft\Service Fabric SDK"
-$ModuleFolderPath = (Get-ItemProperty -Path $RegKey -Name FabricSDKPSModulePath).FabricSDKPSModulePath
-Import-Module "$ModuleFolderPath\ServiceFabricSDK.psm1"
-
-$IsUpgrade = ($publishProfile.UpgradeDeployment -and $publishProfile.UpgradeDeployment.Enabled -and $OverrideUpgradeBehavior -ne 'VetoUpgrade') -or $OverrideUpgradeBehavior -eq 'ForceUpgrade'
-
-$PublishParameters = @{
- 'ApplicationPackagePath' = $ApplicationPackagePath
- 'ApplicationParameterFilePath' = $publishProfile.ApplicationParameterFile
- 'ApplicationParameter' = $ApplicationParameter
- 'ErrorAction' = 'Stop'
-}
-
-if ($publishProfile.CopyPackageParameters.CopyPackageTimeoutSec)
-{
- $PublishParameters['CopyPackageTimeoutSec'] = $publishProfile.CopyPackageParameters.CopyPackageTimeoutSec
-}
-
-if ($publishProfile.CopyPackageParameters.CompressPackage)
-{
- $PublishParameters['CompressPackage'] = $publishProfile.CopyPackageParameters.CompressPackage
-}
-
-# CopyPackageTimeoutSec parameter overrides the value from the publish profile
-if ($CopyPackageTimeoutSec)
-{
- $PublishParameters['CopyPackageTimeoutSec'] = $CopyPackageTimeoutSec
-}
-
-if ($IsUpgrade)
-{
- $Action = "RegisterAndUpgrade"
- if ($DeployOnly)
- {
- $Action = "Register"
- }
-
- $UpgradeParameters = $publishProfile.UpgradeDeployment.Parameters
-
- if ($OverrideUpgradeBehavior -eq 'ForceUpgrade')
- {
- # Warning: Do not alter these upgrade parameters. It will create an inconsistency with Visual Studio's behavior.
- $UpgradeParameters = @{ UnmonitoredAuto = $true; Force = $true }
- }
-
- $PublishParameters['Action'] = $Action
- $PublishParameters['UpgradeParameters'] = $UpgradeParameters
- $PublishParameters['UnregisterUnusedVersions'] = $UnregisterUnusedApplicationVersionsAfterUpgrade
-
- Publish-UpgradedServiceFabricApplication @PublishParameters
-}
-else
-{
- $Action = "RegisterAndCreate"
- if ($DeployOnly)
- {
- $Action = "Register"
- }
-
- $PublishParameters['Action'] = $Action
- $PublishParameters['OverwriteBehavior'] = $OverwriteBehavior
- $PublishParameters['SkipPackageValidation'] = $SkipPackageValidation
-
- Publish-NewServiceFabricApplication @PublishParameters
-}
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/app.config b/src/ServiceFabricDemo/AutofacServiceFabricDemo/app.config
deleted file mode 100644
index 4ddff23..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/app.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/AutofacServiceFabricDemo/packages.config b/src/ServiceFabricDemo/AutofacServiceFabricDemo/packages.config
deleted file mode 100644
index 4a71992..0000000
--- a/src/ServiceFabricDemo/AutofacServiceFabricDemo/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor.Interfaces/DemoActor.Interfaces.csproj b/src/ServiceFabricDemo/DemoActor.Interfaces/DemoActor.Interfaces.csproj
deleted file mode 100644
index 8430523..0000000
--- a/src/ServiceFabricDemo/DemoActor.Interfaces/DemoActor.Interfaces.csproj
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
- Debug
- x64
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}
- Library
- Properties
- DemoActor.Interfaces
- DemoActor.Interfaces
- v4.5.2
- 512
-
-
-
-
- true
- full
- false
- bin\x64\Debug\
- DEBUG;TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- pdbonly
- true
- bin\x64\Release\
- TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
-
- ..\packages\Microsoft.ServiceFabric.Actors.2.8.232\lib\net45\Microsoft.ServiceFabric.Actors.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.Interfaces.dll
- True
-
-
- ..\packages\Microsoft.ServiceFabric.Diagnostics.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.Diagnostics.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.V2.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.Strings.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Preview.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.Remoting.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.Remoting.dll
-
-
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.XmlSerializers.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Strings.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor.Interfaces/IDemoActor.cs b/src/ServiceFabricDemo/DemoActor.Interfaces/IDemoActor.cs
deleted file mode 100644
index 32961c5..0000000
--- a/src/ServiceFabricDemo/DemoActor.Interfaces/IDemoActor.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.ServiceFabric.Actors;
-
-namespace DemoActor.Interfaces
-{
- ///
- /// This interface defines the methods exposed by an actor.
- /// Clients use this interface to interact with the actor that implements it.
- ///
- public interface IDemoActor : IActor
- {
- ///
- /// TODO: Replace with your own actor method.
- ///
- ///
- Task GetCountAsync(CancellationToken cancellationToken);
-
- ///
- /// TODO: Replace with your own actor method.
- ///
- ///
- ///
- Task SetCountAsync(int count, CancellationToken cancellationToken);
- }
-}
diff --git a/src/ServiceFabricDemo/DemoActor.Interfaces/Properties/AssemblyInfo.cs b/src/ServiceFabricDemo/DemoActor.Interfaces/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4ca1692..0000000
--- a/src/ServiceFabricDemo/DemoActor.Interfaces/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DemoActor.Interfaces")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DemoActor.Interfaces")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("79cbccea-d9ff-4042-aad8-6533b4c60cf9")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/ServiceFabricDemo/DemoActor.Interfaces/packages.config b/src/ServiceFabricDemo/DemoActor.Interfaces/packages.config
deleted file mode 100644
index 5fe0975..0000000
--- a/src/ServiceFabricDemo/DemoActor.Interfaces/packages.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor/ActorEventSource.cs b/src/ServiceFabricDemo/DemoActor/ActorEventSource.cs
deleted file mode 100644
index 373fd81..0000000
--- a/src/ServiceFabricDemo/DemoActor/ActorEventSource.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using System;
-using System.Diagnostics.Tracing;
-using System.Threading.Tasks;
-using Microsoft.ServiceFabric.Actors.Runtime;
-
-namespace DemoActor
-{
- [EventSource(Name = "MyCompany-AutofacServiceFabricDemo-DemoActor")]
- internal sealed class ActorEventSource : EventSource
- {
- public static readonly ActorEventSource Current = new ActorEventSource();
-
- static ActorEventSource()
- {
- // A workaround for the problem where ETW activities do not get tracked until Tasks infrastructure is initialized.
- // This problem will be fixed in .NET Framework 4.6.2.
- Task.Run(() => { });
- }
-
- // Instance constructor is private to enforce singleton semantics
- private ActorEventSource() : base() { }
-
- #region Keywords
- // Event keywords can be used to categorize events.
- // Each keyword is a bit flag. A single event can be associated with multiple keywords (via EventAttribute.Keywords property).
- // Keywords must be defined as a public class named 'Keywords' inside EventSource that uses them.
- public static class Keywords
- {
- public const EventKeywords HostInitialization = (EventKeywords)0x1L;
- }
- #endregion
-
- #region Events
- // Define an instance method for each event you want to record and apply an [Event] attribute to it.
- // The method name is the name of the event.
- // Pass any parameters you want to record with the event (only primitive integer types, DateTime, Guid & string are allowed).
- // Each event method implementation should check whether the event source is enabled, and if it is, call WriteEvent() method to raise the event.
- // The number and types of arguments passed to every event method must exactly match what is passed to WriteEvent().
- // Put [NonEvent] attribute on all methods that do not define an event.
- // For more information see https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx
-
- [NonEvent]
- public void Message(string message, params object[] args)
- {
- if (this.IsEnabled())
- {
- string finalMessage = string.Format(message, args);
- Message(finalMessage);
- }
- }
-
- private const int MessageEventId = 1;
- [Event(MessageEventId, Level = EventLevel.Informational, Message = "{0}")]
- public void Message(string message)
- {
- if (this.IsEnabled())
- {
- WriteEvent(MessageEventId, message);
- }
- }
-
- [NonEvent]
- public void ActorMessage(Actor actor, string message, params object[] args)
- {
- if (this.IsEnabled()
- && actor.Id != null
- && actor.ActorService != null
- && actor.ActorService.Context != null
- && actor.ActorService.Context.CodePackageActivationContext != null)
- {
- string finalMessage = string.Format(message, args);
- ActorMessage(
- actor.GetType().ToString(),
- actor.Id.ToString(),
- actor.ActorService.Context.CodePackageActivationContext.ApplicationTypeName,
- actor.ActorService.Context.CodePackageActivationContext.ApplicationName,
- actor.ActorService.Context.ServiceTypeName,
- actor.ActorService.Context.ServiceName.ToString(),
- actor.ActorService.Context.PartitionId,
- actor.ActorService.Context.ReplicaId,
- actor.ActorService.Context.NodeContext.NodeName,
- finalMessage);
- }
- }
-
- // For very high-frequency events it might be advantageous to raise events using WriteEventCore API.
- // This results in more efficient parameter handling, but requires explicit allocation of EventData structure and unsafe code.
- // To enable this code path, define UNSAFE conditional compilation symbol and turn on unsafe code support in project properties.
- private const int ActorMessageEventId = 2;
- [Event(ActorMessageEventId, Level = EventLevel.Informational, Message = "{9}")]
- private
-#if UNSAFE
- unsafe
-#endif
- void ActorMessage(
- string actorType,
- string actorId,
- string applicationTypeName,
- string applicationName,
- string serviceTypeName,
- string serviceName,
- Guid partitionId,
- long replicaOrInstanceId,
- string nodeName,
- string message)
- {
-#if !UNSAFE
- WriteEvent(
- ActorMessageEventId,
- actorType,
- actorId,
- applicationTypeName,
- applicationName,
- serviceTypeName,
- serviceName,
- partitionId,
- replicaOrInstanceId,
- nodeName,
- message);
-#else
- const int numArgs = 10;
- fixed (char* pActorType = actorType, pActorId = actorId, pApplicationTypeName = applicationTypeName, pApplicationName = applicationName, pServiceTypeName = serviceTypeName, pServiceName = serviceName, pNodeName = nodeName, pMessage = message)
- {
- EventData* eventData = stackalloc EventData[numArgs];
- eventData[0] = new EventData { DataPointer = (IntPtr) pActorType, Size = SizeInBytes(actorType) };
- eventData[1] = new EventData { DataPointer = (IntPtr) pActorId, Size = SizeInBytes(actorId) };
- eventData[2] = new EventData { DataPointer = (IntPtr) pApplicationTypeName, Size = SizeInBytes(applicationTypeName) };
- eventData[3] = new EventData { DataPointer = (IntPtr) pApplicationName, Size = SizeInBytes(applicationName) };
- eventData[4] = new EventData { DataPointer = (IntPtr) pServiceTypeName, Size = SizeInBytes(serviceTypeName) };
- eventData[5] = new EventData { DataPointer = (IntPtr) pServiceName, Size = SizeInBytes(serviceName) };
- eventData[6] = new EventData { DataPointer = (IntPtr) (&partitionId), Size = sizeof(Guid) };
- eventData[7] = new EventData { DataPointer = (IntPtr) (&replicaOrInstanceId), Size = sizeof(long) };
- eventData[8] = new EventData { DataPointer = (IntPtr) pNodeName, Size = SizeInBytes(nodeName) };
- eventData[9] = new EventData { DataPointer = (IntPtr) pMessage, Size = SizeInBytes(message) };
-
- WriteEventCore(ActorMessageEventId, numArgs, eventData);
- }
-#endif
- }
-
- private const int ActorHostInitializationFailedEventId = 3;
- [Event(ActorHostInitializationFailedEventId, Level = EventLevel.Error, Message = "Actor host initialization failed", Keywords = Keywords.HostInitialization)]
- public void ActorHostInitializationFailed(string exception)
- {
- WriteEvent(ActorHostInitializationFailedEventId, exception);
- }
- #endregion
-
- #region Private Methods
-#if UNSAFE
- private int SizeInBytes(string s)
- {
- if (s == null)
- {
- return 0;
- }
- else
- {
- return (s.Length + 1) * sizeof(char);
- }
- }
-#endif
- #endregion
- }
-}
diff --git a/src/ServiceFabricDemo/DemoActor/App.config b/src/ServiceFabricDemo/DemoActor/App.config
deleted file mode 100644
index 5a36944..0000000
--- a/src/ServiceFabricDemo/DemoActor/App.config
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor/DemoActor.cs b/src/ServiceFabricDemo/DemoActor/DemoActor.cs
deleted file mode 100644
index 14e7d02..0000000
--- a/src/ServiceFabricDemo/DemoActor/DemoActor.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.ServiceFabric.Actors;
-using Microsoft.ServiceFabric.Actors.Runtime;
-using DemoActor.Interfaces;
-using DemoShared;
-
-namespace DemoActor
-{
- ///
- /// This class represents an actor.
- /// Every ActorID maps to an instance of this class.
- /// The StatePersistence attribute determines persistence and replication of actor state:
- /// - Persisted: State is written to disk and replicated.
- /// - Volatile: State is kept in memory only and replicated.
- /// - None: State is kept in memory only and not replicated.
- ///
- [StatePersistence(StatePersistence.Persisted)]
- public class DemoActor : Actor, IDemoActor, IDisposable
- {
- private readonly ILogger _logger;
-
- ///
- /// Initializes a new instance of DemoActor
- ///
- /// The Microsoft.ServiceFabric.Actors.Runtime.ActorService that will host this actor instance.
- /// The Microsoft.ServiceFabric.Actors.ActorId for this actor instance.
- /// An injected logger dependency.
- public DemoActor(ActorService actorService, ActorId actorId, ILogger logger)
- : base(actorService, actorId)
- {
- _logger = logger;
-
- _logger.Log("Constructed");
- }
-
- ///
- /// This method is called whenever an actor is activated.
- /// An actor is activated the first time any of its methods are invoked.
- ///
- protected override Task OnActivateAsync()
- {
- ActorEventSource.Current.ActorMessage(this, "Actor activated.");
-
- _logger.Log($"{nameof(OnActivateAsync)} invoked");
-
- // The StateManager is this actor's private state store.
- // Data stored in the StateManager will be replicated for high-availability for actors that use volatile or persisted state storage.
- // Any serializable object can be saved in the StateManager.
- // For more information, see https://aka.ms/servicefabricactorsstateserialization
-
- return this.StateManager.TryAddStateAsync("count", 0);
- }
-
- ///
- /// TODO: Replace with your own actor method.
- ///
- ///
- Task IDemoActor.GetCountAsync(CancellationToken cancellationToken)
- {
- _logger.Log($"{nameof(IDemoActor.GetCountAsync)} invoked");
-
- return this.StateManager.GetStateAsync("count", cancellationToken);
- }
-
- ///
- /// TODO: Replace with your own actor method.
- ///
- ///
- ///
- Task IDemoActor.SetCountAsync(int count, CancellationToken cancellationToken)
- {
- _logger.Log($"{nameof(IDemoActor.SetCountAsync)} invoked");
-
- // Requests are not guaranteed to be processed in order nor at most once.
- // The update function here verifies that the incoming count is greater than the current count to preserve order.
- return this.StateManager.AddOrUpdateStateAsync("count", count, (key, value) => count > value ? count : value, cancellationToken);
- }
-
- protected override Task OnDeactivateAsync()
- {
- _logger.Log($"{nameof(OnDeactivateAsync)} invoked");
-
- return base.OnDeactivateAsync();
- }
-
- public void Dispose()
- {
- _logger.Log($"{nameof(Dispose)} invoked");
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoActor/DemoActor.csproj b/src/ServiceFabricDemo/DemoActor/DemoActor.csproj
deleted file mode 100644
index 9191851..0000000
--- a/src/ServiceFabricDemo/DemoActor/DemoActor.csproj
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
- Debug
- x64
- {3686B69D-8F0D-468C-A842-743C30C6F92A}
- Exe
- Properties
- DemoActor
- DemoActor
- v4.5.2
- 512
- true
-
-
-
-
- true
- PackageRoot
- $(MSBuildProjectName)
-
-
- true
- full
- false
- bin\x64\Debug\
- DEBUG;TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- pdbonly
- true
- bin\x64\Release\
- TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- True
-
-
-
- ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll
-
-
- ..\packages\Autofac.Extras.DynamicProxy.4.2.1\lib\net45\Autofac.Extras.DynamicProxy.dll
-
-
- ..\packages\Autofac.ServiceFabric.1.0.0\lib\net452\Autofac.Integration.ServiceFabric.dll
-
-
- ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll
-
-
-
- ..\packages\Microsoft.ServiceFabric.Actors.2.8.232\lib\net45\Microsoft.ServiceFabric.Actors.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.Interfaces.dll
- True
-
-
- ..\packages\Microsoft.ServiceFabric.Diagnostics.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.Diagnostics.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.V2.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.Strings.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Preview.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.Remoting.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.Remoting.dll
-
-
-
-
-
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.XmlSerializers.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Strings.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
-
-
- Designer
-
-
-
-
- {79CBCCEA-D9FF-4042-AAD8-6533B4C60CF9}
- DemoActor.Interfaces
-
-
- {1c0f6821-66f1-4e03-8f8d-66ed0500beb2}
- DemoShared
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor/PackageRoot/Config/Settings.xml b/src/ServiceFabricDemo/DemoActor/PackageRoot/Config/Settings.xml
deleted file mode 100644
index 4068a12..0000000
--- a/src/ServiceFabricDemo/DemoActor/PackageRoot/Config/Settings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor/PackageRoot/ServiceManifest.xml b/src/ServiceFabricDemo/DemoActor/PackageRoot/ServiceManifest.xml
deleted file mode 100644
index 57f235b..0000000
--- a/src/ServiceFabricDemo/DemoActor/PackageRoot/ServiceManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DemoActor.exe
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoActor/Program.cs b/src/ServiceFabricDemo/DemoActor/Program.cs
deleted file mode 100644
index 6497fb7..0000000
--- a/src/ServiceFabricDemo/DemoActor/Program.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-using Autofac;
-using Autofac.Integration.ServiceFabric;
-using DemoActor.Interfaces;
-using DemoShared;
-using Microsoft.ServiceFabric.Actors;
-using Microsoft.ServiceFabric.Actors.Client;
-
-namespace DemoActor
-{
- internal static class Program
- {
- ///
- /// This is the entry point of the service host process.
- ///
- private static void Main()
- {
- try
- {
- // The contents of your ServiceManifest.xml and ApplicationManifest.xml files
- // are automatically populated when you build this project.
- // For more information, see https://aka.ms/servicefabricactorsplatform
-
- // Start with the trusty old container builder.
- var builder = new ContainerBuilder();
-
- // Register any regular dependencies.
- builder.RegisterModule(new LoggerModule(ActorEventSource.Current.Message));
-
- // Register the Autofac magic for Service Fabric support.
- builder.RegisterServiceFabricSupport();
-
- // Register the actor service.
- builder.RegisterActor();
-
- using (builder.Build())
- {
- Task.Run(async () =>
- {
- // Invoke the actor to create an instance.
- var actorId = ActorId.CreateRandom();
- var actorProxy = ActorProxy.Create(actorId);
- var count = actorProxy.GetCountAsync(new CancellationToken()).GetAwaiter().GetResult();
-
- Debug.WriteLine($"Actor {actorId} has count {count}");
-
- await Task.Delay(TimeSpan.FromSeconds(15));
-
- // Delete the actor to trigger deactive.
- var actorServiceProxy = ActorServiceProxy.Create(
- new Uri("fabric:/AutofacServiceFabricDemo/DemoActorService"), actorId);
-
- await actorServiceProxy.DeleteActorAsync(actorId, new CancellationToken());
- });
-
- Thread.Sleep(Timeout.Infinite);
- }
- }
- catch (Exception e)
- {
- ActorEventSource.Current.ActorHostInitializationFailed(e.ToString());
- throw;
- }
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoActor/Properties/AssemblyInfo.cs b/src/ServiceFabricDemo/DemoActor/Properties/AssemblyInfo.cs
deleted file mode 100644
index 801b7db..0000000
--- a/src/ServiceFabricDemo/DemoActor/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DemoActor")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DemoActor")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3686b69d-8f0d-468c-a842-743c30c6f92a")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/ServiceFabricDemo/DemoActor/packages.config b/src/ServiceFabricDemo/DemoActor/packages.config
deleted file mode 100644
index cb28e90..0000000
--- a/src/ServiceFabricDemo/DemoActor/packages.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoShared/DemoShared.csproj b/src/ServiceFabricDemo/DemoShared/DemoShared.csproj
deleted file mode 100644
index e339225..0000000
--- a/src/ServiceFabricDemo/DemoShared/DemoShared.csproj
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {1C0F6821-66F1-4E03-8F8D-66ED0500BEB2}
- Library
- Properties
- DemoShared
- DemoShared
- v4.5.2
- 512
-
-
- x64
- bin\x64\Debug\
-
-
- x64
- bin\x64\Release\
-
-
-
- ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoShared/ILogger.cs b/src/ServiceFabricDemo/DemoShared/ILogger.cs
deleted file mode 100644
index 905c22d..0000000
--- a/src/ServiceFabricDemo/DemoShared/ILogger.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace DemoShared
-{
- public interface ILogger
- {
- void Log(string message);
- }
-}
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoShared/Logger.cs b/src/ServiceFabricDemo/DemoShared/Logger.cs
deleted file mode 100644
index 4f03ef7..0000000
--- a/src/ServiceFabricDemo/DemoShared/Logger.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-
-namespace DemoShared
-{
- public class Logger : ILogger
- {
- private readonly Action _logAction;
-
- private static readonly string ServiceName = typeof(TService).Name;
-
- public Logger(Action logAction)
- {
- _logAction = logAction;
- }
-
- public void Log(string message)
- {
- _logAction($"{ServiceName}: {message}");
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoShared/LoggerModule.cs b/src/ServiceFabricDemo/DemoShared/LoggerModule.cs
deleted file mode 100644
index 32daf5f..0000000
--- a/src/ServiceFabricDemo/DemoShared/LoggerModule.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using Autofac;
-
-namespace DemoShared
-{
- public class LoggerModule : Module
- {
- private readonly Action _logAction;
-
- public LoggerModule(Action logAction)
- {
- _logAction = logAction;
- }
-
- protected override void Load(ContainerBuilder builder)
- {
- builder.RegisterGeneric(typeof(Logger<>))
- .As(typeof(ILogger<>))
- .WithParameter(TypedParameter.From(_logAction))
- .InstancePerLifetimeScope();
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoShared/Properties/AssemblyInfo.cs b/src/ServiceFabricDemo/DemoShared/Properties/AssemblyInfo.cs
deleted file mode 100644
index 4f5fbf7..0000000
--- a/src/ServiceFabricDemo/DemoShared/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DemoShared")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DemoShared")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1c0f6821-66f1-4e03-8f8d-66ed0500beb2")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/ServiceFabricDemo/DemoShared/packages.config b/src/ServiceFabricDemo/DemoShared/packages.config
deleted file mode 100644
index b183ddf..0000000
--- a/src/ServiceFabricDemo/DemoShared/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatefulService/App.config b/src/ServiceFabricDemo/DemoStatefulService/App.config
deleted file mode 100644
index c116b95..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/App.config
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.cs b/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.cs
deleted file mode 100644
index 169bd5f..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Fabric;
-using System.Threading;
-using System.Threading.Tasks;
-using DemoShared;
-using Microsoft.ServiceFabric.Data.Collections;
-using Microsoft.ServiceFabric.Services.Communication.Runtime;
-using Microsoft.ServiceFabric.Services.Runtime;
-
-namespace DemoStatefulService
-{
- ///
- /// An instance of this class is created for each service replica by the Service Fabric runtime.
- ///
- public class DemoStatefulService : StatefulService, IDisposable
- {
- private readonly ILogger _logger;
-
- public DemoStatefulService(StatefulServiceContext context, ILogger logger)
- : base(context)
- {
- _logger = logger;
-
- _logger.Log("Constructed");
- }
-
- ///
- /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
- ///
- ///
- /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
- ///
- /// A collection of listeners.
- protected override IEnumerable CreateServiceReplicaListeners()
- {
- return new ServiceReplicaListener[0];
- }
-
- ///
- /// This is the main entry point for your service replica.
- /// This method executes when this replica of your service becomes primary and has write status.
- ///
- /// Canceled when Service Fabric needs to shut down this service replica.
- protected override async Task RunAsync(CancellationToken cancellationToken)
- {
- // TODO: Replace the following sample code with your own logic
- // or remove this RunAsync override if it's not needed in your service.
-
- _logger.Log($"{nameof(RunAsync)} invoked");
-
- var myDictionary = await this.StateManager.GetOrAddAsync>("myDictionary");
-
- while (true)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- using (var tx = this.StateManager.CreateTransaction())
- {
- var result = await myDictionary.TryGetValueAsync(tx, "Counter");
-
- ServiceEventSource.Current.ServiceMessage(this.Context, "Current Counter Value: {0}",
- result.HasValue ? result.Value.ToString() : "Value does not exist.");
-
- await myDictionary.AddOrUpdateAsync(tx, "Counter", 0, (key, value) => ++value);
-
- // If an exception is thrown before calling CommitAsync, the transaction aborts, all changes are
- // discarded, and nothing is saved to the secondary replicas.
- await tx.CommitAsync();
-
- // Restart the replica after 60 seconds to trigger deactivate.
- if (result.HasValue && result.Value == 60)
- {
- var fabricClient = new FabricClient();
- await fabricClient.ServiceManager.RestartReplicaAsync(
- Context.NodeContext.NodeName, Context.PartitionId, Context.ReplicaId);
- }
- }
-
- await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
- }
- }
-
- protected override Task OnCloseAsync(CancellationToken cancellationToken)
- {
- _logger.Log($"{nameof(OnCloseAsync)} invoked");
-
- return base.OnCloseAsync(cancellationToken);
- }
-
- protected override void OnAbort()
- {
- _logger.Log($"{nameof(OnAbort)} invoked");
-
- base.OnAbort();
- }
-
- public void Dispose()
- {
- _logger.Log($"{nameof(Dispose)} invoked");
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.csproj b/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.csproj
deleted file mode 100644
index ee48e5a..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/DemoStatefulService.csproj
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- Debug
- x64
- {CE6A795A-970A-4792-8ADE-0F0D5432154B}
- Exe
- Properties
- DemoStatefulService
- DemoStatefulService
- v4.5.2
- 512
- true
-
-
-
-
- true
- full
- false
- bin\x64\Debug\
- DEBUG;TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- pdbonly
- true
- bin\x64\Release\
- TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- $(AdditionalFileItemNames);None
-
-
- True
-
-
-
- ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll
-
-
- ..\packages\Autofac.Extras.DynamicProxy.4.2.1\lib\net45\Autofac.Extras.DynamicProxy.dll
-
-
- ..\packages\Autofac.ServiceFabric.1.0.0\lib\net452\Autofac.Integration.ServiceFabric.dll
-
-
- ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll
-
-
-
- ..\packages\Microsoft.ServiceFabric.Actors.2.8.232\lib\net45\Microsoft.ServiceFabric.Actors.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.Interfaces.dll
- True
-
-
- ..\packages\Microsoft.ServiceFabric.Diagnostics.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.Diagnostics.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.V2.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.Strings.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Preview.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.Remoting.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.Remoting.dll
-
-
-
-
-
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.XmlSerializers.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Strings.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
-
-
-
-
- {1c0f6821-66f1-4e03-8f8d-66ed0500beb2}
- DemoShared
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/Config/Settings.xml b/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/Config/Settings.xml
deleted file mode 100644
index be6a4cd..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/Config/Settings.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/ServiceManifest.xml b/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/ServiceManifest.xml
deleted file mode 100644
index 341f4f9..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/PackageRoot/ServiceManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- DemoStatefulService.exe
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/ServiceFabricDemo/DemoStatefulService/Program.cs b/src/ServiceFabricDemo/DemoStatefulService/Program.cs
deleted file mode 100644
index 61074dc..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/Program.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Threading;
-using Autofac;
-using Autofac.Integration.ServiceFabric;
-using DemoShared;
-
-namespace DemoStatefulService
-{
- internal static class Program
- {
- ///
- /// This is the entry point of the service host process.
- ///
- private static void Main()
- {
- try
- {
- // The ServiceManifest.XML file defines one or more service type names.
- // Registering a service maps a service type name to a .NET type.
- // When Service Fabric creates an instance of this service type,
- // an instance of the class is created in this host process.
-
- // Start with the trusty old container builder.
- var builder = new ContainerBuilder();
-
- // Register any regular dependencies.
- builder.RegisterModule(new LoggerModule(ServiceEventSource.Current.Message));
-
- // Register the Autofac magic for Service Fabric support.
- builder.RegisterServiceFabricSupport();
-
- // Register the stateful service.
- builder.RegisterStatefulService("DemoStatefulServiceType");
-
- using (builder.Build())
- {
- ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(DemoStatefulService).Name);
-
- // Prevents this host process from terminating so services keep running.
- Thread.Sleep(Timeout.Infinite);
- }
- }
- catch (Exception e)
- {
- ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
- throw;
- }
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatefulService/Properties/AssemblyInfo.cs b/src/ServiceFabricDemo/DemoStatefulService/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1922711..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DemoStatefulService")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DemoStatefulService")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("ce6a795a-970a-4792-8ade-0f0d5432154b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/ServiceFabricDemo/DemoStatefulService/ServiceEventSource.cs b/src/ServiceFabricDemo/DemoStatefulService/ServiceEventSource.cs
deleted file mode 100644
index d82bb4e..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/ServiceEventSource.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-using System;
-using System.Diagnostics.Tracing;
-using System.Fabric;
-using System.Threading.Tasks;
-
-namespace DemoStatefulService
-{
- [EventSource(Name = "MyCompany-AutofacServiceFabricDemo-DemoStatefulService")]
- internal sealed class ServiceEventSource : EventSource
- {
- public static readonly ServiceEventSource Current = new ServiceEventSource();
-
- static ServiceEventSource()
- {
- // A workaround for the problem where ETW activities do not get tracked until Tasks infrastructure is initialized.
- // This problem will be fixed in .NET Framework 4.6.2.
- Task.Run(() => { });
- }
-
- // Instance constructor is private to enforce singleton semantics
- private ServiceEventSource() : base() { }
-
- #region Keywords
- // Event keywords can be used to categorize events.
- // Each keyword is a bit flag. A single event can be associated with multiple keywords (via EventAttribute.Keywords property).
- // Keywords must be defined as a public class named 'Keywords' inside EventSource that uses them.
- public static class Keywords
- {
- public const EventKeywords Requests = (EventKeywords)0x1L;
- public const EventKeywords ServiceInitialization = (EventKeywords)0x2L;
- }
- #endregion
-
- #region Events
- // Define an instance method for each event you want to record and apply an [Event] attribute to it.
- // The method name is the name of the event.
- // Pass any parameters you want to record with the event (only primitive integer types, DateTime, Guid & string are allowed).
- // Each event method implementation should check whether the event source is enabled, and if it is, call WriteEvent() method to raise the event.
- // The number and types of arguments passed to every event method must exactly match what is passed to WriteEvent().
- // Put [NonEvent] attribute on all methods that do not define an event.
- // For more information see https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx
-
- [NonEvent]
- public void Message(string message, params object[] args)
- {
- if (this.IsEnabled())
- {
- string finalMessage = string.Format(message, args);
- Message(finalMessage);
- }
- }
-
- private const int MessageEventId = 1;
- [Event(MessageEventId, Level = EventLevel.Informational, Message = "{0}")]
- public void Message(string message)
- {
- if (this.IsEnabled())
- {
- WriteEvent(MessageEventId, message);
- }
- }
-
- [NonEvent]
- public void ServiceMessage(StatefulServiceContext serviceContext, string message, params object[] args)
- {
- if (this.IsEnabled())
- {
- string finalMessage = string.Format(message, args);
- ServiceMessage(
- serviceContext.ServiceName.ToString(),
- serviceContext.ServiceTypeName,
- serviceContext.ReplicaId,
- serviceContext.PartitionId,
- serviceContext.CodePackageActivationContext.ApplicationName,
- serviceContext.CodePackageActivationContext.ApplicationTypeName,
- serviceContext.NodeContext.NodeName,
- finalMessage);
- }
- }
-
- // For very high-frequency events it might be advantageous to raise events using WriteEventCore API.
- // This results in more efficient parameter handling, but requires explicit allocation of EventData structure and unsafe code.
- // To enable this code path, define UNSAFE conditional compilation symbol and turn on unsafe code support in project properties.
- private const int ServiceMessageEventId = 2;
- [Event(ServiceMessageEventId, Level = EventLevel.Informational, Message = "{7}")]
- private
-#if UNSAFE
- unsafe
-#endif
- void ServiceMessage(
- string serviceName,
- string serviceTypeName,
- long replicaOrInstanceId,
- Guid partitionId,
- string applicationName,
- string applicationTypeName,
- string nodeName,
- string message)
- {
-#if !UNSAFE
- WriteEvent(ServiceMessageEventId, serviceName, serviceTypeName, replicaOrInstanceId, partitionId, applicationName, applicationTypeName, nodeName, message);
-#else
- const int numArgs = 8;
- fixed (char* pServiceName = serviceName, pServiceTypeName = serviceTypeName, pApplicationName = applicationName, pApplicationTypeName = applicationTypeName, pNodeName = nodeName, pMessage = message)
- {
- EventData* eventData = stackalloc EventData[numArgs];
- eventData[0] = new EventData { DataPointer = (IntPtr) pServiceName, Size = SizeInBytes(serviceName) };
- eventData[1] = new EventData { DataPointer = (IntPtr) pServiceTypeName, Size = SizeInBytes(serviceTypeName) };
- eventData[2] = new EventData { DataPointer = (IntPtr) (&replicaOrInstanceId), Size = sizeof(long) };
- eventData[3] = new EventData { DataPointer = (IntPtr) (&partitionId), Size = sizeof(Guid) };
- eventData[4] = new EventData { DataPointer = (IntPtr) pApplicationName, Size = SizeInBytes(applicationName) };
- eventData[5] = new EventData { DataPointer = (IntPtr) pApplicationTypeName, Size = SizeInBytes(applicationTypeName) };
- eventData[6] = new EventData { DataPointer = (IntPtr) pNodeName, Size = SizeInBytes(nodeName) };
- eventData[7] = new EventData { DataPointer = (IntPtr) pMessage, Size = SizeInBytes(message) };
-
- WriteEventCore(ServiceMessageEventId, numArgs, eventData);
- }
-#endif
- }
-
- private const int ServiceTypeRegisteredEventId = 3;
- [Event(ServiceTypeRegisteredEventId, Level = EventLevel.Informational, Message = "Service host process {0} registered service type {1}", Keywords = Keywords.ServiceInitialization)]
- public void ServiceTypeRegistered(int hostProcessId, string serviceType)
- {
- WriteEvent(ServiceTypeRegisteredEventId, hostProcessId, serviceType);
- }
-
- private const int ServiceHostInitializationFailedEventId = 4;
- [Event(ServiceHostInitializationFailedEventId, Level = EventLevel.Error, Message = "Service host initialization failed", Keywords = Keywords.ServiceInitialization)]
- public void ServiceHostInitializationFailed(string exception)
- {
- WriteEvent(ServiceHostInitializationFailedEventId, exception);
- }
-
- // A pair of events sharing the same name prefix with a "Start"/"Stop" suffix implicitly marks boundaries of an event tracing activity.
- // These activities can be automatically picked up by debugging and profiling tools, which can compute their execution time, child activities,
- // and other statistics.
- private const int ServiceRequestStartEventId = 5;
- [Event(ServiceRequestStartEventId, Level = EventLevel.Informational, Message = "Service request '{0}' started", Keywords = Keywords.Requests)]
- public void ServiceRequestStart(string requestTypeName)
- {
- WriteEvent(ServiceRequestStartEventId, requestTypeName);
- }
-
- private const int ServiceRequestStopEventId = 6;
- [Event(ServiceRequestStopEventId, Level = EventLevel.Informational, Message = "Service request '{0}' finished", Keywords = Keywords.Requests)]
- public void ServiceRequestStop(string requestTypeName, string exception = "")
- {
- WriteEvent(ServiceRequestStopEventId, requestTypeName, exception);
- }
- #endregion
-
- #region Private methods
-#if UNSAFE
- private int SizeInBytes(string s)
- {
- if (s == null)
- {
- return 0;
- }
- else
- {
- return (s.Length + 1) * sizeof(char);
- }
- }
-#endif
- #endregion
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatefulService/packages.config b/src/ServiceFabricDemo/DemoStatefulService/packages.config
deleted file mode 100644
index cb28e90..0000000
--- a/src/ServiceFabricDemo/DemoStatefulService/packages.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatelessService/App.config b/src/ServiceFabricDemo/DemoStatelessService/App.config
deleted file mode 100644
index c116b95..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/App.config
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.cs b/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.cs
deleted file mode 100644
index c521468..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Fabric;
-using System.Threading;
-using System.Threading.Tasks;
-using DemoShared;
-using Microsoft.ServiceFabric.Services.Communication.Runtime;
-using Microsoft.ServiceFabric.Services.Runtime;
-
-namespace DemoStatelessService
-{
- ///
- /// An instance of this class is created for each service instance by the Service Fabric runtime.
- ///
- public class DemoStatelessService : StatelessService, IDisposable
- {
- private readonly ILogger _logger;
-
- public DemoStatelessService(StatelessServiceContext context, ILogger logger)
- : base(context)
- {
- _logger = logger;
-
- _logger.Log("Constructed");
- }
-
- ///
- /// Optional override to create listeners (e.g., TCP, HTTP) for this service replica to handle client or user requests.
- ///
- /// A collection of listeners.
- protected override IEnumerable CreateServiceInstanceListeners()
- {
- return new ServiceInstanceListener[0];
- }
-
- ///
- /// This is the main entry point for your service instance.
- ///
- /// Canceled when Service Fabric needs to shut down this service instance.
- protected override async Task RunAsync(CancellationToken cancellationToken)
- {
- // TODO: Replace the following sample code with your own logic
- // or remove this RunAsync override if it's not needed in your service.
-
- _logger.Log($"{nameof(RunAsync)} invoked");
-
- long iterations = 0;
-
- while (true)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- ServiceEventSource.Current.ServiceMessage(this.Context, "Working-{0}", ++iterations);
-
- await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
-
- if (iterations != 30) continue;
-
- // Restart the replica after 30 seconds to trigger deactivate.
- var fabricClient = new FabricClient();
- await fabricClient.ServiceManager.RemoveReplicaAsync(
- Context.NodeContext.NodeName, Context.PartitionId, Context.ReplicaOrInstanceId);
- }
- }
-
- protected override Task OnCloseAsync(CancellationToken cancellationToken)
- {
- _logger.Log($"{nameof(OnCloseAsync)} invoked");
-
- return base.OnCloseAsync(cancellationToken);
- }
-
- protected override void OnAbort()
- {
- _logger.Log($"{nameof(OnAbort)} invoked");
-
- base.OnAbort();
- }
-
- public void Dispose()
- {
- _logger.Log($"{nameof(Dispose)} invoked");
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.csproj b/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.csproj
deleted file mode 100644
index d861cf0..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/DemoStatelessService.csproj
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- Debug
- x64
- {E695E6B8-9FDC-48F7-B3A1-14395708F71D}
- Exe
- Properties
- DemoStatelessService
- DemoStatelessService
- v4.5.2
- 512
- true
-
-
-
-
- true
- full
- false
- bin\x64\Debug\
- DEBUG;TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- pdbonly
- true
- bin\x64\Release\
- TRACE
- prompt
- x64
- MinimumRecommendedRules.ruleset
-
-
- $(AdditionalFileItemNames);None
-
-
- True
-
-
-
- ..\packages\Autofac.4.6.2\lib\net45\Autofac.dll
-
-
- ..\packages\Autofac.Extras.DynamicProxy.4.2.1\lib\net45\Autofac.Extras.DynamicProxy.dll
-
-
- ..\packages\Autofac.ServiceFabric.1.0.0\lib\net452\Autofac.Integration.ServiceFabric.dll
-
-
- ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll
-
-
-
- ..\packages\Microsoft.ServiceFabric.Actors.2.8.232\lib\net45\Microsoft.ServiceFabric.Actors.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Data.2.8.232\lib\net45\Microsoft.ServiceFabric.Data.Interfaces.dll
- True
-
-
- ..\packages\Microsoft.ServiceFabric.Diagnostics.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.Diagnostics.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.dll
-
-
- ..\packages\Microsoft.ServiceFabric.FabricTransport.Internal.2.8.232\lib\net45\Microsoft.ServiceFabric.FabricTransport.V2.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Internal.Strings.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\Microsoft.ServiceFabric.Preview.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.dll
-
-
- ..\packages\Microsoft.ServiceFabric.Services.Remoting.2.8.232\lib\net45\Microsoft.ServiceFabric.Services.Remoting.dll
-
-
-
-
-
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Management.ServiceModel.XmlSerializers.dll
-
-
- ..\packages\Microsoft.ServiceFabric.6.0.232\lib\net45\System.Fabric.Strings.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
-
-
-
-
- {1c0f6821-66f1-4e03-8f8d-66ed0500beb2}
- DemoShared
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/Config/Settings.xml b/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/Config/Settings.xml
deleted file mode 100644
index ad84ffd..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/Config/Settings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
diff --git a/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/ServiceManifest.xml b/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/ServiceManifest.xml
deleted file mode 100644
index 3b981cc..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/PackageRoot/ServiceManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- DemoStatelessService.exe
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/ServiceFabricDemo/DemoStatelessService/Program.cs b/src/ServiceFabricDemo/DemoStatelessService/Program.cs
deleted file mode 100644
index bf28ef5..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/Program.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Reflection;
-using System.Threading;
-using Autofac;
-using Autofac.Integration.ServiceFabric;
-using DemoShared;
-
-namespace DemoStatelessService
-{
- internal static class Program
- {
- ///
- /// This is the entry point of the service host process.
- ///
- private static void Main()
- {
- try
- {
- // The ServiceManifest.XML file defines one or more service type names.
- // Registering a service maps a service type name to a .NET type.
- // When Service Fabric creates an instance of this service type,
- // an instance of the class is created in this host process.
-
- // Start with the trusty old container builder.
- var builder = new ContainerBuilder();
-
- // Register any regular dependencies.
- builder.RegisterModule(new LoggerModule(ServiceEventSource.Current.Message));
-
- // Register the Autofac magic for Service Fabric support.
- builder.RegisterServiceFabricSupport();
-
- // Register the stateless service.
- builder.RegisterStatelessService("DemoStatelessServiceType");
-
- using (builder.Build())
- {
- ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(DemoStatelessService).Name);
-
- // Prevents this host process from terminating so services keep running.
- Thread.Sleep(Timeout.Infinite);
- }
- }
- catch (Exception e)
- {
- ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
- throw;
- }
- }
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatelessService/Properties/AssemblyInfo.cs b/src/ServiceFabricDemo/DemoStatelessService/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8eaed63..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DemoStatelessService")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DemoStatelessService")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("e695e6b8-9fdc-48f7-b3a1-14395708f71d")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/ServiceFabricDemo/DemoStatelessService/ServiceEventSource.cs b/src/ServiceFabricDemo/DemoStatelessService/ServiceEventSource.cs
deleted file mode 100644
index defe387..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/ServiceEventSource.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-using System;
-using System.Diagnostics.Tracing;
-using System.Fabric;
-using System.Threading.Tasks;
-
-namespace DemoStatelessService
-{
- [EventSource(Name = "MyCompany-AutofacServiceFabricDemo-DemoStatelessService")]
- internal sealed class ServiceEventSource : EventSource
- {
- public static readonly ServiceEventSource Current = new ServiceEventSource();
-
- static ServiceEventSource()
- {
- // A workaround for the problem where ETW activities do not get tracked until Tasks infrastructure is initialized.
- // This problem will be fixed in .NET Framework 4.6.2.
- Task.Run(() => { });
- }
-
- // Instance constructor is private to enforce singleton semantics
- private ServiceEventSource() : base() { }
-
- #region Keywords
- // Event keywords can be used to categorize events.
- // Each keyword is a bit flag. A single event can be associated with multiple keywords (via EventAttribute.Keywords property).
- // Keywords must be defined as a public class named 'Keywords' inside EventSource that uses them.
- public static class Keywords
- {
- public const EventKeywords Requests = (EventKeywords)0x1L;
- public const EventKeywords ServiceInitialization = (EventKeywords)0x2L;
- }
- #endregion
-
- #region Events
- // Define an instance method for each event you want to record and apply an [Event] attribute to it.
- // The method name is the name of the event.
- // Pass any parameters you want to record with the event (only primitive integer types, DateTime, Guid & string are allowed).
- // Each event method implementation should check whether the event source is enabled, and if it is, call WriteEvent() method to raise the event.
- // The number and types of arguments passed to every event method must exactly match what is passed to WriteEvent().
- // Put [NonEvent] attribute on all methods that do not define an event.
- // For more information see https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx
-
- [NonEvent]
- public void Message(string message, params object[] args)
- {
- if (this.IsEnabled())
- {
- string finalMessage = string.Format(message, args);
- Message(finalMessage);
- }
- }
-
- private const int MessageEventId = 1;
- [Event(MessageEventId, Level = EventLevel.Informational, Message = "{0}")]
- public void Message(string message)
- {
- if (this.IsEnabled())
- {
- WriteEvent(MessageEventId, message);
- }
- }
-
- [NonEvent]
- public void ServiceMessage(StatelessServiceContext serviceContext, string message, params object[] args)
- {
- if (this.IsEnabled())
- {
- string finalMessage = string.Format(message, args);
- ServiceMessage(
- serviceContext.ServiceName.ToString(),
- serviceContext.ServiceTypeName,
- serviceContext.InstanceId,
- serviceContext.PartitionId,
- serviceContext.CodePackageActivationContext.ApplicationName,
- serviceContext.CodePackageActivationContext.ApplicationTypeName,
- serviceContext.NodeContext.NodeName,
- finalMessage);
- }
- }
-
- // For very high-frequency events it might be advantageous to raise events using WriteEventCore API.
- // This results in more efficient parameter handling, but requires explicit allocation of EventData structure and unsafe code.
- // To enable this code path, define UNSAFE conditional compilation symbol and turn on unsafe code support in project properties.
- private const int ServiceMessageEventId = 2;
- [Event(ServiceMessageEventId, Level = EventLevel.Informational, Message = "{7}")]
- private
-#if UNSAFE
- unsafe
-#endif
- void ServiceMessage(
- string serviceName,
- string serviceTypeName,
- long replicaOrInstanceId,
- Guid partitionId,
- string applicationName,
- string applicationTypeName,
- string nodeName,
- string message)
- {
-#if !UNSAFE
- WriteEvent(ServiceMessageEventId, serviceName, serviceTypeName, replicaOrInstanceId, partitionId, applicationName, applicationTypeName, nodeName, message);
-#else
- const int numArgs = 8;
- fixed (char* pServiceName = serviceName, pServiceTypeName = serviceTypeName, pApplicationName = applicationName, pApplicationTypeName = applicationTypeName, pNodeName = nodeName, pMessage = message)
- {
- EventData* eventData = stackalloc EventData[numArgs];
- eventData[0] = new EventData { DataPointer = (IntPtr) pServiceName, Size = SizeInBytes(serviceName) };
- eventData[1] = new EventData { DataPointer = (IntPtr) pServiceTypeName, Size = SizeInBytes(serviceTypeName) };
- eventData[2] = new EventData { DataPointer = (IntPtr) (&replicaOrInstanceId), Size = sizeof(long) };
- eventData[3] = new EventData { DataPointer = (IntPtr) (&partitionId), Size = sizeof(Guid) };
- eventData[4] = new EventData { DataPointer = (IntPtr) pApplicationName, Size = SizeInBytes(applicationName) };
- eventData[5] = new EventData { DataPointer = (IntPtr) pApplicationTypeName, Size = SizeInBytes(applicationTypeName) };
- eventData[6] = new EventData { DataPointer = (IntPtr) pNodeName, Size = SizeInBytes(nodeName) };
- eventData[7] = new EventData { DataPointer = (IntPtr) pMessage, Size = SizeInBytes(message) };
-
- WriteEventCore(ServiceMessageEventId, numArgs, eventData);
- }
-#endif
- }
-
- private const int ServiceTypeRegisteredEventId = 3;
- [Event(ServiceTypeRegisteredEventId, Level = EventLevel.Informational, Message = "Service host process {0} registered service type {1}", Keywords = Keywords.ServiceInitialization)]
- public void ServiceTypeRegistered(int hostProcessId, string serviceType)
- {
- WriteEvent(ServiceTypeRegisteredEventId, hostProcessId, serviceType);
- }
-
- private const int ServiceHostInitializationFailedEventId = 4;
- [Event(ServiceHostInitializationFailedEventId, Level = EventLevel.Error, Message = "Service host initialization failed", Keywords = Keywords.ServiceInitialization)]
- public void ServiceHostInitializationFailed(string exception)
- {
- WriteEvent(ServiceHostInitializationFailedEventId, exception);
- }
-
- // A pair of events sharing the same name prefix with a "Start"/"Stop" suffix implicitly marks boundaries of an event tracing activity.
- // These activities can be automatically picked up by debugging and profiling tools, which can compute their execution time, child activities,
- // and other statistics.
- private const int ServiceRequestStartEventId = 5;
- [Event(ServiceRequestStartEventId, Level = EventLevel.Informational, Message = "Service request '{0}' started", Keywords = Keywords.Requests)]
- public void ServiceRequestStart(string requestTypeName)
- {
- WriteEvent(ServiceRequestStartEventId, requestTypeName);
- }
-
- private const int ServiceRequestStopEventId = 6;
- [Event(ServiceRequestStopEventId, Level = EventLevel.Informational, Message = "Service request '{0}' finished", Keywords = Keywords.Requests)]
- public void ServiceRequestStop(string requestTypeName, string exception = "")
- {
- WriteEvent(ServiceRequestStopEventId, requestTypeName, exception);
- }
- #endregion
-
- #region Private methods
-#if UNSAFE
- private int SizeInBytes(string s)
- {
- if (s == null)
- {
- return 0;
- }
- else
- {
- return (s.Length + 1) * sizeof(char);
- }
- }
-#endif
- #endregion
- }
-}
diff --git a/src/ServiceFabricDemo/DemoStatelessService/packages.config b/src/ServiceFabricDemo/DemoStatelessService/packages.config
deleted file mode 100644
index cb28e90..0000000
--- a/src/ServiceFabricDemo/DemoStatelessService/packages.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file