├── .codecov.yml
├── .editorconfig
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── discussion.md
│ ├── feature_request.md
│ ├── proposal.md
│ └── question.md
├── pull_request_template.md
├── scripts
│ └── get_release_version.py
└── workflows
│ └── build.yaml
├── .gitignore
├── CODEOWNERS
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── all.sln
├── all.v3.ncrunchsolution
├── img
├── ConsulSample_HealthyServices.png
└── ConsulSample_StartupProjects.png
├── properties
├── dapr_sidekick.snk
├── dapr_sidekick_common.props
├── dapr_sidekick_csharp.props
├── dapr_sidekick_nuget.props
└── dapr_sidekick_package_icon.png
├── samples
├── Actor
│ ├── ActorSample
│ │ ├── ActorSample.ActorClient
│ │ │ ├── ActorSample.ActorClient.csproj
│ │ │ └── Program.cs
│ │ ├── ActorSample.DemoActor
│ │ │ ├── ActorSample.DemoActor.csproj
│ │ │ ├── BankService.cs
│ │ │ ├── DemoActor.cs
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ └── Startup.cs
│ │ ├── ActorSample.IDemoActor
│ │ │ ├── ActorSample.IDemoActor.csproj
│ │ │ ├── IBankActor.cs
│ │ │ └── IDemoActor.cs
│ │ └── README.md
│ └── README.md
├── AspNetCore
│ ├── AppConfigurationSample
│ │ ├── AppConfigurationSample
│ │ │ ├── AppConfigurationSample.csproj
│ │ │ ├── Controllers
│ │ │ │ └── SampleController.cs
│ │ │ ├── Dapr
│ │ │ │ ├── Components
│ │ │ │ │ └── secretstore.yaml
│ │ │ │ └── secrets.json
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── appsettings.Development.json
│ │ │ └── appsettings.json
│ │ └── README.md
│ ├── ConsulSample
│ │ ├── ConsulSample.Receiver
│ │ │ ├── ConsulSample.Receiver.csproj
│ │ │ ├── Controllers
│ │ │ │ └── WeatherForecastController.cs
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── Startup.cs
│ │ │ ├── WeatherForecast.cs
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ └── dapr
│ │ │ │ └── config.yaml
│ │ ├── ConsulSample.Sender
│ │ │ ├── ConsulSample.Sender.csproj
│ │ │ ├── Controllers
│ │ │ │ └── SenderController.cs
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── Startup.cs
│ │ │ ├── WeatherForecast.cs
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ └── dapr
│ │ │ │ └── config.yaml
│ │ └── README.md
│ ├── ControllerSample
│ │ ├── ControllerSample
│ │ │ ├── Account.cs
│ │ │ ├── ControllerSample.csproj
│ │ │ ├── Controllers
│ │ │ │ └── SampleController.cs
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── Startup.cs
│ │ │ ├── Transaction.cs
│ │ │ ├── appsettings.json
│ │ │ └── sample.http
│ │ └── README.md
│ ├── PlacementSample
│ │ ├── PlacementSample
│ │ │ ├── PlacementSample.csproj
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ │ └── launchSettings.json
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ ├── dapr
│ │ │ │ └── config.yaml
│ │ │ └── placement
│ │ │ │ └── config.yaml
│ │ └── README.md
│ ├── README.md
│ ├── SchedulerSample
│ │ ├── README.md
│ │ └── SchedulerSample
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ └── launchSettings.json
│ │ │ ├── SchedulerSample.csproj
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ ├── dapr
│ │ │ └── config.yaml
│ │ │ └── scheduler
│ │ │ └── config.yaml
│ ├── SentrySample
│ │ ├── README.md
│ │ └── SentrySample
│ │ │ ├── Program.cs
│ │ │ ├── Properties
│ │ │ └── launchSettings.json
│ │ │ ├── SentrySample.csproj
│ │ │ ├── appsettings.Development.json
│ │ │ ├── appsettings.json
│ │ │ ├── dapr
│ │ │ └── config.yaml
│ │ │ └── sentry
│ │ │ ├── certs
│ │ │ ├── ca.crt
│ │ │ ├── issuer.crt
│ │ │ └── issuer.key
│ │ │ └── config.yaml
│ └── ServiceInvocationSample
│ │ ├── README.md
│ │ └── ServiceInvocationSample
│ │ ├── Controllers
│ │ └── WeatherForecastController.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ └── launchSettings.json
│ │ ├── ServiceInvocationSample.csproj
│ │ ├── Startup.cs
│ │ ├── WeatherForecast.cs
│ │ └── appsettings.json
├── Directory.Build.props
├── NetFramework
│ ├── README.md
│ └── WcfSample
│ │ ├── README.md
│ │ └── WcfSample
│ │ ├── IWeatherForecastService.cs
│ │ ├── Program.cs
│ │ ├── WcfSample.csproj
│ │ ├── WeatherForecast.cs
│ │ └── WeatherForecastService.cs
├── README.md
└── Workflow
│ └── ConsoleSample
│ └── WorkflowConsoleApp
│ ├── Activities
│ ├── NotifyActivity.cs
│ ├── ProcessPaymentActivity.cs
│ ├── RequestApprovalActivity.cs
│ ├── ReserveInventoryActivity.cs
│ └── UpdateInventoryActivity.cs
│ ├── Models.cs
│ ├── Program.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── WorkflowConsoleApp.csproj
│ ├── Workflows
│ └── OrderProcessingWorkflow.cs
│ ├── appsettings.json
│ └── demo.http
├── src
├── Directory.build.props
├── Man.Dapr.Sidekick.AspNetCore
│ ├── AssemblyInfo.cs
│ ├── DaprHostedService.cs
│ ├── DaprProcessHealthCheck.cs
│ ├── DaprServiceCollectionExtensions.cs
│ ├── DaprSidekickBuilder.cs
│ ├── DaprSidekickServiceCollectionExtensions.cs
│ ├── Http
│ │ ├── DaprHttpContextHttpClientFactory.cs
│ │ ├── HttpContextInvocationHandler.cs
│ │ └── HttpHeaderConstants.cs
│ ├── IDaprSidekickBuilder.cs
│ ├── Man.Dapr.Sidekick.AspNetCore.csproj
│ ├── Metrics
│ │ ├── DaprMetricsConstants.cs
│ │ ├── DaprMetricsMiddlewareExtensions.cs
│ │ ├── DaprMetricsServerMiddleware.cs
│ │ ├── DaprMetricsTextSerializer.cs
│ │ ├── DaprProcessHostPrometheusCollector.cs
│ │ ├── IDaprMetricsCollector.cs
│ │ ├── IDaprMetricsCollectorRegistry.cs
│ │ ├── IDaprMetricsSerializer.cs
│ │ ├── IPrometheusCollector.cs
│ │ ├── IPrometheusMetricFilter.cs
│ │ ├── PROMETHEUS_LICENSE
│ │ ├── PrometheusCollectorRegistry.cs
│ │ ├── PrometheusLabelEnricher.cs
│ │ ├── PrometheusModel.cs
│ │ └── PrometheusTextReader.cs
│ ├── Placement
│ │ ├── DaprPlacementHealthCheck.cs
│ │ ├── DaprPlacementHealthCheckBuilderExtensions.cs
│ │ ├── DaprPlacementHostedService.cs
│ │ ├── DaprPlacementMetricsCollector.cs
│ │ └── DaprPlacementSidecarHostedService.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Scheduler
│ │ ├── DaprSchedulerHealthCheck.cs
│ │ ├── DaprSchedulerHealthCheckBuilderExtensions.cs
│ │ ├── DaprSchedulerHostedService.cs
│ │ ├── DaprSchedulerMetricsCollector.cs
│ │ └── DaprSchedulerSidecarHostedService.cs
│ ├── Sentry
│ │ ├── DaprSentryHealthCheck.cs
│ │ ├── DaprSentryHealthCheckBuilderExtensions.cs
│ │ ├── DaprSentryHostedService.cs
│ │ ├── DaprSentryMetricsCollector.cs
│ │ └── DaprSentrySidecarHostedService.cs
│ └── Sidecar
│ │ ├── DaprSidecarHealthCheck.cs
│ │ ├── DaprSidecarHealthCheckBuilderExtensions.cs
│ │ ├── DaprSidecarHostedService.cs
│ │ ├── DaprSidecarMetricFilter.cs
│ │ └── DaprSidecarMetricsCollector.cs
├── Man.Dapr.Sidekick.Extensions.Logging
│ ├── DaprLogger.cs
│ ├── DaprLoggerFactory.cs
│ └── Man.Dapr.Sidekick.Extensions.Logging.csproj
└── Man.Dapr.Sidekick
│ ├── AssemblyInfo.cs
│ ├── DaprClient
│ ├── DAPR_DOTNET_SDK_LICENSE
│ ├── DaprClient.cs
│ ├── DirectInvocationHandler.cs
│ └── InvocationHandler.cs
│ ├── DaprConstants.cs
│ ├── DaprDisposable.cs
│ ├── DaprPlacementHost.cs
│ ├── DaprSchedulerHost.cs
│ ├── DaprSentryHost.cs
│ ├── DaprSidecarHost.cs
│ ├── DaprSidecarHost.net35.cs
│ ├── DaprSidecarHost.net45.cs
│ ├── DaprSidekick.cs
│ ├── DaprSidekickBuilder.cs
│ ├── Http
│ ├── DaprProcessHttpClientFactory.cs
│ ├── DaprProcessHttpClientFactory.net35.cs
│ ├── DaprProcessHttpClientFactory.net45.cs
│ ├── DaprSidecarHttpClientFactory.cs
│ ├── DaprSidecarHttpClientFactory.net35.cs
│ ├── DaprSidecarHttpClientFactory.net45.cs
│ ├── IDaprProcessHttpClientFactory.cs
│ ├── IDaprSidecarHttpClientFactory.cs
│ └── UriHelper.cs
│ ├── IDaprPlacementHost.cs
│ ├── IDaprSchedulerHost.cs
│ ├── IDaprSentryHost.cs
│ ├── IDaprSidecarHost.cs
│ ├── IDaprSidecarHost.net35.cs
│ ├── IDaprSidecarHost.net45.cs
│ ├── Logging
│ ├── DaprColoredConsoleLoggerFactory.cs
│ ├── DaprColoredConsoleLoggerOptions.cs
│ ├── DaprEventId.cs
│ ├── DaprLogLevel.cs
│ ├── DaprLoggerExtensions.cs
│ ├── DaprLoggerFactoryBase.cs
│ ├── DaprLoggerFactoryExtensions.cs
│ ├── DaprLoggerOfT.cs
│ ├── IDaprLogger.cs
│ ├── IDaprLoggerFactory.cs
│ ├── Internal
│ │ ├── DaprColoredConsoleLogger.cs
│ │ ├── DaprFormattedLogValues.cs
│ │ ├── DaprLogValuesFormatter.cs
│ │ ├── ISystemConsole.cs
│ │ ├── SystemConsole.cs
│ │ └── TypeNameHelper.cs
│ └── NET_EXTENSIONS_LICENSE
│ ├── Man.Dapr.Sidekick.csproj
│ ├── Native
│ ├── NativeChildProcessTracker.cs
│ └── NativeProcess.cs
│ ├── Options
│ ├── DaprManagedProcessOptions.cs
│ ├── DaprMetricsOptions.cs
│ ├── DaprOptions.cs
│ ├── DaprPlacementOptions.cs
│ ├── DaprProcessOptions.cs
│ ├── DaprSchedulerOptions.cs
│ ├── DaprSentryOptions.cs
│ └── DaprSidecarOptions.cs
│ ├── Process
│ ├── AttachedProcess.cs
│ ├── CommandLineArgumentBuilder.cs
│ ├── DaprHealthResult.cs
│ ├── DaprPlacementProcess.cs
│ ├── DaprProcess.cs
│ ├── DaprProcessEvents.cs
│ ├── DaprProcessFactory.cs
│ ├── DaprProcessHost.cs
│ ├── DaprProcessHost.net35.cs
│ ├── DaprProcessHost.net45.cs
│ ├── DaprProcessInfo.cs
│ ├── DaprProcessLogRecord.cs
│ ├── DaprProcessLogger.cs
│ ├── DaprSchedulerProcess.cs
│ ├── DaprSentryProcess.cs
│ ├── DaprSidecarProcess.cs
│ ├── Enumerations.cs
│ ├── EnvironmentVariableBuilder.cs
│ ├── IDaprPlacementProcess.cs
│ ├── IDaprProcess.cs
│ ├── IDaprProcessFactory.cs
│ ├── IDaprProcessHost.cs
│ ├── IDaprProcessHost.ne35.cs
│ ├── IDaprProcessHost.net45.cs
│ ├── IDaprProcessUpdater.cs
│ ├── IDaprSchedulerProcess.cs
│ ├── IDaprSentryProcess.cs
│ ├── IDaprSidecarProcess.cs
│ ├── IDaprSidecarProcessInterceptor.cs
│ ├── IPortAvailabilityChecker.cs
│ ├── IProcess.cs
│ ├── IProcessCommandLine.cs
│ ├── IProcessFinder.cs
│ ├── ISystemProcessController.cs
│ ├── ManagedProcess.cs
│ ├── PortAssignmentBuilder.cs
│ ├── PortAvailabilityChecker.cs
│ ├── ProcessCommandLine.cs
│ ├── ProcessFinder.cs
│ ├── SystemProcess.cs
│ └── SystemProcessController.cs
│ ├── Security
│ ├── DaprApiTokenManager.cs
│ ├── IDaprApiTokenAccessor.cs
│ ├── IDaprApiTokenManager.cs
│ ├── IDaprApiTokenProvider.cs
│ ├── ISensitiveValue.cs
│ ├── ObjectExtensions.cs
│ ├── RandomStringApiTokenProvider.cs
│ ├── SensitiveString.cs
│ └── SensitiveStringConverter.cs
│ ├── StringExtensions.cs
│ └── Threading
│ ├── DaprCancellationToken.cs
│ ├── DaprCancellationToken.net35.cs
│ ├── DaprCancellationToken.net45.cs
│ └── Lazy.net35.cs
└── tests
├── Directory.build.props
├── Man.Dapr.Sidekick.AspNetCore.Tests
├── DaprHostedServiceTests.cs
├── DaprProcessHealthCheckTests.cs
├── DaprServiceCollectionExtensionsTests.cs
├── DaprSidekickBuilderTests.cs
├── DaprSidekickServiceCollectionExtensionsTests.cs
├── Http
│ ├── DaprHttpContextHttpClientFactoryTests.cs
│ ├── HttpContextInvocationHandlerTests.cs
│ ├── MockHttpContext.cs
│ ├── MockHttpContextInvocationHandler.cs
│ ├── MockHttpRequest.cs
│ └── MockHttpResponse.cs
├── Man.Dapr.Sidekick.AspNetCore.Tests.csproj
├── Metrics
│ ├── DaprMetricsMiddlewareExtensionsTests.cs
│ ├── DaprMetricsServerMiddlewareTests.cs
│ ├── DaprMetricsTextSerializerTests.cs
│ ├── DaprProcessHostPrometheusCollectorTests.cs
│ ├── PrometheusCollectorRegistryTests.cs
│ ├── PrometheusLabelEnricherTests.cs
│ ├── PrometheusModelTests.cs
│ └── PrometheusTextReaderTests.cs
├── MockDaprProcessOptions.cs
├── Placement
│ ├── DaprPlacementHealthCheckBuilderExtensionsTests.cs
│ ├── DaprPlacementHealthCheckTests.cs
│ ├── DaprPlacementHostedServiceTests.cs
│ ├── DaprPlacementMetricsCollectorTests.cs
│ └── DaprPlacementSidecarHostedServiceTests.cs
├── Sentry
│ ├── DaprSentryHealthCheckBuilderExtensionsTests.cs
│ ├── DaprSentryHealthCheckTests.cs
│ ├── DaprSentryHostedServiceTests.cs
│ ├── DaprSentryMetricsCollectorTests.cs
│ └── DaprSentrySidecarHostedServiceTests.cs
└── Sidecar
│ ├── DaprSidecarHealthCheckBuilderExtensionsTests.cs
│ ├── DaprSidecarHealthCheckTests.cs
│ ├── DaprSidecarHostedServiceTests.cs
│ ├── DaprSidecarMetricFilterTests.cs
│ └── DaprSidecarMetricsCollectorTests.cs
├── Man.Dapr.Sidekick.Extensions.Logging.Tests
├── DaprLoggerFactoryTests.cs
├── DaprLoggerTests.cs
└── Man.Dapr.Sidekick.Extensions.Logging.Tests.csproj
└── Man.Dapr.Sidekick.Tests
├── DaprClient
├── DaprClientTests.cs
└── InvocationHandlerTests.cs
├── DaprDisposableTests.cs
├── DaprPlacementHostTests.cs
├── DaprSentryHostTests.cs
├── DaprSidecarHostTests.cs
├── DaprSidecarHostTests.net35.cs
├── DaprSidecarHostTests.net45.cs
├── DaprSidekickBuilderTests.cs
├── Http
├── DaprProcessHttpClientFactoryTests.net35.cs
├── DaprProcessHttpClientFactoryTests.net45.cs
├── DaprSidecarHttpClientFactoryTests.net35.cs
├── DaprSidecarHttpClientFactoryTests.net45.cs
├── MockDaprSidecarHttpClientFactory.cs
├── MockHttpClientHandler.cs
└── UriHelperTests.cs
├── Logging
├── DaprColoredConsoleLoggerFactoryTests.cs
├── DaprColoredConsoleLoggerOptionsTests.cs
├── DaprEventIdTests.cs
├── DaprLoggerExtensionsTests.cs
├── DaprLoggerFactoryExtensionsTests.cs
├── DaprLoggerOfTTests.cs
└── Internal
│ ├── DaprColoredConsoleLoggerTests.cs
│ ├── SystemColorTests.cs
│ └── TypeNameHelperTests.cs
├── Man.Dapr.Sidekick.Tests.csproj
├── MockDisposable.cs
├── Options
├── DaprMetricsOptionsTests.cs
├── DaprOptionsTests.cs
├── DaprPlacementOptionsTests.cs
├── DaprProcessOptionsTests.cs
├── DaprSentryOptionsTests.cs
├── DaprSidecarOptionsTests.cs
└── MockDaprProcessOptions.cs
├── Process
├── AttachedProcessTests.cs
├── CommandLineArgumentBuilderTests.cs
├── DaprHealthResultTests.cs
├── DaprPlacementProcessTests.cs
├── DaprProcessFactoryTests.cs
├── DaprProcessHostTests.cs
├── DaprProcessInfoTests.cs
├── DaprProcessLoggerTests.cs
├── DaprProcessTests.cs
├── DaprSchedulerProcessTests.cs
├── DaprSentryProcessTests.cs
├── DaprSidecarProcessTests.cs
├── EnvironmentVariableBuilderTests.cs
├── ManagedProcessTests.cs
├── MockDaprProcess.cs
├── MockDaprProcessOptions.cs
├── MockPortAvailabilityChecker.cs
├── PortAssignmentBuilderTests.cs
├── PortAvailabilityCheckerTests.cs
├── ProcessCommandLineTests.cs
├── ProcessFinderTests.cs
└── SystemProcessTests.cs
├── Resources
└── ProcessProgram.cs
├── Security
├── DaprApiTokenManagerTests.cs
├── ObjectExtensionsTests.cs
├── RandomStringApiTokenProviderTests.cs
├── SensitiveStringConverterTests.cs
└── SensitiveStringTests.cs
├── TestResourceHelper.cs
├── Threading
├── DaprCancellationTokenTests.net35.cs
└── DaprCancellationTokenTests.net45.cs
└── _TestHelpers
├── ExtensionMethods.cs
└── LoggerCall.cs
/.codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | status:
3 | project:
4 | default:
5 | # basic
6 | target: auto
7 | threshold: 0%
8 |
9 | ignore:
10 | - test # - tests
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Report a bug in Dapr Sidekick
4 | title: ''
5 | labels: kind/bug
6 | assignees: ''
7 |
8 | ---
9 | ## Expected Behavior
10 |
11 |
12 |
13 | ## Actual Behavior
14 |
15 |
16 |
17 | ## Steps to Reproduce the Problem
18 |
19 |
20 |
21 | ## Release Note
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | RELEASE NOTE:
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/discussion.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Discussion
3 | about: Start a discussion for Dapr Sidekick
4 | title: ''
5 | labels: kind/discussion
6 | assignees: ''
7 |
8 | ---
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature Request
3 | about: Create a Feature Request for Dapr Sidekick
4 | title: ''
5 | labels: kind/enhancement
6 | assignees: ''
7 |
8 | ---
9 | ## Describe the feature
10 |
11 |
12 | ## Release Note
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | RELEASE NOTE:
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/proposal.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Proposal
3 | about: Create a proposal for Dapr Sidekick
4 | title: ''
5 | labels: kind/proposal
6 | assignees: ''
7 |
8 | ---
9 | ## Describe the proposal
10 |
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question
3 | about: Ask a question about Dapr Sidekick
4 | title: ''
5 | labels: kind/question
6 | assignees: ''
7 |
8 | ---
9 | ## Ask your question here
10 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
3 | _Please explain the changes you've made_
4 |
5 | ## Issue reference
6 |
7 | We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
8 |
9 | Please reference the issue this PR will close: #_[issue number]_
10 |
11 | ## Checklist
12 |
13 | Please make sure you've completed the relevant tasks for this PR, out of the following list:
14 |
15 | * [ ] Code compiles correctly
16 | * [ ] Created/updated tests
17 | * [ ] Extended the documentation where possible
18 |
--------------------------------------------------------------------------------
/.github/scripts/get_release_version.py:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------
2 | # Copyright (c) Microsoft Corporation.
3 | # Licensed under the MIT License.
4 | # ------------------------------------------------------------
5 |
6 | # This script parses release version from Git tag and set the parsed version to
7 | # environment variable, REL_VERSION.
8 |
9 | import os
10 | import sys
11 |
12 | gitRef = os.getenv("GITHUB_REF")
13 | tagRefPrefix = "refs/tags/v"
14 |
15 | with open(os.getenv("GITHUB_ENV"), "a") as githubEnv:
16 | if gitRef is None or not gitRef.startswith(tagRefPrefix):
17 | githubEnv.write("REL_VERSION=edge\n")
18 | print ("This is daily build from {}...".format(gitRef))
19 | sys.exit(0)
20 |
21 | releaseVersion = gitRef[len(tagRefPrefix):]
22 | releaseNotePath="docs/release_notes/v{}.md".format(releaseVersion)
23 |
24 | if gitRef.find("-rc.") > 0:
25 | print ("Release Candidate build from {}...".format(gitRef))
26 | else:
27 | # Set LATEST_RELEASE to true
28 | githubEnv.write("LATEST_RELEASE=true\n")
29 | print ("Release build from {}...".format(gitRef))
30 |
31 | githubEnv.write("REL_VERSION={}\n".format(releaseVersion))
32 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # These owners are the maintainers and approvers of this repo
2 | * @dapr-sidekick-maintainers
--------------------------------------------------------------------------------
/all.v3.ncrunchsolution:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | .editorconfig
5 |
6 | True
7 | True
8 | Run Solution Unit Tests automatically [SnapshotShared]
9 | Optimised
10 | True
11 | True
12 |
13 |
14 |
15 | Run Solution Unit Tests automatically
16 |
17 | (DoesNotHaveCategory 'Component' AND DoesNotHaveCategory 'Database' AND DoesNotHaveCategory 'Integration')
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/img/ConsulSample_HealthyServices.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/man-group/dapr-sidekick-dotnet/7a47300a7eeb4fc5c3658554771cf4a51558bf2b/img/ConsulSample_HealthyServices.png
--------------------------------------------------------------------------------
/img/ConsulSample_StartupProjects.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/man-group/dapr-sidekick-dotnet/7a47300a7eeb4fc5c3658554771cf4a51558bf2b/img/ConsulSample_StartupProjects.png
--------------------------------------------------------------------------------
/properties/dapr_sidekick.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/man-group/dapr-sidekick-dotnet/7a47300a7eeb4fc5c3658554771cf4a51558bf2b/properties/dapr_sidekick.snk
--------------------------------------------------------------------------------
/properties/dapr_sidekick_common.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(MSBuildThisFileDirectory)..\
6 | minimal
7 |
8 |
--------------------------------------------------------------------------------
/properties/dapr_sidekick_nuget.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Man Group
5 | true
6 | Apache-2.0
7 | images\dapr_sidekick_package_icon.png
8 | Dapr;Sidekick
9 | https://github.com/man-group/dapr-sidekick-dotnet
10 | git
11 | $(RepoRoot)bin\$(Configuration)\nugets
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | true
22 | snupkg
23 |
24 |
25 |
--------------------------------------------------------------------------------
/properties/dapr_sidekick_package_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/man-group/dapr-sidekick-dotnet/7a47300a7eeb4fc5c3658554771cf4a51558bf2b/properties/dapr_sidekick_package_icon.png
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.ActorClient/ActorSample.ActorClient.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.DemoActor/ActorSample.DemoActor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.DemoActor/BankService.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 |
5 | using IDemoActorInterface;
6 |
7 | namespace DaprDemoActor
8 | {
9 | public class BankService
10 | {
11 | // Allow overdraft of up to 50 (of whatever currency).
12 | private readonly decimal _overdraftThreshold = -50m;
13 |
14 | public decimal Withdraw(decimal balance, decimal amount)
15 | {
16 | // Imagine putting some complex auditing logic here in addition to the basics.
17 |
18 | var updated = balance - amount;
19 | if (updated < _overdraftThreshold)
20 | {
21 | throw new OverdraftException(balance, amount);
22 | }
23 |
24 | return updated;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.DemoActor/Program.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace DaprDemoActor
7 | {
8 | using Microsoft.AspNetCore.Hosting;
9 | using Microsoft.Extensions.Hosting;
10 | using Serilog;
11 |
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | // Add Serilog for enhanced console logging.
17 | Log.Logger = new LoggerConfiguration()
18 | .Enrich.FromLogContext()
19 | .WriteTo.Console(outputTemplate: "{Timestamp:HH:mm:ss.fff} [{Level:u3}] [{SourceContext}] {Scope} {Message:lj}{NewLine}{Exception}")
20 | .MinimumLevel.Override("Man.Dapr.Sidekick", Serilog.Events.LogEventLevel.Debug)
21 | .MinimumLevel.Override("Microsoft.AspNetCore", Serilog.Events.LogEventLevel.Warning)
22 | .CreateLogger();
23 |
24 | CreateHostBuilder(args).Build().Run();
25 | }
26 |
27 | public static IHostBuilder CreateHostBuilder(string[] args) =>
28 | Host.CreateDefaultBuilder(args)
29 | .UseSerilog()
30 | .ConfigureWebHostDefaults(webBuilder =>
31 | {
32 | webBuilder.UseStartup();
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.DemoActor/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "DemoActor": {
4 | "commandName": "Project",
5 | "launchBrowser": false,
6 | "environmentVariables": {
7 | "ASPNETCORE_ENVIRONMENT": "Development"
8 | },
9 | "applicationUrl": "http://localhost:5000/"
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.DemoActor/Startup.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace DaprDemoActor
7 | {
8 | using Microsoft.AspNetCore.Builder;
9 | using Microsoft.AspNetCore.Hosting;
10 | using Microsoft.Extensions.Configuration;
11 | using Microsoft.Extensions.DependencyInjection;
12 | using Microsoft.Extensions.Hosting;
13 |
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | public void ConfigureServices(IServiceCollection services)
24 | {
25 | services.AddSingleton();
26 | services.AddActors(options =>
27 | {
28 | options.Actors.RegisterActor();
29 | });
30 |
31 | // Add Dapr Sidekick
32 | services.AddDaprSidekick(Configuration);
33 | }
34 |
35 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
36 | {
37 | if (env.IsDevelopment())
38 | {
39 | app.UseDeveloperExceptionPage();
40 | }
41 | else
42 | {
43 | app.UseHsts();
44 | }
45 |
46 | app.UseRouting();
47 |
48 | app.UseEndpoints(endpoints =>
49 | {
50 | endpoints.MapActorsHandlers();
51 | });
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.IDemoActor/ActorSample.IDemoActor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/Actor/ActorSample/ActorSample.IDemoActor/IBankActor.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace IDemoActorInterface
7 | {
8 | using System;
9 | using System.Threading.Tasks;
10 | using Dapr.Actors;
11 |
12 | public interface IBankActor : IActor
13 | {
14 | Task GetAccountBalance();
15 |
16 | Task Withdraw(WithdrawRequest withdraw);
17 | }
18 |
19 | public class AccountBalance
20 | {
21 | public string AccountId { get; set; }
22 |
23 | public decimal Balance { get; set; }
24 | }
25 |
26 | public class WithdrawRequest
27 | {
28 | public decimal Amount { get; set; }
29 | }
30 |
31 | public class OverdraftException : Exception
32 | {
33 | public OverdraftException(decimal balance, decimal amount)
34 | : base($"Your current balance is {balance:c} - that's not enough to withdraw {amount:c}.")
35 | {
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/samples/Actor/README.md:
--------------------------------------------------------------------------------
1 | # Actor Dapr integration examples
2 |
3 | - [Actor Sample](./ActorSample): How to use Dapr Sidekick to launch Dapr Sidecars and the Placement service and integrate with the Dapr SDK for .NET for virtual actor invocation.
4 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/AppConfigurationSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 | 10
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/Controllers/SampleController.cs:
--------------------------------------------------------------------------------
1 | using Dapr.Client;
2 | using Microsoft.AspNetCore.Mvc;
3 |
4 | namespace AppConfigurationSample.Controllers;
5 |
6 | [ApiController]
7 | [Route("[controller]")]
8 | public class SampleController : ControllerBase
9 | {
10 | [HttpGet(Name = "GetSecret")]
11 | public async Task Get([FromServices] DaprClient daprClient, [FromServices] IConfiguration configuration)
12 | {
13 | // Can read secrets by using the client or IConfiguration through DI as well
14 | var clientSecrets = await daprClient.GetSecretAsync("localsecretstore", "secret");
15 | var clientSecret = string.Join(",", clientSecrets.Select(d => d.Value));
16 |
17 | var configurationSecret = configuration.GetSection("secret").Value;
18 |
19 | return Ok(new
20 | {
21 | SecretFromClient = clientSecret,
22 | SecretFromConfiguration = configurationSecret
23 | });
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/Dapr/Components/secretstore.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Component
3 | metadata:
4 | name: localsecretstore
5 | namespace: default
6 | spec:
7 | type: secretstores.local.file
8 | version: v1
9 | metadata:
10 | - name: secretsFile
11 | value: "Dapr/secrets.json"
12 |
13 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/Dapr/secrets.json:
--------------------------------------------------------------------------------
1 | {
2 | "secret": "YourPasskeyHere"
3 | }
4 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/launchsettings.json",
3 | "profiles": {
4 | "https": {
5 | "commandName": "Project",
6 | "dotnetRunMessages": true,
7 | "launchBrowser": true,
8 | "launchUrl": "swagger",
9 | "applicationUrl": "https://localhost:5000",
10 | "environmentVariables": {
11 | "ASPNETCORE_ENVIRONMENT": "Development"
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/AspNetCore/AppConfigurationSample/AppConfigurationSample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/ConsulSample.Receiver.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Always
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Hosting;
3 | using Serilog;
4 |
5 | namespace ConsulSample.Receiver
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | // Add Serilog for enhanced console logging.
12 | Log.Logger = new LoggerConfiguration()
13 | .Enrich.FromLogContext()
14 | .WriteTo.Console()
15 | .CreateLogger();
16 |
17 | CreateHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IHostBuilder CreateHostBuilder(string[] args) =>
21 | Host.CreateDefaultBuilder(args)
22 | .UseSerilog()
23 | .ConfigureWebHostDefaults(webBuilder =>
24 | {
25 | webBuilder.UseStartup();
26 | });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "profiles": {
4 | "ConsulSample.Receiver": {
5 | "commandName": "Project",
6 | "dotnetRunMessages": "true",
7 | "launchBrowser": false,
8 | "launchUrl": "swagger",
9 | "applicationUrl": "http://localhost:5001",
10 | "environmentVariables": {
11 | "ASPNETCORE_ENVIRONMENT": "Development"
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ConsulSample.Receiver
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "DaprSidekick": {
3 | // Set the runtime location of config/components files to be the "dapr" folder under the deployed application
4 | "RuntimeDirectory": "dapr"
5 | },
6 | "Logging": {
7 | "LogLevel": {
8 | "Default": "Information",
9 | "Microsoft": "Warning",
10 | "Microsoft.Hosting.Lifetime": "Information"
11 | }
12 | },
13 | "AllowedHosts": "*"
14 | }
15 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Receiver/dapr/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | spec:
4 | nameResolution:
5 | component: "consul"
6 | configuration:
7 | selfRegister: true
8 | tags:
9 | - "dapr"
10 | checks:
11 | - name: "Service Health Status"
12 | checkID: "serviceHealth:${APP_ID}"
13 | interval: "5s"
14 | http: "http://127.0.0.1:${APP_PORT}/health"
15 | meta:
16 | DAPR_HTTP_PORT: "${DAPR_HTTP_PORT}"
17 | DAPR_GRPC_PORT: "${DAPR_GRPC_PORT}"
18 | DAPR_METRICS_PORT: "${DAPR_METRICS_PORT}"
19 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/ConsulSample.Sender.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Hosting;
3 | using Serilog;
4 |
5 | namespace ConsulSample.Sender
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | // Add Serilog for enhanced console logging.
12 | Log.Logger = new LoggerConfiguration()
13 | .Enrich.FromLogContext()
14 | .WriteTo.Console()
15 | .CreateLogger();
16 |
17 | CreateHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IHostBuilder CreateHostBuilder(string[] args) =>
21 | Host.CreateDefaultBuilder(args)
22 | .UseSerilog()
23 | .ConfigureWebHostDefaults(webBuilder =>
24 | {
25 | webBuilder.UseStartup();
26 | });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "profiles": {
4 | "ConsulSample.Sender": {
5 | "commandName": "Project",
6 | "dotnetRunMessages": "true",
7 | "launchBrowser": true,
8 | "launchUrl": "swagger",
9 | "applicationUrl": "http://localhost:5000",
10 | "environmentVariables": {
11 | "ASPNETCORE_ENVIRONMENT": "Development"
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ConsulSample.Sender
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "DaprSidekick": {
3 | // Set the runtime location of config/components files to be the "dapr" folder under the deployed application
4 | "RuntimeDirectory": "dapr"
5 | },
6 | "Logging": {
7 | "LogLevel": {
8 | "Default": "Information",
9 | "Microsoft": "Warning",
10 | "Microsoft.Hosting.Lifetime": "Information"
11 | }
12 | },
13 | "AllowedHosts": "*"
14 | }
15 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ConsulSample/ConsulSample.Sender/dapr/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | spec:
4 | nameResolution:
5 | component: "consul"
6 | configuration:
7 | selfRegister: true
8 | tags:
9 | - "dapr"
10 | checks:
11 | - name: "Service Health Status"
12 | checkID: "serviceHealth:${APP_ID}"
13 | interval: "5s"
14 | http: "http://127.0.0.1:${APP_PORT}/health"
15 | meta:
16 | DAPR_HTTP_PORT: "${DAPR_HTTP_PORT}"
17 | DAPR_GRPC_PORT: "${DAPR_GRPC_PORT}"
18 | DAPR_METRICS_PORT: "${DAPR_METRICS_PORT}"
19 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/Account.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace ControllerSample
7 | {
8 | ///
9 | /// Class representing an Account for samples.
10 | ///
11 | public class Account
12 | {
13 | ///
14 | /// Gets or sets account id.
15 | ///
16 | public string Id { get; set; }
17 |
18 | ///
19 | /// Gets or sets account balance.
20 | ///
21 | public decimal Balance { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/ControllerSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/Program.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace ControllerSample
7 | {
8 | using Microsoft.AspNetCore.Hosting;
9 | using Microsoft.Extensions.Hosting;
10 | using Serilog;
11 |
12 | ///
13 | /// Controller Sample.
14 | ///
15 | public class Program
16 | {
17 | ///
18 | /// Main for Controller Sample.
19 | ///
20 | /// Arguments.
21 | public static void Main(string[] args)
22 | {
23 | // Add Serilog for enhanced console logging.
24 | Log.Logger = new LoggerConfiguration()
25 | .Enrich.FromLogContext()
26 | .WriteTo.Console()
27 | .CreateLogger();
28 |
29 | CreateHostBuilder(args).Build().Run();
30 | }
31 |
32 | ///
33 | /// Creates WebHost Builder.
34 | ///
35 | /// Arguments.
36 | /// Returns IHostbuilder.
37 | public static IHostBuilder CreateHostBuilder(string[] args) =>
38 | Host.CreateDefaultBuilder(args)
39 | .UseSerilog()
40 | .ConfigureWebHostDefaults(webBuilder =>
41 | {
42 | webBuilder.UseStartup();
43 | });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "ControllerSample": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "environmentVariables": {
7 | "ASPNETCORE_ENVIRONMENT": "Development"
8 | },
9 | "applicationUrl": "http://localhost:5000/"
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/Transaction.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // Licensed under the MIT License.
4 | // ------------------------------------------------------------
5 |
6 | namespace ControllerSample
7 | {
8 | using System.ComponentModel.DataAnnotations;
9 |
10 | ///
11 | /// Represents a transaction used by sample code.
12 | ///
13 | public class Transaction
14 | {
15 | ///
16 | /// Gets or sets account id for the transaction.
17 | ///
18 | [Required]
19 | public string Id { get; set; }
20 |
21 | ///
22 | /// Gets or sets amount for the transaction.
23 | ///
24 | [Range(0, double.MaxValue)]
25 | public decimal Amount { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Serilog": {
3 | "MinimumLevel": "Debug"
4 | },
5 | "Logging": {
6 | "LogLevel": {
7 | "Default": "Debug",
8 | "Microsoft": "Warning",
9 | "Microsoft.Hosting.Lifetime": "Information"
10 | }
11 | },
12 | "AllowedHosts": "*"
13 | }
14 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/ControllerSample/sample.http:
--------------------------------------------------------------------------------
1 | //Deposit Money
2 |
3 | POST http://127.0.0.1:5000/deposit
4 | Content-Type: application/json
5 |
6 | { "id": "17", "amount": 12 }
7 |
8 | ###
9 |
10 | //Withdraw Money
11 |
12 | POST http://127.0.0.1:5000/withdraw
13 | Content-Type: application/json
14 |
15 | { "id": "17", "amount": 5 }
16 |
17 | ###
18 |
19 | //View Balance
20 |
21 | GET http://127.0.0.1:5000/17
22 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ControllerSample/README.md:
--------------------------------------------------------------------------------
1 | # ASP.NET Core Controller example
2 |
3 | This sample shows using Dapr with ASP.NET Core controllers. This application is a simple and not-so-secure banking application. The application uses the Dapr state-store for its data storage. The sample is a copy of the [Dapr .NET SDK Controller example](https://github.com/dapr/dotnet-sdk/tree/master/examples/AspNetCore/ControllerSample), but modified to include Dapr Sidekick integration for launching a Dapr sidecar.
4 |
5 | > See the [original source](https://github.com/dapr/dotnet-sdk/tree/master/examples/AspNetCore/ControllerSample) for more information on how to use the sample.
6 |
7 | ## How Dapr Sidekick was added
8 |
9 | The main change to the template code to add Dapr support can be found in the `ConfigureServices` method in `Startup.cs`:
10 |
11 | ```csharp
12 | public void ConfigureServices(IServiceCollection services)
13 | {
14 | ...
15 | // Add Dapr Sidekick
16 | services.AddDaprSidekick(Configuration);
17 | }
18 | ```
19 |
20 | ## Running the sample
21 |
22 | To run the sample simply set `ControllerSample` as the startup project and run it in Visual Studio, it will launch the Dapr sidecar and connect to it.
23 |
24 | For all further instructions, including prerequisites and testing, please refer to the [original source](https://github.com/dapr/dotnet-sdk/tree/master/examples/AspNetCore/ControllerSample).
25 |
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/PlacementSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 | Always
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/Program.cs:
--------------------------------------------------------------------------------
1 | using Man.Dapr.Sidekick;
2 | using Serilog;
3 |
4 | // Add Serilog for enhanced console logging.
5 | Log.Logger = new LoggerConfiguration()
6 | .Enrich.FromLogContext()
7 | .WriteTo.Console()
8 | .CreateLogger();
9 |
10 | var builder = WebApplication.CreateBuilder(args);
11 |
12 | builder.Services.AddControllers();
13 |
14 | // Add Dapr Sidekick with Placement
15 | builder.Services.AddDaprSidekick(builder.Configuration)
16 | .AddPlacement();
17 |
18 | builder.Host.UseSerilog();
19 |
20 | var app = builder.Build();
21 |
22 | app.MapGet("/status", (IDaprSidecarHost sidecarHost, IDaprPlacementHost placementHost) => Results.Ok(new
23 | {
24 | sidecar = new
25 | {
26 | process = sidecarHost.GetProcessInfo(), // Information about the sidecar process such as if it is running
27 | options = sidecarHost.GetProcessOptions() // The sidecar options if running, including ports and locations
28 | },
29 | placement = new
30 | {
31 | process = placementHost.GetProcessInfo(), // Information about the sentry process such as if it is running
32 | options = placementHost.GetProcessOptions() // The sentry options if running, including ports and locations
33 | },
34 | }));
35 |
36 | // For Dapr
37 | app.MapHealthChecks("/health");
38 |
39 | app.Run();
40 |
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "PlacementSample": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "status",
7 | "environmentVariables": {
8 | "ASPNETCORE_ENVIRONMENT": "Development"
9 | },
10 | "applicationUrl": "http://localhost:5000"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "DaprSidekick": {
3 | "Sidecar": {
4 | "RuntimeDirectory": "dapr"
5 | },
6 | "Placement": {
7 | "RuntimeDirectory": "placement",
8 | "Id": "dapr-placement-0", // Optional unique identifier when used in a cluster
9 | "Port": 6051 // To avoid conflicts with local Dapr Placement container. Sidecar will use this automatically as well.
10 | }
11 | },
12 | "Logging": {
13 | "LogLevel": {
14 | "Default": "Information",
15 | "Microsoft.AspNetCore": "Warning"
16 | }
17 | },
18 | "AllowedHosts": "*"
19 | }
20 |
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/dapr/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 | mtls:
8 | enabled: true
--------------------------------------------------------------------------------
/samples/AspNetCore/PlacementSample/PlacementSample/placement/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 |
--------------------------------------------------------------------------------
/samples/AspNetCore/README.md:
--------------------------------------------------------------------------------
1 | # ASP.NET Core Dapr integration examples
2 |
3 | - [Consul Sample](./ConsulSample): How to use Dapr Sidekick to launch the Dapr Sidecar and invoke remote services using Consul Service Discovery.
4 | - [Controller Sample](./ControllerSample): How to use Dapr Sidekick to launch the Dapr Sidecar integrated with the official Dapr .NET SDK with ASP.NET Core Controllers.
5 | - [Service Invocation Sample](./ServiceInvocationSample): How to use Dapr Sidekick to launch the Dapr Sidecar and invoke local services.
6 |
7 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/Program.cs:
--------------------------------------------------------------------------------
1 | using Man.Dapr.Sidekick;
2 | using Serilog;
3 |
4 | // Add Serilog for enhanced console logging.
5 | Log.Logger = new LoggerConfiguration()
6 | .Enrich.FromLogContext()
7 | .WriteTo.Console()
8 | .CreateLogger();
9 |
10 | var builder = WebApplication.CreateBuilder(args);
11 |
12 | builder.Services.AddControllers();
13 |
14 | // Add Dapr Sidekick with Scheduler
15 | builder.Services.AddDaprSidekick(builder.Configuration)
16 | .AddScheduler();
17 |
18 | builder.Host.UseSerilog();
19 |
20 | var app = builder.Build();
21 |
22 | app.MapGet("/status", (IDaprSidecarHost sidecarHost, IDaprSchedulerHost schedulerHost) => Results.Ok(new
23 | {
24 | sidecar = new
25 | {
26 | process = sidecarHost.GetProcessInfo(), // Information about the sidecar process such as if it is running
27 | options = sidecarHost.GetProcessOptions() // The sidecar options if running, including ports and locations
28 | },
29 | scheduler = new
30 | {
31 | process = schedulerHost.GetProcessInfo(), // Information about the sentry process such as if it is running
32 | options = schedulerHost.GetProcessOptions() // The sentry options if running, including ports and locations
33 | },
34 | }));
35 |
36 | // For Dapr
37 | app.MapHealthChecks("/health");
38 |
39 | app.Run();
40 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "SchedulerSample": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "status",
7 | "environmentVariables": {
8 | "ASPNETCORE_ENVIRONMENT": "Development"
9 | },
10 | "applicationUrl": "http://localhost:5000"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/SchedulerSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 | Always
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "DaprSidekick": {
3 | "Sidecar": {
4 | "RuntimeDirectory": "dapr"
5 | },
6 | "Scheduler": {
7 | "RuntimeDirectory": "scheduler",
8 | "Id": "dapr-scheduler-server-0", // Optional unique identifier when used in a cluster
9 | "Port": 6061 // To avoid conflicts with local Dapr Scheduler container. Sidecar will use this automatically as well.
10 | }
11 | },
12 | "Logging": {
13 | "LogLevel": {
14 | "Default": "Information",
15 | "Microsoft.AspNetCore": "Warning"
16 | }
17 | },
18 | "AllowedHosts": "*"
19 | }
20 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/dapr/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 | mtls:
8 | enabled: true
--------------------------------------------------------------------------------
/samples/AspNetCore/SchedulerSample/SchedulerSample/scheduler/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "SentrySample": {
4 | "commandName": "Project",
5 | "launchBrowser": true,
6 | "launchUrl": "status",
7 | "environmentVariables": {
8 | "ASPNETCORE_ENVIRONMENT": "Development"
9 | },
10 | "applicationUrl": "http://localhost:5000"
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/SentrySample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 | Always
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "DaprSidekick": {
3 | "Sidecar": {
4 | "mTLS": true,
5 | "RuntimeDirectory": "dapr",
6 | "SentryAddress": "localhost:50001"
7 | },
8 | "Sentry": {
9 | "RuntimeDirectory": "sentry",
10 | "TrustDomain": "cluster.local" // Certificates in /certs folder generated for this domain
11 | }
12 | },
13 | "Logging": {
14 | "LogLevel": {
15 | "Default": "Information",
16 | "Microsoft.AspNetCore": "Warning"
17 | }
18 | },
19 | "AllowedHosts": "*"
20 | }
21 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/dapr/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 | mtls:
8 | enabled: true
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/sentry/certs/ca.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIBcjCCARegAwIBAgIRAPNjhmnvu5t1cT4RleqbpIgwCgYIKoZIzj0EAwIwGDEW
3 | MBQGA1UEChMNY2x1c3Rlci5sb2NhbDAeFw0yNDA0MDkxNjMxNDVaFw0yNTA0MDkx
4 | NjQ2NDVaMBgxFjAUBgNVBAoTDWNsdXN0ZXIubG9jYWwwWTATBgcqhkjOPQIBBggq
5 | hkjOPQMBBwNCAAQnuU4Xu2OicVtxHSvpByI4Q3v3Ld4UKpMKvR3+iPs0goJRmkOd
6 | +rgKfUJRu99Al89iF1Jc0xp2G3hqsTJzRNGmo0IwQDAOBgNVHQ8BAf8EBAMCAqQw
7 | DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUClFVts/NEUrgwtxGRVHYdsr5MkAw
8 | CgYIKoZIzj0EAwIDSQAwRgIhAL1kZ/CgvaVstjh6Wl7Xpq9S5cqL/uDBP8qA535J
9 | gEEhAiEAiPkgINWSCjvunsyCS2MzGRqzXS5F9hSMsl8JJvAAk3A=
10 | -----END CERTIFICATE-----
11 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/sentry/certs/issuer.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIBqzCCAVGgAwIBAgIRAIwB5uvnwvPxdYpnXs68vxAwCgYIKoZIzj0EAwIwGDEW
3 | MBQGA1UEChMNY2x1c3Rlci5sb2NhbDAeFw0yNDA0MDkxNjMxNDVaFw0yNTA0MDkx
4 | NjQ2NDVaMDgxNjA0BgNVBAoTLXNwaWZmZTovL2NsdXN0ZXIubG9jYWwvbnMvZGVm
5 | YXVsdC9kYXByLXNlbnRyeTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIlCFe0s
6 | g2hyCoT+jtFfIUKPLcJmT6kI1cOWhd9lEdKxRQQK0WAIpgLoBU1dV/bQEh2vTI7h
7 | +UP8JYTib6RLy5mjXDBaMA4GA1UdDwEB/wQEAwIBpjAPBgNVHRMBAf8EBTADAQH/
8 | MB0GA1UdDgQWBBRDRvGl7xL2km4sd7pln3ayKZEv3DAYBgNVHREEETAPgg1jbHVz
9 | dGVyLmxvY2FsMAoGCCqGSM49BAMCA0gAMEUCIGMbBjjNPM2lgSojy4Zdr3EZO4qZ
10 | 7QUC39qit7zrHEaUAiEA2GHEgHHu7gJdDoTz9Up+jSjIfDIRNgOqUpHsldEwN0c=
11 | -----END CERTIFICATE-----
12 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/sentry/certs/issuer.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgwVI9SsqI5owZm19/
3 | NI2uN4yp9WkqE8W8/zhM4AZOvwahRANCAASJQhXtLINocgqE/o7RXyFCjy3CZk+p
4 | CNXDloXfZRHSsUUECtFgCKYC6AVNXVf20BIdr0yO4flD/CWE4m+kS8uZ
5 | -----END PRIVATE KEY-----
6 |
--------------------------------------------------------------------------------
/samples/AspNetCore/SentrySample/SentrySample/sentry/config.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: dapr.io/v1alpha1
2 | kind: Configuration
3 | metadata:
4 | name: daprsystem
5 | namespace: default
6 | spec:
7 | mtls:
8 | enabled: true
9 | workloadCertTTL: "24h"
10 | allowedClockSkew: "15m"
11 | accessControl:
12 | defaultAction: allow
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/Program.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.Hosting;
3 | using Serilog;
4 |
5 | namespace ServiceInvocationSample
6 | {
7 | public class Program
8 | {
9 | public static void Main(string[] args)
10 | {
11 | // Add Serilog for enhanced console logging.
12 | Log.Logger = new LoggerConfiguration()
13 | .Enrich.FromLogContext()
14 | .WriteTo.Console()
15 | .CreateLogger();
16 |
17 | CreateHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IHostBuilder CreateHostBuilder(string[] args) =>
21 | Host.CreateDefaultBuilder(args)
22 | .UseSerilog()
23 | .ConfigureWebHostDefaults(webBuilder =>
24 | {
25 | webBuilder.UseStartup();
26 | });
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "profiles": {
4 | "Console": {
5 | "commandName": "Project",
6 | "launchBrowser": true,
7 | "launchUrl": "weatherforecast/status",
8 | "applicationUrl": "http://localhost:5000",
9 | "environmentVariables": {
10 | "ASPNETCORE_ENVIRONMENT": "Development"
11 | }
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/ServiceInvocationSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/Startup.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Builder;
2 | using Microsoft.AspNetCore.Hosting;
3 | using Microsoft.Extensions.Configuration;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 |
7 | namespace ServiceInvocationSample
8 | {
9 | public class Startup
10 | {
11 | public Startup(IConfiguration configuration)
12 | {
13 | Configuration = configuration;
14 | }
15 |
16 | public IConfiguration Configuration { get; }
17 |
18 | // This method gets called by the runtime. Use this method to add services to the container.
19 | public void ConfigureServices(IServiceCollection services)
20 | {
21 | services.AddControllers();
22 |
23 | // Add Dapr Sidekick
24 | services.AddDaprSidekick(Configuration);
25 | }
26 |
27 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
29 | {
30 | if (env.IsDevelopment())
31 | {
32 | app.UseDeveloperExceptionPage();
33 | }
34 |
35 | app.UseRouting();
36 |
37 | app.UseAuthorization();
38 |
39 | app.UseEndpoints(endpoints =>
40 | {
41 | endpoints.MapControllers();
42 |
43 | // For Dapr
44 | endpoints.MapHealthChecks("/health");
45 | });
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ServiceInvocationSample
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/AspNetCore/ServiceInvocationSample/ServiceInvocationSample/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(RepoRoot)bin\$(Configuration)\samples\$(MSBuildProjectName)\
7 | false
8 |
9 |
10 |
--------------------------------------------------------------------------------
/samples/NetFramework/README.md:
--------------------------------------------------------------------------------
1 | # .NET Framework Dapr integration examples
2 |
3 | - [WCF Sample](./WcfSample): How to use Dapr Sidekick to launch the Dapr Sidecar and invoke local services on a WCF HTTP endpoint.
4 |
--------------------------------------------------------------------------------
/samples/NetFramework/WcfSample/WcfSample/IWeatherForecastService.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using System.ServiceModel.Channels;
3 | using System.ServiceModel.Web;
4 |
5 | namespace WcfSample
6 | {
7 | [ServiceContract]
8 | public interface IWeatherForecastService
9 | {
10 | [OperationContract]
11 | [WebGet]
12 | Message Health();
13 |
14 | [OperationContract]
15 | [WebGet]
16 | Message Metadata();
17 |
18 | [OperationContract]
19 | [WebGet]
20 | Message Metrics();
21 |
22 | [OperationContract]
23 | [WebGet]
24 | Message Status();
25 |
26 | [OperationContract]
27 | [WebGet]
28 | Message Weather();
29 |
30 | [OperationContract]
31 | [WebGet]
32 | Message WeatherSidecar();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/samples/NetFramework/WcfSample/WcfSample/WcfSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net45
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/samples/NetFramework/WcfSample/WcfSample/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | namespace WcfSample
5 | {
6 | [DataContract]
7 | public class WeatherForecast
8 | {
9 | [DataMember]
10 | public DateTime Date { get; set; }
11 |
12 | [DataMember]
13 | public int TemperatureC { get; set; }
14 |
15 | [DataMember]
16 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
17 |
18 | [DataMember]
19 | public string Summary { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/samples/README.md:
--------------------------------------------------------------------------------
1 | # Dapr Sidekick samples
2 |
3 | This repository contains samples that highlight the Dapr Sidekick capabilities:
4 |
5 | | Samples | Description |
6 | | -------------------------------- | ----------------------------------------------------------------------------- |
7 | | [Actor](./Actor) | Demonstrates creating virtual actors with the Dapr .NET SDK and Dapr Sidekick |
8 | | [ASP.NET Core](./AspNetCore) | Demonstrates ASP.NET Core integration with Dapr Sidekick |
9 | | [.NET Framework](./NetFramework) | Demonstrates .NET Framework integration with Dapr Sidekick |
10 |
--------------------------------------------------------------------------------
/samples/Workflow/ConsoleSample/WorkflowConsoleApp/Activities/NotifyActivity.cs:
--------------------------------------------------------------------------------
1 | using Dapr.Workflow;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace WorkflowConsoleApp.Activities
5 | {
6 | public class NotifyActivity(ILoggerFactory loggerFactory) : WorkflowActivity
7 | {
8 | private readonly ILogger _logger = loggerFactory.CreateLogger();
9 |
10 | public override Task