├── .codecov.yml ├── .devcontainer ├── Dockerfile ├── devcontainer.json └── localinit.sh ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── discussion.md │ ├── feature_request.md │ ├── proposal.md │ └── question.md ├── holopin.yml ├── pull_request_template.md ├── scripts │ └── get_release_version.py └── workflows │ ├── dapr-bot.yml │ ├── fossa.yml │ ├── itests.yml │ └── sdk_build.yml ├── .gitignore ├── CODEOWNERS ├── CONTRIBUTING.md ├── Directory.Packages.props ├── LICENSE ├── README.md ├── all.sln ├── daprdocs ├── README.md └── content │ └── en │ ├── dotnet-sdk-contributing │ └── dotnet-contributing.md │ └── dotnet-sdk-docs │ ├── _index.md │ ├── dotnet-actors │ ├── _index.md │ ├── dotnet-actors-client.md │ ├── dotnet-actors-howto.md │ ├── dotnet-actors-serialization.md │ └── dotnet-actors-usage.md │ ├── dotnet-ai │ ├── _index.md │ ├── dotnet-ai-conversation-howto.md │ └── dotnet-ai-conversation-usage.md │ ├── dotnet-client │ ├── _index.md │ └── dotnet-daprclient-usage.md │ ├── dotnet-development │ ├── _index.md │ ├── dotnet-development-dapr-aspire.md │ ├── dotnet-development-dapr-cli.md │ ├── dotnet-development-docker-compose.md │ └── dotnet-development-tye.md │ ├── dotnet-error-handling │ ├── _index.md │ └── dotnet-richer-error-model.md │ ├── dotnet-jobs │ ├── _index.md │ ├── dotnet-jobs-howto.md │ └── dotnet-jobsclient-usage.md │ ├── dotnet-messaging │ ├── _index.md │ ├── dotnet-messaging-pubsub-howto.md │ └── dotnet-messaging-pubsub-usage.md │ ├── dotnet-troubleshooting │ ├── _index.md │ └── dotnet-troubleshooting-pubsub.md │ └── dotnet-workflow │ ├── _index.md │ ├── dotnet-workflow-howto.md │ └── dotnet-workflowclient-usage.md ├── docs ├── RELEASE.md └── api-tokens.md ├── examples ├── .editorconfig ├── AI │ └── ConversationalAI │ │ ├── ConversationalAI.csproj │ │ └── Program.cs ├── Actor │ ├── ActorClient │ │ ├── ActorClient.csproj │ │ └── Program.cs │ ├── DemoActor │ │ ├── BankService.cs │ │ ├── DemoActor.cs │ │ ├── DemoActor.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── appsettings.json │ │ └── demo-actor.yaml │ ├── IDemoActor │ │ ├── IBankActor.cs │ │ ├── IDemoActor.cs │ │ └── IDemoActor.csproj │ └── README.md ├── AspNetCore │ ├── ControllerSample │ │ ├── Account.cs │ │ ├── ControllerSample.csproj │ │ ├── Controllers │ │ │ └── SampleController.cs │ │ ├── CustomTopicAttribute.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── Startup.cs │ │ ├── Transaction.cs │ │ ├── TransactionV2.cs │ │ ├── appsettings.json │ │ └── sample.http │ ├── GrpcServiceSample │ │ ├── GrpcServiceSample.csproj │ │ ├── Models │ │ │ ├── Account.cs │ │ │ ├── GetAccountInput.cs │ │ │ └── Transaction.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Protos │ │ │ └── data.proto │ │ ├── README.md │ │ ├── Services │ │ │ └── BankingService.cs │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── README.md │ ├── RoutingSample │ │ ├── Account.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── RoutingSample.csproj │ │ ├── Startup.cs │ │ ├── Transaction.cs │ │ ├── appsettings.json │ │ └── sample.http │ └── SecretStoreConfigurationProviderSample │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── SecretStoreConfigurationProviderSample.csproj │ │ ├── Startup.cs │ │ ├── components │ │ └── secretstore.yaml │ │ └── secrets.json ├── Client │ ├── ConfigurationApi │ │ ├── Components │ │ │ └── redisconfig.yaml │ │ ├── ConfigurationApi.csproj │ │ ├── Controllers │ │ │ └── ConfigurationController.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── Cryptography │ │ ├── Components │ │ │ └── local-storage.yaml │ │ ├── Cryptography.csproj │ │ ├── Example.cs │ │ ├── Examples │ │ │ ├── EncryptDecryptFileStreamExample.cs │ │ │ └── EncryptDecryptStringExample.cs │ │ ├── Program.cs │ │ ├── README.md │ │ ├── file.txt │ │ └── keys │ │ │ └── rsa-private-key.pem │ ├── DistributedLock │ │ ├── Components │ │ │ ├── cronbinding.yaml │ │ │ ├── localstorage.yaml │ │ │ ├── redislock.yaml │ │ │ └── redisstore.yaml │ │ ├── Controllers │ │ │ └── BindingController.cs │ │ ├── DistributedLock.csproj │ │ ├── Model │ │ │ └── StateData.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── Services │ │ │ └── GeneratorService.cs │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── PublishSubscribe │ │ ├── BulkPublishEventExample │ │ │ ├── BulkPublishEventExample.cs │ │ │ ├── BulkPublishEventExample.csproj │ │ │ ├── Example.cs │ │ │ ├── Program.cs │ │ │ └── README.md │ │ ├── PublishEventExample │ │ │ ├── Example.cs │ │ │ ├── Program.cs │ │ │ ├── PublishBytesExample.cs │ │ │ ├── PublishEventExample.cs │ │ │ ├── PublishEventExample.csproj │ │ │ └── README.md │ │ └── StreamingSubscriptionExample │ │ │ ├── Program.cs │ │ │ └── StreamingSubscriptionExample.csproj │ ├── README.md │ ├── ServiceInvocation │ │ ├── Example.cs │ │ ├── InvokeServiceGrpcExample.cs │ │ ├── InvokeServiceHttpClientExample.cs │ │ ├── InvokeServiceHttpExample.cs │ │ ├── Program.cs │ │ ├── README.md │ │ └── ServiceInvocation.csproj │ └── StateManagement │ │ ├── BulkStateExample.cs │ │ ├── Example.cs │ │ ├── Program.cs │ │ ├── README.md │ │ ├── StateManagement.csproj │ │ ├── StateStoreBinaryExample.cs │ │ ├── StateStoreETagsExample.cs │ │ ├── StateStoreExample.cs │ │ └── StateStoreTransactionsExample.cs ├── Directory.Build.props ├── GeneratedActor │ ├── ActorClient │ │ ├── ActorClient.csproj │ │ ├── IClientActor.cs │ │ ├── IGenericClientActor.cs │ │ └── Program.cs │ ├── ActorCommon │ │ ├── ActorCommon.csproj │ │ └── IRemoteActor.cs │ ├── ActorService │ │ ├── ActorService.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── RemoteActor.cs │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ └── README.md ├── Jobs │ └── JobsSample │ │ ├── JobsSample.csproj │ │ ├── Program.cs │ │ └── Properties │ │ └── launchSettings.json ├── README.md └── Workflow │ ├── README.md │ ├── WorkflowAsyncOperations │ ├── Activities │ │ ├── NotifyWarehouseActivity.cs │ │ └── ProcessPaymentActivity.cs │ ├── Models │ │ └── Transaction.cs │ ├── Program.cs │ ├── WorkflowAsyncOperations.csproj │ └── Workflows │ │ └── DemoWorkflow.cs │ ├── WorkflowConsoleApp │ ├── Activities │ │ ├── NotifyActivity.cs │ │ ├── ProcessPaymentActivity.cs │ │ ├── RequestApprovalActivity.cs │ │ ├── ReserveInventoryActivity.cs │ │ └── UpdateInventoryActivity.cs │ ├── Models.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── WorkflowConsoleApp.csproj │ ├── Workflows │ │ └── OrderProcessingWorkflow.cs │ └── demo.http │ ├── WorkflowExternalInteraction │ ├── Activities │ │ ├── ApproveActivity.cs │ │ └── RejectActivity.cs │ ├── Program.cs │ ├── WorkflowExternalInteraction.csproj │ └── Workflows │ │ └── DemoWorkflow.cs │ ├── WorkflowFanOutFanIn │ ├── Activities │ │ └── NotifyActivity.cs │ ├── Program.cs │ ├── WorkflowFanOutFanIn.csproj │ └── Workflows │ │ └── DemoWorkflow.cs │ ├── WorkflowMonitor │ ├── Activities │ │ └── CheckStatus.cs │ ├── Program.cs │ ├── WorkflowMonitor.csproj │ └── Workflows │ │ └── DemoWorkflow.cs │ ├── WorkflowSubworkflow │ ├── Program.cs │ ├── WorkflowSubworkflow.csproj │ └── Workflows │ │ ├── DemoSubWorkflow.cs │ │ └── DemoWorkflow.cs │ ├── WorkflowTaskChaining │ ├── Activities │ │ ├── Step1.cs │ │ ├── Step2.cs │ │ └── Step3.cs │ ├── Program.cs │ ├── WorkflowTaskChaining.csproj │ └── Workflows │ │ └── DemoWorkflow.cs │ └── WorkflowUnitTest │ ├── OrderProcessingTests.cs │ └── WorkflowUnitTest.csproj ├── global.json ├── properties ├── IsExternalInit.cs ├── cs_sdk.snk ├── dapr_common.props ├── dapr_managed_netcore.props ├── dapr_nuget.props ├── logo-transparent.png └── nuget_icon_ms.png ├── src ├── Dapr.AI │ ├── AssemblyInfo.cs │ ├── Conversation │ │ ├── ConversationOptions.cs │ │ ├── DaprConversationClient.cs │ │ ├── DaprConversationClientBuilder.cs │ │ ├── DaprConversationInput.cs │ │ ├── DaprConversationResponse.cs │ │ ├── DaprConversationResult.cs │ │ ├── DaprConversationRole.cs │ │ └── Extensions │ │ │ ├── DaprAiConversationBuilder.cs │ │ │ ├── DaprAiConversationBuilderExtensions.cs │ │ │ └── IDaprAiConversationBuilder.cs │ ├── Dapr.AI.csproj │ ├── DaprAIClient.cs │ └── Extensions │ │ └── IDaprAiServiceBuilder.cs ├── Dapr.Actors.AspNetCore │ ├── ActorsEndpointRouteBuilderExtensions.cs │ ├── ActorsServiceCollectionExtensions.cs │ ├── Dapr.Actors.AspNetCore.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Runtime │ │ ├── DependencyInjectionActorActivator.cs │ │ └── DependencyInjectionActorActivatorFactory.cs ├── Dapr.Actors.Generators │ ├── ActorClientGenerator.cs │ ├── AnalyzerReleases.Shipped.md │ ├── AnalyzerReleases.Unshipped.md │ ├── Constants.cs │ ├── Dapr.Actors.Generators.csproj │ ├── Diagnostics │ │ ├── CancellationTokensMustBeTheLastArgument.cs │ │ └── MethodMustOnlyHaveASingleArgumentOptionallyFollowedByACancellationToken.cs │ ├── DiagnosticsException.cs │ ├── Extensions │ │ └── IEnumerableExtensions.cs │ ├── Helpers │ │ └── SyntaxFactoryHelpers.cs │ ├── Models │ │ └── ActorClientDescriptor.cs │ ├── Properties │ │ └── launchSettings.json │ └── Templates.cs ├── Dapr.Actors │ ├── ActorId.cs │ ├── ActorMethodInvocationException.cs │ ├── ActorReentrancyConfig.cs │ ├── ActorReentrancyContextAccessor.cs │ ├── ActorReference.cs │ ├── Builder │ │ ├── ActorCodeBuilder.cs │ │ ├── ActorCodeBuilderNames.cs │ │ ├── ActorMethodDispatcherBase.cs │ │ ├── ActorProxyGenerator.cs │ │ ├── ActorProxyGeneratorBuildResult.cs │ │ ├── ActorProxyGeneratorBuilder.cs │ │ ├── BuildResult.cs │ │ ├── CodeBuilderAttribute.cs │ │ ├── CodeBuilderContext.cs │ │ ├── CodeBuilderModule.cs │ │ ├── CodeBuilderUtils.cs │ │ ├── ICodeBuilder.cs │ │ ├── ICodeBuilderNames.cs │ │ ├── IProxyActivator.cs │ │ ├── InterfaceDetails.cs │ │ ├── InterfaceDetailsStore.cs │ │ ├── MethodBodyTypes.cs │ │ ├── MethodBodyTypesBuildResult.cs │ │ ├── MethodBodyTypesBuilder.cs │ │ ├── MethodDispatcherBuildResult.cs │ │ └── MethodDispatcherBuilder.cs │ ├── Client │ │ ├── ActorProxy.cs │ │ ├── ActorProxyFactory.cs │ │ ├── ActorProxyOptions.cs │ │ ├── IActorProxy.cs │ │ └── IActorProxyFactory.cs │ ├── ClientSettings.cs │ ├── Common │ │ ├── CRC64.cs │ │ └── IdUtil.cs │ ├── Communication │ │ ├── ActorDataContractSurrogate.cs │ │ ├── ActorInvokeException.cs │ │ ├── ActorInvokeExceptionData.cs │ │ ├── ActorLogicalCallContext.cs │ │ ├── ActorMessageBodyDataContractSerializationProvider.cs │ │ ├── ActorMessageBodyJsonConverter.cs │ │ ├── ActorMessageBodyJsonSerializationProvider.cs │ │ ├── ActorMessageHeaderSerializer.cs │ │ ├── ActorMessageSerializersManager.cs │ │ ├── ActorMethodDispatcherMap.cs │ │ ├── ActorRequestMessage.cs │ │ ├── ActorRequestMessageBody.cs │ │ ├── ActorRequestMessageHeader.cs │ │ ├── ActorResponseMessage.cs │ │ ├── ActorResponseMessageBody.cs │ │ ├── ActorResponseMessageHeader.cs │ │ ├── ActorStateResponse.cs │ │ ├── CacheEntry.cs │ │ ├── Client │ │ │ ├── ActorNonRemotingClient.cs │ │ │ └── ActorRemotingClient.cs │ │ ├── DataContractMessageFactory.cs │ │ ├── DisposableStream.cs │ │ ├── IActorMessageBodyFactory.cs │ │ ├── IActorMessageBodySerializationProvider.cs │ │ ├── IActorMessageHeaderSerializer.cs │ │ ├── IActorRequestMessage.cs │ │ ├── IActorRequestMessageBody.cs │ │ ├── IActorRequestMessageBodySerializer.cs │ │ ├── IActorRequestMessageHeader.cs │ │ ├── IActorResponseMessage.cs │ │ ├── IActorResponseMessageBody.cs │ │ ├── IActorResponseMessageBodySerializer.cs │ │ ├── IActorResponseMessageHeader.cs │ │ ├── WrappedMessage.cs │ │ ├── WrappedMessageBody.cs │ │ └── WrappedRequestMessageFactory.cs │ ├── Constants.cs │ ├── Dapr.Actors.csproj │ ├── DaprHttpInteractor.cs │ ├── Description │ │ ├── ActorInterfaceDescription.cs │ │ ├── InterfaceDescription.cs │ │ ├── MethodArgumentDescription.cs │ │ ├── MethodDescription.cs │ │ ├── MethodReturnCheck.cs │ │ └── TypeUtility.cs │ ├── Extensions │ │ ├── DurationExtensions.cs │ │ └── StringExtensions.cs │ ├── Helper.cs │ ├── IActor.cs │ ├── IActorReference.cs │ ├── IDaprInteractor.cs │ ├── JsonSerializerDefaults.cs │ ├── Resources │ │ ├── SR.Designer.cs │ │ └── SR.resx │ ├── Runtime │ │ ├── Actor.cs │ │ ├── ActorActivator.cs │ │ ├── ActorActivatorFactory.cs │ │ ├── ActorActivatorState.cs │ │ ├── ActorAttribute.cs │ │ ├── ActorCallType.cs │ │ ├── ActorHost.cs │ │ ├── ActorManager.cs │ │ ├── ActorMethodContext.cs │ │ ├── ActorMethodInfoMap.cs │ │ ├── ActorRegistration.cs │ │ ├── ActorRegistrationCollection.cs │ │ ├── ActorReminder.cs │ │ ├── ActorReminderOptions.cs │ │ ├── ActorReminderToken.cs │ │ ├── ActorRuntime.cs │ │ ├── ActorRuntimeOptions.cs │ │ ├── ActorStateChange.cs │ │ ├── ActorStateManager.cs │ │ ├── ActorTestOptions.cs │ │ ├── ActorTimer.cs │ │ ├── ActorTimerManager.cs │ │ ├── ActorTimerOptions.cs │ │ ├── ActorTimerToken.cs │ │ ├── ActorTypeExtensions.cs │ │ ├── ActorTypeInformation.cs │ │ ├── ConditionalValue.cs │ │ ├── ConverterUtils.cs │ │ ├── DaprStateProvider.cs │ │ ├── DefaultActorActivator.cs │ │ ├── DefaultActorActivatorFactory.cs │ │ ├── DefaultActorTimerManager.cs │ │ ├── IActorContextualState.cs │ │ ├── IActorReminder.cs │ │ ├── IActorStateManager.cs │ │ ├── IActorStateSerializer.cs │ │ ├── IRemindable.cs │ │ ├── ReminderInfo.cs │ │ ├── StateChangeKind.cs │ │ └── TimerInfo.cs │ ├── Serialization │ │ └── ActorIdJsonConverter.cs │ └── properties │ │ └── AssemblyInfo.cs ├── Dapr.AspNetCore │ ├── BulkMessageModel.cs │ ├── BulkSubscribeAppResponse.cs │ ├── BulkSubscribeAppResponseEntry.cs │ ├── BulkSubscribeAppResponseStatus.cs │ ├── BulkSubscribeAttribute.cs │ ├── BulkSubscribeMessage.cs │ ├── BulkSubscribeMessageEntry.cs │ ├── BulkSubscribeTopicOptions.cs │ ├── CloudEventPropertyNames.cs │ ├── CloudEventsMiddleware.cs │ ├── CloudEventsMiddlewareOptions.cs │ ├── Dapr.AspNetCore.csproj │ ├── DaprApplicationBuilderExtensions.cs │ ├── DaprAuthenticationBuilderExtensions.cs │ ├── DaprAuthenticationHandler.cs │ ├── DaprAuthenticationOptions.cs │ ├── DaprAuthorizationOptionsExtensions.cs │ ├── DaprEndpointConventionBuilderExtensions.cs │ ├── DaprEndpointRouteBuilderExtensions.cs │ ├── DaprMvcBuilderExtensions.cs │ ├── DaprServiceCollectionExtensions.cs │ ├── FromStateAttribute.cs │ ├── FromStateBindingSource.cs │ ├── IBulkSubscribeMetadata.cs │ ├── IDeadLetterTopicMetadata.cs │ ├── IOriginalTopicMetadata.cs │ ├── IOwnedOriginalTopicMetadata.cs │ ├── IRawTopicMetadata.cs │ ├── ITopicMetadata.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── SR.Designer.cs │ │ └── SR.resx │ ├── StateEntryApplicationModelProvider.cs │ ├── StateEntryModelBinder.cs │ ├── StateEntryModelBinderProvider.cs │ ├── SubscribeOptions.cs │ ├── Subscription.cs │ ├── TopicAttribute.cs │ ├── TopicMetadataAttribute.cs │ └── TopicOptions.cs ├── Dapr.Client │ ├── BindingRequest.cs │ ├── BindingResponse.cs │ ├── BulkPublishEntry.cs │ ├── BulkPublishResponse.cs │ ├── BulkPublishResponseFailedEntry.cs │ ├── BulkStateItem.cs │ ├── CloudEvent.cs │ ├── ConcurrencyMode.cs │ ├── ConfigurationItem.cs │ ├── ConfigurationSource.cs │ ├── ConsistencyMode.cs │ ├── Constants.cs │ ├── Crypto │ │ ├── DecryptionStreamProcessor.cs │ │ └── EncryptionStreamProcessor.cs │ ├── CryptographyEnums.cs │ ├── CryptographyOptions.cs │ ├── Dapr.Client.csproj │ ├── DaprApiException.cs │ ├── DaprClient.cs │ ├── DaprClientBuilder.cs │ ├── DaprClientGrpc.cs │ ├── DaprError.cs │ ├── DaprMetadata.cs │ ├── DaprSubscribeConfigurationSource.cs │ ├── DeleteBulkStateItem.cs │ ├── Extensions │ │ ├── EnumExtensions.cs │ │ ├── HttpExtensions.cs │ │ └── ReadOnlyMemoryExtensions.cs │ ├── GetConfigurationResponse.cs │ ├── InvocationException.cs │ ├── InvocationHandler.cs │ ├── InvocationInterceptor.cs │ ├── SaveStateItem.cs │ ├── StartWorkflowResponse.cs │ ├── StateEntry.cs │ ├── StateOperationType.cs │ ├── StateOptions.cs │ ├── StateQueryException.cs │ ├── StateQueryResponse.cs │ ├── StateTransactionRequest.cs │ ├── SubscribeConfigurationResponse.cs │ ├── TryLockResponse.cs │ ├── TypeConverters.cs │ ├── UnlockResponse.cs │ ├── UnsubscribeConfigurationResponse.cs │ └── properties │ │ └── AssemblyInfo.cs ├── Dapr.Common │ ├── ArgumentVerifier.cs │ ├── AssemblyInfo.cs │ ├── Dapr.Common.csproj │ ├── DaprClientUtilities.cs │ ├── DaprDefaults.cs │ ├── DaprException.cs │ ├── DaprGenericClientBuilder.cs │ ├── Exceptions │ │ ├── DaprExceptionExtensions.cs │ │ ├── DaprExtendedErrorConstants.cs │ │ ├── DaprExtendedErrorDetail.cs │ │ ├── DaprExtendedErrorInfo.cs │ │ ├── DaprExtendedErrorType.cs │ │ └── ExtendedErrorDetailFactory.cs │ ├── Extensions │ │ └── EnumExtensions.cs │ └── JsonConverters │ │ └── GenericEnumJsonConverter.cs ├── Dapr.Extensions.Configuration │ ├── Dapr.Extensions.Configuration.csproj │ ├── DaprConfigurationStoreExtension.cs │ ├── DaprConfigurationStoreProvider.cs │ ├── DaprConfigurationStoreSource.cs │ ├── DaprSecretDescriptor.cs │ ├── DaprSecretStoreConfigurationExtensions.cs │ ├── DaprSecretStoreConfigurationProvider.cs │ └── DaprSecretStoreConfigurationSource.cs ├── Dapr.Jobs │ ├── AssemblyInfo.cs │ ├── CronExpressionBuilder.cs │ ├── Dapr.Jobs.csproj │ ├── DaprJobsClient.cs │ ├── DaprJobsClientBuilder.cs │ ├── DaprJobsGrpcClient.cs │ ├── Extensions │ │ ├── DaprJobsServiceCollectionExtensions.cs │ │ ├── DaprSerializationExtensions.cs │ │ ├── EndpointRouteBuilderExtensions.cs │ │ ├── StringExtensions.cs │ │ └── TimeSpanExtensions.cs │ ├── JsonConverters │ │ ├── DaprJobScheduleConverter.cs │ │ └── Iso8601DateTimeJsonConverter.cs │ └── Models │ │ ├── DaprJobSchedule.cs │ │ └── Responses │ │ └── DaprJobDetails.cs ├── Dapr.Messaging │ ├── AssemblyInfo.cs │ ├── Dapr.Messaging.csproj │ └── PublishSubscribe │ │ ├── DaprPublishSubscribeClient.cs │ │ ├── DaprPublishSubscribeClientBuilder.cs │ │ ├── DaprPublishSubscribeGrpcClient.cs │ │ ├── DaprSubscriptionOptions.cs │ │ ├── Extensions │ │ └── PublishSubscribeServiceCollectionExtensions.cs │ │ ├── MessageHandlingPolicy.cs │ │ ├── PublishSubscribeReceiver.cs │ │ ├── TopicMessage.cs │ │ ├── TopicMessageHandler.cs │ │ └── TopicResponseAction.cs ├── Dapr.Protos │ ├── Dapr.Protos.csproj │ └── Protos │ │ └── dapr │ │ └── proto │ │ ├── common │ │ └── v1 │ │ │ └── common.proto │ │ └── runtime │ │ └── v1 │ │ ├── appcallback.proto │ │ └── dapr.proto ├── Dapr.Workflow │ ├── Dapr.Workflow.csproj │ ├── DaprWorkflowActivityContext.cs │ ├── DaprWorkflowClient.cs │ ├── DaprWorkflowClientBuilderFactory.cs │ ├── DaprWorkflowContext.cs │ ├── IWorkflowContext.cs │ ├── Workflow.cs │ ├── WorkflowActivity.cs │ ├── WorkflowActivityContext.cs │ ├── WorkflowContext.cs │ ├── WorkflowLoggingService.cs │ ├── WorkflowRetryPolicy.cs │ ├── WorkflowRuntimeOptions.cs │ ├── WorkflowRuntimeStatus.cs │ ├── WorkflowServiceCollectionExtensions.cs │ ├── WorkflowState.cs │ ├── WorkflowTaskFailedException.cs │ ├── WorkflowTaskFailureDetails.cs │ └── WorkflowTaskOptions.cs └── Directory.Build.props └── test ├── Dapr.AI.Test ├── Conversation │ ├── DaprConversationClientBuilderTest.cs │ └── Extensions │ │ └── DaprAiConversationBuilderExtensionsTest.cs └── Dapr.AI.Test.csproj ├── Dapr.Actors.AspNetCore.IntegrationTest.App ├── ActivationTests │ └── DependencyInjectionActor.cs ├── Dapr.Actors.AspNetCore.IntegrationTest.App.csproj ├── Program.cs └── Startup.cs ├── Dapr.Actors.AspNetCore.IntegrationTest ├── ActivationTests.cs ├── AppWebApplicationFactory.cs ├── Dapr.Actors.AspNetCore.IntegrationTest.csproj └── HostingTests.cs ├── Dapr.Actors.AspNetCore.Test ├── ActorHostingTest.cs ├── Dapr.Actors.AspNetCore.Test.csproj ├── DaprActorServiceCollectionExtensionsTest.cs └── Runtime │ ├── ActorsEndpointRouteBuilderExtensionsTests.cs │ └── DependencyInjectionActorActivatorTests.cs ├── Dapr.Actors.Generators.Test ├── ActorClientGeneratorTests.cs ├── AdditionalMetadataReferences.cs ├── CSharpSourceGeneratorVerifier.cs ├── Dapr.Actors.Generators.Test.csproj ├── Extensions │ └── IEnumerableExtensionsTests.cs ├── GlobalUsings.cs └── Helpers │ └── SyntaxFactoryHelpersTests.cs ├── Dapr.Actors.Test ├── ActorCodeBuilderTests.cs ├── ActorIdTests.cs ├── ActorMethodInvocationExceptionTests.cs ├── ActorProxyOptionsTests.cs ├── ActorProxyTests.cs ├── ActorReferenceTests.cs ├── ActorStateManagerTest.cs ├── ActorUnitTestTests.cs ├── ApiTokenTests.cs ├── ConverterUtilsTests.cs ├── Dapr.Actors.Test.csproj ├── DaprFormatTimeSpanTests.cs ├── DaprHttpInteractorTest.cs ├── DaprStateProviderTest.cs ├── Description │ ├── ActorInterfaceDescriptionTests.cs │ ├── InterfaceDescriptionTests.cs │ ├── MethodArgumentDescriptionTests.cs │ └── MethodDescriptionTests.cs ├── Extensions │ ├── DurationExtensionsTests.cs │ └── StringExtensionsTests.cs ├── ITestActor.cs ├── Runtime │ ├── ActorManagerTests.cs │ ├── ActorReminderInfoTests.cs │ ├── ActorRuntimeOptionsTests.cs │ ├── ActorRuntimeTests.cs │ ├── ActorTests.cs │ ├── ActorTypeInformationTests.cs │ ├── DefaultActorActivatorTests.cs │ └── DefaultActorTimerManagerTests.cs ├── Serialization │ ├── ActorIdDataContractSerializationTest.cs │ ├── ActorIdJsonConverterTest.cs │ └── TimerInfoJsonConverterTest.cs └── TestDaprInteractor.cs ├── Dapr.AspNetCore.IntegrationTest.App ├── CustomTopicAttribute.cs ├── Dapr.AspNetCore.IntegrationTest.App.csproj ├── DaprController.cs ├── Program.cs ├── Startup.cs ├── UserInfo.cs └── Widget.cs ├── Dapr.AspNetCore.IntegrationTest ├── AppWebApplicationFactory.cs ├── AuthenticationTest.cs ├── CloudEventsIntegrationTest.cs ├── ControllerIntegrationTest.cs ├── Dapr.AspNetCore.IntegrationTest.csproj ├── RoutingIntegrationTest.cs ├── StateTestClient.cs └── SubscribeEndpointTest.cs ├── Dapr.AspNetCore.Test ├── CloudEventsMiddlewareTest.cs ├── Dapr.AspNetCore.Test.csproj ├── DaprClientBuilderTest.cs ├── DaprMvcBuilderExtensionsTest.cs ├── DaprServiceCollectionExtensionsTest.cs ├── StateEntryApplicationModelProviderTest.cs └── StateEntryModelBinderTest.cs ├── Dapr.Client.Test ├── ArgumentVerifierTest.cs ├── BulkPublishEventApiTest.cs ├── ConfigurationApiTest.cs ├── ConfigurationSourceTest.cs ├── CryptographyApiTest.cs ├── Dapr.Client.Test.csproj ├── DaprApiTokenTest.cs ├── DaprClientTest.CreateInvokableHttpClientTest.cs ├── DaprClientTest.InvokeMethodAsync.cs ├── DaprClientTest.InvokeMethodGrpcAsync.cs ├── DaprClientTest.cs ├── DistributedLockApiTest.cs ├── Extensions │ ├── EnumExtensionTest.cs │ └── HttpExtensionTest.cs ├── InvocationHandlerTests.cs ├── InvokeBindingApiTest.cs ├── MockClient.cs ├── Protos │ └── test.proto ├── PublishEventApiTest.cs ├── SecretApiTest.cs ├── StateApiTest.cs ├── TryLockResponseTest.cs └── TypeConvertersTest.cs ├── Dapr.Common.Test ├── Dapr.Common.Test.csproj ├── DaprDefaultTest.cs ├── DaprExtendedErrorInfoTest.cs ├── DaprGenericClientBuilderTest.cs ├── Extensions │ └── EnumExtensionsTest.cs └── JsonConverters │ └── GenericEnumJsonConverterTest.cs ├── Dapr.E2E.Test.Actors.Generators ├── ActorState.cs ├── ActorWebApplicationFactory.cs ├── Clients │ ├── GeneratedClientTests.cs │ ├── IClientActor.cs │ ├── IRemoteActor.cs │ └── RemoteActor.cs ├── Dapr.E2E.Test.Actors.Generators.csproj ├── DaprSidecarFactory.cs ├── GlobalUsings.cs ├── IPingActor.cs ├── PortManager.cs └── XUnitLoggingProvider.cs ├── Dapr.E2E.Test.Actors ├── Dapr.E2E.Test.Actors.csproj ├── ExceptionTesting │ └── IExceptionActor.cs ├── IPingActor.cs ├── ISerializationActor.cs ├── Reentrancy │ ├── CallRecord.cs │ ├── IReentrantActor.cs │ ├── ReentrantCallOptions.cs │ └── State.cs ├── RegressionActor │ ├── IRegression762Actor.cs │ └── StateCall.cs ├── Reminders │ ├── IReminderActor.cs │ ├── StartReminderOptions.cs │ └── State.cs ├── State │ └── IStateActor.cs ├── Timers │ ├── ITimerActor.cs │ ├── StartTimerOptions.cs │ └── State.cs └── WeaklyTypedTesting │ ├── DerivedResponse.cs │ ├── IWeaklyTypedTestingActor.cs │ └── ResponseBase.cs ├── Dapr.E2E.Test.App.Grpc ├── Dapr.E2E.Test.App.Grpc.csproj ├── MessageRepository.cs ├── Program.cs ├── Proto │ └── message.proto ├── Services │ └── MessagerService.cs └── Startup.cs ├── Dapr.E2E.Test.App.ReentrantActor ├── Actors │ └── ReentrantActor.cs ├── Dapr.E2E.Test.App.ReentrantActors.csproj ├── Program.cs ├── Startup.cs ├── appsettings.Development.json └── appsettings.json ├── Dapr.E2E.Test.App ├── Account.cs ├── Actors │ ├── ExceptionActor.cs │ ├── Regression762Actor.cs │ ├── ReminderActor.cs │ ├── SerializationActor.cs │ ├── StateActor.cs │ ├── TimerActor.cs │ └── WeaklyTypedTestingActor.cs ├── Controllers │ └── TestController.cs ├── Dapr.E2E.Test.App.csproj ├── Program.cs ├── Startup.cs └── Transaction.cs ├── Dapr.E2E.Test ├── AVeryCoolWorkAroundTest.cs ├── ActorRuntimeChecker.cs ├── Actors │ ├── E2ETests.CustomSerializerTests.cs │ ├── E2ETests.ExceptionTests.cs │ ├── E2ETests.ReentrantTests.cs │ ├── E2ETests.Regression762Tests.cs │ ├── E2ETests.ReminderTests.cs │ ├── E2ETests.StateTests.cs │ ├── E2ETests.TimerTests.cs │ └── E2ETests.WeaklyTypedTests.cs ├── Dapr.E2E.Test.csproj ├── DaprCommand.cs ├── DaprRunConfiguration.cs ├── DaprTestApp.cs ├── DaprTestAppFixture.cs ├── DaprTestAppLifecycle.cs ├── E2ETests.cs ├── HttpAssert.cs ├── ServiceInvocation │ ├── E2ETests.GrpcProxyInvocationTests.cs │ └── E2ETests.ServiceInvocationTests.cs ├── components │ ├── pubsub.yaml │ └── statestore.yaml ├── configuration │ └── featureconfig.yaml └── deploy │ ├── local-test-kafka.yml │ └── local-test-vault.yml ├── Dapr.Extensions.Configuration.Test ├── Dapr.Extensions.Configuration.Test.csproj ├── DaprConfigurationStoreProviderTest.cs ├── DaprSecretStoreConfigurationProviderTest.cs └── TestHttpClient.cs ├── Dapr.Jobs.Test ├── CronExpressionBuilderTests.cs ├── Dapr.Jobs.Test.csproj ├── DaprJobsClientBuilderTests.cs ├── DaprJobsGrpcClientTests.cs ├── Extensions │ ├── DaprJobsServiceCollectionExtensionsTests.cs │ ├── EndpointRouteBuilderExtensionsTests.cs │ ├── StringExtensionsTests.cs │ └── TimeSpanExtensionsTests.cs ├── Models │ └── DaprJobScheduleTests.cs └── Responses │ └── DaprJobDetailsTests.cs ├── Dapr.Messaging.Test ├── Dapr.Messaging.Test.csproj ├── Extensions │ └── PublishSubscribeServiceCollectionExtensionsTests.cs ├── PublishSubscribe │ ├── MessageHandlingPolicyTest.cs │ └── PublishSubscribeReceiverTests.cs └── protos │ └── test.proto ├── Dapr.Workflow.Test ├── Dapr.Workflow.Test.csproj ├── WorkflowActivityTest.cs └── WorkflowServiceCollectionExtensionsTests.cs ├── Directory.Build.props └── Shared ├── AppCallbackClient.cs ├── GrpcUtils.cs └── TestClient.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 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2021 The Dapr Authors 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | 14 | ARG VARIANT=bullseye 15 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:dev-7.0-bullseye 16 | 17 | # Install minikube 18 | RUN MINIKUBE_URL="https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64" \ 19 | && sudo curl -sSL -o /usr/local/bin/minikube "${MINIKUBE_URL}" \ 20 | && sudo chmod 0755 /usr/local/bin/minikube \ 21 | && MINIKUBE_SHA256=$(curl -sSL "${MINIKUBE_URL}.sha256") \ 22 | && echo "${MINIKUBE_SHA256} */usr/local/bin/minikube" | sha256sum -c - 23 | 24 | 25 | # Install Dapr CLI 26 | RUN wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash 27 | 28 | # Install Azure Dev CLI 29 | RUN curl -fsSL https://aka.ms/install-azd.sh | bash -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Azure Developer CLI", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": { 6 | "VARIANT": "bullseye" 7 | } 8 | }, 9 | "features": { 10 | "ghcr.io/devcontainers/features/azure-cli:1": { 11 | "version": "2.38" 12 | }, 13 | "ghcr.io/devcontainers/features/docker-in-docker": { 14 | "version": "latest" 15 | }, 16 | "ghcr.io/devcontainers/features/dotnet": { 17 | "version": "8.0", 18 | "additionalVersions": [ 19 | "6.0", 20 | "7.0" 21 | ] 22 | }, 23 | "ghcr.io/devcontainers/features/github-cli:1": { 24 | "version": "2" 25 | }, 26 | "ghcr.io/devcontainers/features/node:1": { 27 | "version": "16", 28 | "nodeGypDependencies": false 29 | } 30 | }, 31 | "extensions": [ 32 | "ms-azuretools.azure-dev", 33 | "ms-azuretools.vscode-bicep", 34 | "ms-azuretools.vscode-docker", 35 | "ms-vscode.vscode-node-azure-pack", 36 | "ms-dotnettools.csharp", 37 | "ms-dotnettools.vscode-dotnet-runtime", 38 | "ms-azuretools.vscode-dapr", 39 | "GitHub.copilot", 40 | "ms-dotnettools.csdevkit" 41 | ], 42 | "forwardPorts": [ 43 | 3000, 44 | 3100, 45 | 3500, 46 | 3501, 47 | 5000, 48 | 5007 49 | ], 50 | "postCreateCommand": "chmod +x .devcontainer/localinit.sh && .devcontainer/localinit.sh", 51 | "remoteUser": "vscode", 52 | "hostRequirements": { 53 | "memory": "8gb" 54 | } 55 | } -------------------------------------------------------------------------------- /.devcontainer/localinit.sh: -------------------------------------------------------------------------------- 1 | # install Azure CLI extension for Container Apps 2 | az config set extension.use_dynamic_install=yes_without_prompt 3 | az extension add --name containerapp --yes 4 | 5 | # install Node.js and NPM LTS 6 | nvm install v18.12.1 7 | 8 | # initialize Dapr 9 | dapr init --runtime-version=1.14.0 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug in Dapr 4 | title: '' 5 | labels: kind/bug 6 | assignees: '' 7 | 8 | --- 9 | ## Expected Behavior 10 | 11 | 12 | 13 | 14 | ## Actual Behavior 15 | 16 | 17 | 18 | 19 | ## Steps to Reproduce the Problem 20 | 21 | 22 | 23 | ## Release Note 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | RELEASE NOTE: 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/discussion.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Discussion 3 | about: Start a discussion for Dapr 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 4 | title: '' 5 | labels: kind/enhancement 6 | assignees: '' 7 | 8 | --- 9 | ## Describe the feature 10 | 11 | ## Release Note 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | RELEASE NOTE: 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/proposal.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Proposal 3 | about: Create a proposal for Dapr 4 | title: '' 5 | labels: kind/proposal 6 | assignees: '' 7 | 8 | --- 9 | ## Describe the proposal 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question about Dapr 4 | title: '' 5 | labels: kind/question 6 | assignees: '' 7 | 8 | --- 9 | ## Ask your question here 10 | -------------------------------------------------------------------------------- /.github/holopin.yml: -------------------------------------------------------------------------------- 1 | organization: dapr 2 | defaultSticker: clrqfdv4x24910fl5n4iwu5oa 3 | stickers: 4 | - 5 | id: clrqfdv4x24910fl5n4iwu5oa 6 | alias: sdk-badge -------------------------------------------------------------------------------- /.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 18 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners are the maintainers and approvers of this repo 2 | * @dapr/maintainers-dotnet-sdk @dapr/approvers-dotnet-sdk 3 | -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-actors/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Dapr actors .NET SDK" 4 | linkTitle: "Actors" 5 | weight: 30000 6 | description: Get up and running with the Dapr actors .NET SDK 7 | --- 8 | 9 | With the Dapr actor package, you can interact with Dapr virtual actors from a .NET application. 10 | 11 | To get started, walk through the [Dapr actors]({{< ref dotnet-actors-howto.md >}}) how-to guide. -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-ai/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Dapr AI .NET SDK" 4 | linkTitle: "AI" 5 | weight: 50000 6 | description: Get up and running with the Dapr AI .NET SDK 7 | --- 8 | 9 | With the Dapr AI package, you can interact with the Dapr AI workloads from a .NET application. 10 | 11 | Today, Dapr provides the Conversational API to engage with large language models. To get started with this workload, 12 | walk through the [Dapr Conversational AI]({{< ref dotnet-ai-conversation-howto.md >}}) how-to guide. -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-error-handling/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Error Handling in the Dapr .NET SDK" 4 | linkTitle: "Error handling" 5 | weight: 90000 6 | description: Learn about error handling in the Dapr.NET SDK. 7 | --- -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-jobs/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Dapr Jobs .NET SDK" 4 | linkTitle: "Jobs" 5 | weight: 50000 6 | description: Get up and running with Dapr Jobs and the Dapr .NET SDK 7 | --- 8 | 9 | With the Dapr Job package, you can interact with the Dapr Job APIs from a .NET application to trigger future operations 10 | to run according to a predefined schedule with an optional payload. 11 | 12 | To get started, walk through the [Dapr Jobs]({{< ref dotnet-jobs-howto.md >}}) how-to guide and refer to 13 | [best practices documentation]({{< ref dotnet-jobsclient-usage.md >}}) for additional guidance. 14 | -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-messaging/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Dapr Messaging .NET SDK" 4 | linkTitle: "Messaging" 5 | weight: 60000 6 | description: Get up and running with the Dapr Messaging .NET SDK 7 | --- 8 | 9 | With the Dapr Messaging package, you can interact with the Dapr messaging APIs from a .NET application. In the 10 | v1.15 release, this package only contains the functionality corresponding to the 11 | [streaming PubSub capability](https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-publish-subscribe/#subscribe-to-topics). 12 | 13 | Future Dapr .NET SDK releases will migrate existing messaging capabilities out from Dapr.Client to this 14 | Dapr.Messaging package. This will be documented in the release notes, documentation and obsolete attributes in advance. 15 | 16 | To get started, walk through the [Dapr Messaging]({{< ref dotnet-messaging-pubsub-howto.md >}}) how-to guide and 17 | refer to [best practices documentation]({{< ref dotnet-messaging-pubsub-usage.md >}}) for additional guidance. -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-troubleshooting/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "How to troubleshoot and debug with the Dapr .NET SDK" 4 | linkTitle: "Troubleshooting" 5 | weight: 120000 6 | description: Tips, tricks, and guides for troubleshooting and debugging with the Dapr .NET SDKs 7 | --- -------------------------------------------------------------------------------- /daprdocs/content/en/dotnet-sdk-docs/dotnet-workflow/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | type: docs 3 | title: "Dapr Workflow .NET SDK" 4 | linkTitle: "Workflow" 5 | weight: 40000 6 | description: Get up and running with Dapr Workflow and the Dapr .NET SDK 7 | --- 8 | 9 | -------------------------------------------------------------------------------- /examples/.editorconfig: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Samples EditorConfig Options # 3 | ############################### 4 | 5 | [*.cs] 6 | ##################################### 7 | # Analayers Serverity Configuration # 8 | ##################################### 9 | 10 | # CS1591: Missing XML comment for publicly visible type or member 11 | dotnet_diagnostic.CS1591.severity = warning 12 | -------------------------------------------------------------------------------- /examples/AI/ConversationalAI/ConversationalAI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/AI/ConversationalAI/Program.cs: -------------------------------------------------------------------------------- 1 | using Dapr.AI.Conversation; 2 | using Dapr.AI.Conversation.Extensions; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | builder.Services.AddDaprConversationClient(); 7 | 8 | var app = builder.Build(); 9 | 10 | var conversationClient = app.Services.GetRequiredService(); 11 | var response = await conversationClient.ConverseAsync("conversation", 12 | new List 13 | { 14 | new DaprConversationInput( 15 | "Please write a witty haiku about the Dapr distributed programming framework at dapr.io", 16 | DaprConversationRole.Generic) 17 | }); 18 | 19 | Console.WriteLine("Received the following from the LLM:"); 20 | foreach (var resp in response.Outputs) 21 | { 22 | Console.WriteLine($"\t{resp.Result}"); 23 | } 24 | -------------------------------------------------------------------------------- /examples/Actor/ActorClient/ActorClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/Actor/DemoActor/DemoActor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6 5 | 6 | 7 | 8 | true 9 | true 10 | demo-actor 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Actor/DemoActor/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Microsoft.AspNetCore.Hosting; 15 | using Microsoft.Extensions.Hosting; 16 | 17 | namespace DemoActor 18 | { 19 | public class Program 20 | { 21 | public static void Main(string[] args) 22 | { 23 | CreateHostBuilder(args).Build().Run(); 24 | } 25 | 26 | public static IHostBuilder CreateHostBuilder(string[] args) => 27 | Host.CreateDefaultBuilder(args) 28 | .ConfigureWebHostDefaults(webBuilder => 29 | { 30 | webBuilder.UseStartup(); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/Actor/DemoActor/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://127.0.0.1:5010/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "DemoActor": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:5010/" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/Actor/DemoActor/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /examples/Actor/IDemoActor/IDemoActor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/AspNetCore/ControllerSample/Account.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace ControllerSample 15 | { 16 | /// 17 | /// Class representing an Account for samples. 18 | /// 19 | public class Account 20 | { 21 | /// 22 | /// Gets or sets account id. 23 | /// 24 | public string Id { get; set; } 25 | 26 | /// 27 | /// Gets or sets account balance. 28 | /// 29 | public decimal Balance { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AspNetCore/ControllerSample/ControllerSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/AspNetCore/ControllerSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "IIS Express": { 4 | "commandName": "IISExpress", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | "CUSTOM_PUBSUB": "custom-pubsub", 9 | "CUSTOM_TOPIC": "custom-topic" 10 | } 11 | }, 12 | "ControllerSample": { 13 | "commandName": "Project", 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development", 16 | "CUSTOM_PUBSUB": "custom-pubsub", 17 | "CUSTOM_TOPIC": "custom-topic" 18 | }, 19 | "applicationUrl": "http://localhost:5000/" 20 | } 21 | }, 22 | "iisSettings": { 23 | "windowsAuthentication": false, 24 | "anonymousAuthentication": true, 25 | "iisExpress": { 26 | "applicationUrl": "http://localhost:54197/", 27 | "sslPort": 44385 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AspNetCore/ControllerSample/Transaction.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace ControllerSample 15 | { 16 | using System.ComponentModel.DataAnnotations; 17 | 18 | /// 19 | /// Represents a transaction used by sample code. 20 | /// 21 | public class Transaction 22 | { 23 | /// 24 | /// Gets or sets account id for the transaction. 25 | /// 26 | [Required] 27 | public string Id { get; set; } 28 | 29 | /// 30 | /// Gets or sets amount for the transaction. 31 | /// 2 | 3 | 4 | net6 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/Models/Account.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace GrpcServiceSample.Models 15 | { 16 | /// 17 | /// Class representing an Account for samples. 18 | /// 19 | public class Account 20 | { 21 | /// 22 | /// Gets or sets account id. 23 | /// 24 | public string Id { get; set; } 25 | 26 | /// 27 | /// Gets or sets account balance. 28 | /// 29 | public decimal Balance { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/Models/GetAccountInput.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace GrpcServiceSample.Models 15 | { 16 | /// 17 | /// BankService GetAccount input model 18 | /// 19 | public class GetAccountInput 20 | { 21 | /// 22 | /// Id of account 23 | /// 24 | public string Id { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "GrpcServiceSample": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "applicationUrl": "https://localhost:5001", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/Protos/data.proto: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | syntax = "proto3"; 15 | 16 | option csharp_namespace = "GrpcServiceSample.Generated"; 17 | 18 | message Account { 19 | string Id = 1; 20 | // Ideally we'd use the Money data type here, but to keep the sample simple we're using an int. 21 | int32 Balance = 2; 22 | } 23 | 24 | message GetAccountRequest { 25 | string Id = 1; 26 | } 27 | 28 | message Transaction { 29 | string Id = 1; 30 | // Ideally we'd use the Money data type here, but to keep the sample simple we're using an int. 31 | int32 Amount = 2; 32 | } -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Grpc": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/AspNetCore/GrpcServiceSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "Kestrel": { 11 | "EndpointDefaults": { 12 | "Protocols": "Http2" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/AspNetCore/README.md: -------------------------------------------------------------------------------- 1 | # ASP.NET Dapr integration examples 2 | 3 | - [Routing Sample](./RoutingSample): How to run Dapr with ASP.NET Core routing 4 | - [Controller Sample](./ControllerSample): How to use Dapr with ASP.NET Core controllers 5 | - [gRPC Sample](./GrpcServiceSample): How to run Dapr with the ASP.NET gRPC integration 6 | - [Secret Store Configuration](./SecretStoreConfigurationProviderSample) 7 | -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/Account.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace RoutingSample 15 | { 16 | /// 17 | /// Class representing an Account for samples. 18 | /// 19 | public class Account 20 | { 21 | /// 22 | /// Gets or sets account id. 23 | /// 24 | public string Id { get; set; } 25 | 26 | /// 27 | /// Gets or sets account balance. 28 | /// 29 | public decimal Balance { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://127.0.0.1:5000/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "RoutingSample": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:5000/" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/RoutingSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/Transaction.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace RoutingSample 15 | { 16 | /// 17 | /// Represents a transaction used by sample code. 18 | /// 19 | public class Transaction 20 | { 21 | /// 22 | /// Gets or sets account id for the transaction. 23 | /// 24 | public string Id { get; set; } 25 | 26 | /// 27 | /// Gets or sets amount for the transaction. 28 | /// 29 | public decimal Amount { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /examples/AspNetCore/RoutingSample/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 | -------------------------------------------------------------------------------- /examples/AspNetCore/SecretStoreConfigurationProviderSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:65313", 7 | "sslPort": 44314 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "blq": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/AspNetCore/SecretStoreConfigurationProviderSample/README.md: -------------------------------------------------------------------------------- 1 | # Dapr secret store configuration provider in ASP.NET Core 2 | 3 | ## Prerequisites 4 | 5 | - [.NET 6+](https://dotnet.microsoft.com/download) installed 6 | - [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) 7 | - [Initialized Dapr environment](https://docs.dapr.io/getting-started/install-dapr-selfhost/) 8 | - [Dapr .NET SDK](https://docs.dapr.io/developing-applications/sdks/dotnet/) 9 | 10 | ## Overview 11 | 12 | This document describes how to use the Dapr Secret Store Configuration Provider sample to load Secrets into ASP.NET Core Configuration. 13 | 14 | To load secrets into configuration call the _AddDaprSecretStore_ extension method with the name of the Secret Store and a list of secrets descriptors or related metadata. 15 | 16 | ## Using the Dapr Secret Store Configuration Provider ASP.NET Core example 17 | 18 | ### 1. Use Dapr to run the application 19 | 20 | Use Dapr to run the application: 21 | 22 | ```shell 23 | dapr run --app-id SecretStoreConfigurationProviderSample --resources-path ./components/ -- dotnet run 24 | ``` 25 | 26 | ### 2. Test the application 27 | 28 | Run the following command in other terminal: 29 | 30 | ``` shell 31 | curl http://localhost:5000/secret 32 | ``` 33 | 34 | The response should read: "This the way" 35 | -------------------------------------------------------------------------------- /examples/AspNetCore/SecretStoreConfigurationProviderSample/SecretStoreConfigurationProviderSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/AspNetCore/SecretStoreConfigurationProviderSample/components/secretstore.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: demosecrets 5 | spec: 6 | type: secretstores.local.file 7 | metadata: 8 | - name: secretsFile 9 | value: secrets.json 10 | -------------------------------------------------------------------------------- /examples/AspNetCore/SecretStoreConfigurationProviderSample/secrets.json: -------------------------------------------------------------------------------- 1 | { 2 | "super-secret": "This the way" 3 | } -------------------------------------------------------------------------------- /examples/Client/ConfigurationApi/Components/redisconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: redisconfig 5 | spec: 6 | type: configuration.redis 7 | version: v1 8 | metadata: 9 | - name: redisHost 10 | value: localhost:6379 11 | - name: redisPassword 12 | value: "" 13 | -------------------------------------------------------------------------------- /examples/Client/ConfigurationApi/ConfigurationApi.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/Client/ConfigurationApi/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:4855", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "ConfigurationApi": { 19 | "commandName": "Project", 20 | "applicationUrl": "http://localhost:5010", 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /examples/Client/ConfigurationApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/Client/ConfigurationApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /examples/Client/Cryptography/Components/local-storage.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: localstorage 5 | spec: 6 | type: crypto.dapr.localstorage 7 | version: v1 8 | metadata: 9 | - name: path 10 | # Path is relative to the folder where the example is located 11 | value: ./keys 12 | -------------------------------------------------------------------------------- /examples/Client/Cryptography/Cryptography.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | latest 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | PreserveNewest 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Client/Cryptography/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Cryptography 15 | { 16 | internal abstract class Example 17 | { 18 | public abstract string DisplayName { get; } 19 | 20 | public abstract Task RunAsync(CancellationToken cancellationToken); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/Client/Cryptography/file.txt: -------------------------------------------------------------------------------- 1 | # The Road Not Taken 2 | ## By Robert Lee Frost 3 | 4 | Two roads diverged in a yellow wood, 5 | And sorry I could not travel both 6 | And be one traveler, long I stood 7 | And looked down one as far as I could 8 | To where it bent in the undergrowth; 9 | 10 | Then took the other, as just as fair 11 | And having perhaps the better claim, 12 | Because it was grassy and wanted wear; 13 | Though as for that, the passing there 14 | Had worn them really about the same, 15 | 16 | And both that morning equally lay 17 | In leaves no step had trodden black 18 | Oh, I kept the first for another day! 19 | Yet knowing how way leads on to way, 20 | I doubted if I should ever come back. 21 | 22 | I shall be telling this with a sigh 23 | Somewhere ages and ages hence: 24 | Two roads diverged in a wood, and I, 25 | I took the one less traveled by, 26 | And that has made all the difference. -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Components/cronbinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: cronbinding 5 | namespace: default 6 | spec: 7 | type: bindings.cron 8 | version: v1 9 | metadata: 10 | - name: schedule 11 | value: "*/5 * * * * *" -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Components/localstorage.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: localstorage 5 | namespace: default 6 | spec: 7 | type: bindings.localstorage 8 | version: v1 9 | metadata: 10 | - name: rootPath 11 | value: ./tmp -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Components/redislock.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: redislock 5 | spec: 6 | type: lock.redis 7 | version: v1 8 | metadata: 9 | - name: redisHost 10 | value: localhost:6379 11 | - name: redisPassword 12 | value: "" -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Components/redisstore.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: redisstore 5 | spec: 6 | type: state.redis 7 | version: v1 8 | metadata: 9 | - name: redisHost 10 | value: localhost:6379 11 | - name: redisPassword 12 | value: "" 13 | - name: actorStateStore 14 | value: "true" 15 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/DistributedLock.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | net6 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Model/StateData.cs: -------------------------------------------------------------------------------- 1 | namespace DistributedLock.Model 2 | { 3 | #nullable enable 4 | public class StateData 5 | { 6 | public int Number { get; } 7 | public string? Analysis { get; set; } 8 | 9 | public StateData(int number, string? analysis = null) 10 | { 11 | Number = number; 12 | Analysis = analysis; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Hosting; 4 | 5 | namespace DistributedLock 6 | { 7 | public class Program 8 | { 9 | static string DEFAULT_APP_PORT = "22222"; 10 | public static void Main(string[] args) 11 | { 12 | CreateHostBuilder(args).Build().Run(); 13 | } 14 | 15 | public static IHostBuilder CreateHostBuilder(string[] args) => 16 | Host.CreateDefaultBuilder(args) 17 | .ConfigureWebHostDefaults(webBuilder => 18 | { 19 | webBuilder.UseStartup() 20 | .UseUrls($"http://localhost:{Environment.GetEnvironmentVariable("APP_PORT") ?? DEFAULT_APP_PORT}"); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:63390", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "weatherforecast", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "DistributedLock": { 21 | "commandName": "Project", 22 | //"applicationUrl": "http://localhost:5000", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /examples/Client/DistributedLock/Services/GeneratorService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Dapr.Client; 4 | using DistributedLock.Model; 5 | 6 | namespace DistributedLock.Services 7 | { 8 | public class GeneratorService 9 | { 10 | Timer generateDataTimer; 11 | 12 | public GeneratorService() 13 | { 14 | // Generate some data every second. 15 | if (Environment.GetEnvironmentVariable("APP_ID") == "generator") 16 | { 17 | generateDataTimer = new Timer(GenerateData, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10)); 18 | } 19 | } 20 | 21 | public async void GenerateData(Object stateInfo) 22 | { 23 | using (var client = new DaprClientBuilder().Build()) 24 | { 25 | var rand = new Random(); 26 | var state = new StateData(rand.Next(100)); 27 | 28 | await client.InvokeBindingAsync("localstorage", "create", state); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/Client/DistributedLock/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/BulkPublishEventExample/BulkPublishEventExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6 6 | Samples.Client 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/BulkPublishEventExample/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading; 15 | using System.Threading.Tasks; 16 | 17 | namespace Samples.Client 18 | { 19 | public abstract class Example 20 | { 21 | public abstract string DisplayName { get; } 22 | 23 | public abstract Task RunAsync(CancellationToken cancellationToken); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/PublishEventExample/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading; 15 | using System.Threading.Tasks; 16 | 17 | namespace Samples.Client 18 | { 19 | public abstract class Example 20 | { 21 | protected static readonly string pubsubName = "pubsub"; 22 | 23 | public abstract string DisplayName { get; } 24 | 25 | public abstract Task RunAsync(CancellationToken cancellationToken); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/PublishEventExample/PublishEventExample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6 6 | Samples.Client 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/PublishEventExample/README.md: -------------------------------------------------------------------------------- 1 | # Dapr .NET SDK pub/sub example 2 | 3 | ## Prerequisites 4 | 5 | - [.NET 6+](https://dotnet.microsoft.com/download) installed 6 | - [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/) 7 | - [Initialized Dapr environment](https://docs.dapr.io/getting-started/install-dapr-selfhost/) 8 | - [Dapr .NET SDK](https://docs.dapr.io/developing-applications/sdks/dotnet/) 9 | 10 | ## Running the example 11 | 12 | To run the sample locally run this command in the DaprClient directory: 13 | 14 | ```sh 15 | dapr run --app-id DaprClient -- dotnet run 16 | ``` 17 | 18 | Running the following command will output a list of the samples included: 19 | 20 | ```sh 21 | dapr run --app-id DaprClient -- dotnet run 22 | ``` 23 | 24 | Press Ctrl+C to exit, and then run the command again and provide a sample number to run the samples. 25 | 26 | For example run this command to run the 0th sample from the list produced earlier. 27 | 28 | ```sh 29 | dapr run --app-id DaprClient -- dotnet run 0 30 | ``` 31 | 32 | ## Publishing Pub/Sub Events 33 | 34 | See [PublishEventExample.cs](./PublishEventExample.cs) for an example using the `DaprClient` to publish a pub/sub event. 35 | -------------------------------------------------------------------------------- /examples/Client/PublishSubscribe/StreamingSubscriptionExample/StreamingSubscriptionExample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/Client/README.md: -------------------------------------------------------------------------------- 1 | # Dapr Client examples 2 | 3 | The following examples will show you how to: 4 | 5 | - [Invoke services](./ServiceInvocation) 6 | - [Manage state](./StateManagement) 7 | - [Publish events](./PublishSubscribe) 8 | - [Configuration API](./ConfigurationApi) 9 | - [Distributed Lock](./DistributedLock) 10 | 11 | ## SDK docs 12 | 13 | For more information on the .NET Dapr client visit the [SDK docs](https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-client/). 14 | -------------------------------------------------------------------------------- /examples/Client/ServiceInvocation/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading; 15 | using System.Threading.Tasks; 16 | 17 | namespace Samples.Client 18 | { 19 | public abstract class Example 20 | { 21 | public abstract string DisplayName { get; } 22 | 23 | public abstract Task RunAsync(CancellationToken cancellationToken); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/Client/ServiceInvocation/ServiceInvocation.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6 6 | Samples.Client 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Client/StateManagement/Example.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading; 15 | using System.Threading.Tasks; 16 | 17 | namespace Samples.Client 18 | { 19 | public abstract class Example 20 | { 21 | public abstract string DisplayName { get; } 22 | 23 | public abstract Task RunAsync(CancellationToken cancellationToken); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/Client/StateManagement/StateManagement.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6 6 | Samples.Client 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(RepoRoot)bin\$(Configuration)\examples\$(MSBuildProjectName)\ 7 | 8 | false 9 | 10 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorClient/ActorClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6 6 | 10.0 7 | enable 8 | enable 9 | 10 | 11 | true 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorClient/IClientActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.Actors.Generators; 15 | 16 | namespace GeneratedActor; 17 | 18 | internal sealed record ClientState(string Value); 19 | 20 | [GenerateActorClient] 21 | internal interface IClientActor 22 | { 23 | [ActorMethod(Name = "GetState")] 24 | Task GetStateAsync(CancellationToken cancellationToken = default); 25 | 26 | [ActorMethod(Name = "SetState")] 27 | Task SetStateAsync(ClientState state, CancellationToken cancellationToken = default); 28 | } 29 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorClient/IGenericClientActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.Actors.Generators; 15 | 16 | namespace GeneratedActor 17 | { 18 | [GenerateActorClient] 19 | internal interface IGenericClientActor 20 | { 21 | [ActorMethod(Name = "GetState")] 22 | Task GetStateAsync(CancellationToken cancellationToken = default); 23 | 24 | [ActorMethod(Name = "SetState")] 25 | Task SetStateAsync(TGenericType2 state, CancellationToken cancellationToken = default); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorCommon/ActorCommon.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6 5 | 10.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorCommon/IRemoteActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.Actors; 15 | 16 | namespace GeneratedActor; 17 | 18 | public sealed record RemoteState(string Value); 19 | 20 | public interface IRemoteActor : IActor 21 | { 22 | Task GetState(); 23 | 24 | Task SetState(RemoteState state); 25 | } 26 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorService/ActorService.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6 5 | 10.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorService/Program.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using GeneratedActor; 15 | 16 | var builder = WebApplication.CreateBuilder(args); 17 | 18 | builder.Services.AddActors( 19 | options => 20 | { 21 | options.UseJsonSerialization = true; 22 | options.Actors.RegisterActor(); 23 | }); 24 | 25 | var app = builder.Build(); 26 | 27 | app.UseRouting(); 28 | 29 | #pragma warning disable ASP0014 30 | app.UseEndpoints( 31 | endpoints => 32 | { 33 | endpoints.MapActorsHandlers(); 34 | }); 35 | 36 | app.Run(); 37 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorService/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:56372", 8 | "sslPort": 0 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5226", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "IIS Express": { 23 | "commandName": "IISExpress", 24 | "launchBrowser": true, 25 | "launchUrl": "swagger", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorService/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/GeneratedActor/ActorService/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/Jobs/JobsSample/JobsSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/Jobs/JobsSample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:6382", 8 | "sslPort": 44324 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "applicationUrl": "http://localhost:5140", 17 | "environmentVariables": { 18 | "ASPNETCORE_ENVIRONMENT": "Development" 19 | } 20 | }, 21 | "https": { 22 | "commandName": "Project", 23 | "dotnetRunMessages": true, 24 | "launchBrowser": true, 25 | "applicationUrl": "https://localhost:7241;http://localhost:5140", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | }, 30 | "IIS Express": { 31 | "commandName": "IISExpress", 32 | "launchBrowser": true, 33 | "environmentVariables": { 34 | "ASPNETCORE_ENVIRONMENT": "Development" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Dapr .NET Core examples 2 | 3 | This repository contains a samples that highlight the Dapr .NET SDK capabilities: 4 | 5 | | Sample | Description | 6 | |----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 7 | | [1. Client](./Client) | The client example shows how to make Dapr calls to publish events, save state, get state and delete state using a Dapr client. 8 | | [2. Actor](./Actor) | Demonstrates creating virtual actors that encapsulate code and state. | 9 | | [3. ASP.NET Core](./AspNetCore) | Demonstrates ASP.NET Core integration with Dapr by creating Controllers and Routes. | 10 | | [4. Workflow](./Workflow) | Demonstrates creating durable, long-running Dapr workflows using code. | 11 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowAsyncOperations/Models/Transaction.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace WorkflowAsyncOperations.Models; 15 | 16 | internal sealed record Transaction(decimal Value) 17 | { 18 | public Guid CustomerId { get; init; } = Guid.NewGuid(); 19 | } 20 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowAsyncOperations/WorkflowAsyncOperations.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/Activities/NotifyActivity.cs: -------------------------------------------------------------------------------- 1 | using Dapr.Workflow; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace WorkflowConsoleApp.Activities 5 | { 6 | public record Notification(string Message); 7 | 8 | public class NotifyActivity : WorkflowActivity 9 | { 10 | readonly ILogger logger; 11 | 12 | public NotifyActivity(ILoggerFactory loggerFactory) 13 | { 14 | this.logger = loggerFactory.CreateLogger(); 15 | } 16 | 17 | public override Task RunAsync(WorkflowActivityContext context, Notification notification) 18 | { 19 | this.logger.LogInformation(notification.Message); 20 | 21 | return Task.FromResult(null); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/Activities/ProcessPaymentActivity.cs: -------------------------------------------------------------------------------- 1 | using Dapr.Workflow; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace WorkflowConsoleApp.Activities 5 | { 6 | public class ProcessPaymentActivity : WorkflowActivity 7 | { 8 | readonly ILogger logger; 9 | 10 | public ProcessPaymentActivity(ILoggerFactory loggerFactory) 11 | { 12 | this.logger = loggerFactory.CreateLogger(); 13 | } 14 | 15 | public override async Task RunAsync(WorkflowActivityContext context, PaymentRequest req) 16 | { 17 | this.logger.LogInformation( 18 | "Processing payment: {requestId} for {amount} {item} at ${currency}", 19 | req.RequestId, 20 | req.Amount, 21 | req.ItemName, 22 | req.Currency); 23 | 24 | // Simulate slow processing 25 | await Task.Delay(TimeSpan.FromSeconds(7)); 26 | 27 | this.logger.LogInformation( 28 | "Payment for request ID '{requestId}' processed successfully", 29 | req.RequestId); 30 | 31 | return null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/Activities/RequestApprovalActivity.cs: -------------------------------------------------------------------------------- 1 | using Dapr.Workflow; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace WorkflowConsoleApp.Activities 5 | { 6 | public class RequestApprovalActivity : WorkflowActivity 7 | { 8 | readonly ILogger logger; 9 | 10 | public RequestApprovalActivity(ILoggerFactory loggerFactory) 11 | { 12 | this.logger = loggerFactory.CreateLogger(); 13 | } 14 | 15 | public override Task RunAsync(WorkflowActivityContext context, OrderPayload input) 16 | { 17 | string orderId = context.InstanceId.ToString(); 18 | this.logger.LogInformation("Requesting approval for order {orderId}", orderId); 19 | 20 | return Task.FromResult(null); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/Models.cs: -------------------------------------------------------------------------------- 1 | namespace WorkflowConsoleApp 2 | { 3 | public record OrderPayload(string Name, double TotalCost, int Quantity = 1); 4 | public record InventoryRequest(string RequestId, string ItemName, int Quantity); 5 | public record InventoryResult(bool Success, InventoryItem orderPayload); 6 | public record PaymentRequest(string RequestId, string ItemName, int Amount, double Currency); 7 | public record OrderResult(bool Processed); 8 | public record InventoryItem(string Name, double PerItemCost, int Quantity); 9 | public enum ApprovalResult 10 | { 11 | Unspecified = 0, 12 | Approved = 1, 13 | Rejected = 2, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "OrderingWebApi": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "http://localhost:10080" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/WorkflowConsoleApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | Exe 9 | net6 10 | enable 11 | 612,618 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowConsoleApp/demo.http: -------------------------------------------------------------------------------- 1 | ### Start order processing workflow - replace xxx with any id you like 2 | POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx 3 | Content-Type: application/json 4 | 5 | {"Name": "Paperclips", "TotalCost": 99.95, "Quantity": 1} 6 | 7 | ### Start order processing workflow - replace xxx with any id you like 8 | POST http://localhost:3500/v1.0-beta1/workflows/dapr/OrderProcessingWorkflow/start?instanceID=xxx 9 | Content-Type: application/json 10 | 11 | {"Name": "Cars", "TotalCost": 10000, "Quantity": 30} 12 | 13 | ### Query dapr sidecar - replace xxx with id from the workflow you've created above 14 | GET http://localhost:3500/v1.0-beta1/workflows/dapr/xxx 15 | 16 | ### Terminate the workflow - replace xxx with id from the workflow you've created above 17 | POST http://localhost:3500/v1.0-beta1/workflows/dapr/xxx/terminate -------------------------------------------------------------------------------- /examples/Workflow/WorkflowExternalInteraction/WorkflowExternalInteraction.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowFanOutFanIn/WorkflowFanOutFanIn.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowMonitor/WorkflowMonitor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowSubworkflow/WorkflowSubworkflow.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowTaskChaining/WorkflowTaskChaining.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/Workflow/WorkflowUnitTest/WorkflowUnitTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | enable 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | all 16 | 17 | 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | all 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment": "This policy allows the 8.0.100 SDK or patches in that family.", 3 | "sdk": { 4 | "version": "9.0.100", 5 | "rollForward": "latestFeature" 6 | } 7 | } -------------------------------------------------------------------------------- /properties/IsExternalInit.cs: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | 4 | using System.ComponentModel; 5 | 6 | namespace System.Runtime.CompilerServices 7 | { 8 | /// 9 | /// Reserved to be used by the compiler for tracking metadata. 10 | /// This class should not be used by developers in source code. 11 | /// 12 | [EditorBrowsable(EditorBrowsableState.Never)] 13 | internal static class IsExternalInit 14 | { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /properties/cs_sdk.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dapr/dotnet-sdk/6b49bed7f186ee9048eae595eab078915bfb0d0b/properties/cs_sdk.snk -------------------------------------------------------------------------------- /properties/dapr_common.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory)..\ 6 | minimal 7 | 8 | 9 | -------------------------------------------------------------------------------- /properties/dapr_nuget.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dapr.io 5 | true 6 | Apache-2.0 7 | https://dapr.io 8 | images\logo-transparent.png 9 | Dapr 10 | https://github.com/dapr/dotnet-sdk 11 | git 12 | $(RepoRoot)bin\$(Configuration)\nugets 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | true 23 | snupkg 24 | 25 | 26 | -------------------------------------------------------------------------------- /properties/logo-transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dapr/dotnet-sdk/6b49bed7f186ee9048eae595eab078915bfb0d0b/properties/logo-transparent.png -------------------------------------------------------------------------------- /properties/nuget_icon_ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dapr/dotnet-sdk/6b49bed7f186ee9048eae595eab078915bfb0d0b/properties/nuget_icon_ms.png -------------------------------------------------------------------------------- /src/Dapr.AI/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Dapr.AI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b1f597635c44597fcecb493e2b1327033b29b1a98ac956a1a538664b68f87d45fbaada0438a15a6265e62864947cc067d8da3a7d93c5eb2fcbb850e396c8684dba74ea477d82a1bbb18932c0efb30b64ff1677f85ae833818707ac8b49ad8062ca01d2c89d8ab1843ae73e8ba9649cd28666b539444dcdee3639f95e2a099bb2")] 4 | 5 | -------------------------------------------------------------------------------- /src/Dapr.AI/Conversation/DaprConversationInput.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AI.Conversation; 15 | 16 | /// 17 | /// Represents an input for the Dapr Conversational API. 18 | /// 19 | /// The content to send to the LLM. 20 | /// The role indicating the entity providing the message. 21 | /// If true, scrubs the data that goes into the LLM. 22 | public sealed record DaprConversationInput(string Content, DaprConversationRole Role, bool ScrubPII = false); 23 | -------------------------------------------------------------------------------- /src/Dapr.AI/Conversation/DaprConversationResponse.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AI.Conversation; 15 | 16 | /// 17 | /// The response for a conversation. 18 | /// 19 | /// The collection of conversation results. 20 | /// The identifier of an existing or newly created conversation. 21 | public record DaprConversationResponse(IReadOnlyList Outputs, string? ConversationId = null); 22 | -------------------------------------------------------------------------------- /src/Dapr.AI/Conversation/DaprConversationResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Google.Protobuf.WellKnownTypes; 15 | 16 | namespace Dapr.AI.Conversation; 17 | 18 | /// 19 | /// The result for a single conversational input. 20 | /// 21 | /// The result for one conversation input. 22 | public record DaprConversationResult(string Result) 23 | { 24 | /// 25 | /// Parameters for all custom fields. 26 | /// 27 | public IReadOnlyDictionary Parameters { get; init; } = new Dictionary(); 28 | } 29 | -------------------------------------------------------------------------------- /src/Dapr.AI/Conversation/DaprConversationRole.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Dapr.Common.JsonConverters; 4 | 5 | namespace Dapr.AI.Conversation; 6 | 7 | /// 8 | /// Represents who 9 | /// 10 | public enum DaprConversationRole 11 | { 12 | /// 13 | /// Represents a message sent by an AI. 14 | /// 15 | [EnumMember(Value="ai")] 16 | AI, 17 | /// 18 | /// Represents a message sent by a human. 19 | /// 20 | [EnumMember(Value="human")] 21 | Human, 22 | /// 23 | /// Represents a message sent by the system. 24 | /// 25 | [EnumMember(Value="system")] 26 | System, 27 | /// 28 | /// Represents a message sent by a generic user. 29 | /// 30 | [EnumMember(Value="generic")] 31 | Generic, 32 | /// 33 | /// Represents a message sent by a function. 34 | /// 35 | [EnumMember(Value="function")] 36 | Function, 37 | /// 38 | /// Represents a message sent by a tool. 39 | /// 40 | [EnumMember(Value="tool")] 41 | Tool 42 | } 43 | -------------------------------------------------------------------------------- /src/Dapr.AI/Conversation/Extensions/IDaprAiConversationBuilder.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.AI.Extensions; 15 | 16 | namespace Dapr.AI.Conversation.Extensions; 17 | 18 | /// 19 | /// Provides a root builder for the Dapr AI conversational functionality facilitating a more fluent-style registration. 20 | /// 21 | public interface IDaprAiConversationBuilder : IDaprAiServiceBuilder 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /src/Dapr.AI/Dapr.AI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6;net8 5 | enable 6 | enable 7 | Dapr.AI 8 | Dapr AI SDK 9 | Dapr AI SDK for performing operations associated with artificial intelligence. 10 | alpha 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Dapr.AI/Extensions/IDaprAiServiceBuilder.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Microsoft.Extensions.DependencyInjection; 15 | 16 | namespace Dapr.AI.Extensions; 17 | 18 | /// 19 | /// Responsible for registering Dapr AI service functionality. 20 | /// 21 | public interface IDaprAiServiceBuilder 22 | { 23 | /// 24 | /// The registered services on the builder. 25 | /// 26 | public IServiceCollection Services { get; } 27 | } 28 | -------------------------------------------------------------------------------- /src/Dapr.Actors.AspNetCore/Dapr.Actors.AspNetCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | This package contains the reference assemblies for developing Actor services using Dapr and AspNetCore. 9 | $(PackageTags);Actors 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Dapr.Actors.AspNetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Dapr.Actors.AspNetCore.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b1f597635c44597fcecb493e2b1327033b29b1a98ac956a1a538664b68f87d45fbaada0438a15a6265e62864947cc067d8da3a7d93c5eb2fcbb850e396c8684dba74ea477d82a1bbb18932c0efb30b64ff1677f85ae833818707ac8b49ad8062ca01d2c89d8ab1843ae73e8ba9649cd28666b539444dcdee3639f95e2a099bb2")] 15 | -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/AnalyzerReleases.Shipped.md: -------------------------------------------------------------------------------- 1 | ## Release 1.14 2 | 3 | ### New Rules 4 | 5 | Rule ID | Category | Severity | Notes 6 | --------|----------|----------|-------------------- 7 | DAPR0001| Usage | Error | Cancellation tokens must be the last argument 8 | DAPR0002| Usage | Error | Only methods with a single argument or a single argument followed by a cancellation token are supported -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ; Unshipped analyzer release 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | 4 | -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/Diagnostics/CancellationTokensMustBeTheLastArgument.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace Dapr.Actors.Generators.Diagnostics 4 | { 5 | internal static class CancellationTokensMustBeTheLastArgument 6 | { 7 | public const string DiagnosticId = "DAPR0001"; 8 | public const string Title = "Invalid method signature"; 9 | public const string MessageFormat = "Cancellation tokens must be the last argument"; 10 | public const string Category = "Usage"; 11 | 12 | private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor( 13 | DiagnosticId, 14 | Title, 15 | MessageFormat, 16 | Category, 17 | DiagnosticSeverity.Error, 18 | isEnabledByDefault: true); 19 | 20 | internal static Diagnostic CreateDiagnostic(ISymbol symbol) => Diagnostic.Create( 21 | Rule, 22 | symbol.Locations.First(), 23 | symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/Diagnostics/MethodMustOnlyHaveASingleArgumentOptionallyFollowedByACancellationToken.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace Dapr.Actors.Generators.Diagnostics 4 | { 5 | internal static class MethodMustOnlyHaveASingleArgumentOptionallyFollowedByACancellationToken 6 | { 7 | public const string DiagnosticId = "DAPR0002"; 8 | public const string Title = "Invalid method signature"; 9 | public const string MessageFormat = "Only methods with a single argument or a single argument followed by a cancellation token are supported"; 10 | public const string Category = "Usage"; 11 | 12 | private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor( 13 | DiagnosticId, 14 | Title, 15 | MessageFormat, 16 | Category, 17 | DiagnosticSeverity.Error, 18 | isEnabledByDefault: true); 19 | 20 | internal static Diagnostic CreateDiagnostic(ISymbol symbol) => Diagnostic.Create( 21 | Rule, 22 | symbol.Locations.First(), 23 | symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/DiagnosticsException.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace Dapr.Actors.Generators 4 | { 5 | /// 6 | /// Exception thrown when diagnostics are encountered during code generation. 7 | /// 8 | internal sealed class DiagnosticsException : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// List of diagnostics generated. 14 | public DiagnosticsException(IEnumerable diagnostics) 15 | : base(string.Join("\n", diagnostics.Select(d => d.ToString()))) 16 | { 17 | this.Diagnostics = diagnostics.ToArray(); 18 | } 19 | 20 | /// 21 | /// Diagnostics encountered during code generation. 22 | /// 23 | public ICollection Diagnostics { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Dapr.Actors.Generators/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Debug": { 4 | "commandName": "DebugRoslynComponent", 5 | "targetProject": "..\\..\\examples\\GeneratedActor\\ActorClient\\ActorClient.csproj" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/Dapr.Actors/Builder/ActorProxyGeneratorBuildResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Builder 15 | { 16 | using System; 17 | 18 | internal class ActorProxyGeneratorBuildResult : BuildResult 19 | { 20 | public ActorProxyGeneratorBuildResult(CodeBuilderContext buildContext) 21 | : base(buildContext) 22 | { 23 | } 24 | 25 | public Type ProxyType { get; set; } 26 | 27 | public Type ProxyActivatorType { get; set; } 28 | 29 | public ActorProxyGenerator ProxyGenerator { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Builder/BuildResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Builder 15 | { 16 | internal class BuildResult 17 | { 18 | protected BuildResult(CodeBuilderContext buildContext) 19 | { 20 | this.BuildContext = buildContext; 21 | } 22 | 23 | public CodeBuilderContext BuildContext { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Builder/IProxyActivator.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Builder 15 | { 16 | using Dapr.Actors.Client; 17 | 18 | /// 19 | /// Interface to create objects. 20 | /// 21 | public interface IProxyActivator 22 | { 23 | /// 24 | /// Create the instance of the generated proxy type. 25 | /// 26 | /// An instance of the generated proxy as type. 27 | IActorProxy CreateInstance(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Builder/MethodBodyTypes.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Builder 15 | { 16 | using System; 17 | 18 | internal class MethodBodyTypes 19 | { 20 | public Type RequestBodyType { get; set; } 21 | 22 | public Type ResponseBodyType { get; set; } 23 | 24 | public bool HasCancellationTokenArgument { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Builder/MethodDispatcherBuildResult.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Builder 15 | { 16 | using System; 17 | 18 | internal class MethodDispatcherBuildResult : BuildResult 19 | { 20 | public MethodDispatcherBuildResult(CodeBuilderContext buildContext) 21 | : base(buildContext) 22 | { 23 | } 24 | 25 | public Type MethodDispatcherType { get; set; } 26 | 27 | public ActorMethodDispatcherBase MethodDispatcher { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Communication/WrappedMessage.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Runtime.Serialization; 15 | using Dapr.Actors; 16 | 17 | /// 18 | /// This is a marker class indicating the remoting request / response is wrapped or not. 19 | /// 20 | [DataContract(Name = "msgBodywrapped", Namespace = Constants.Namespace)] 21 | public abstract class WrappedMessage 22 | { 23 | /// 24 | /// Gets or sets the wrapped object. 25 | /// 26 | [DataMember(Name = "value", IsRequired = true, Order = 1)] 27 | public object Value 28 | { 29 | get; 30 | set; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Dapr.Actors.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | This package contains the reference assemblies for developing Actor services using Dapr. 6 | $(PackageTags);Actors 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Description/MethodReturnCheck.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors.Description 15 | { 16 | internal enum MethodReturnCheck 17 | { 18 | EnsureReturnsTask, 19 | EnsureReturnsVoid, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Dapr.Actors/IActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Actors 15 | { 16 | /// 17 | /// Base interface for inheriting reliable actor interfaces. 18 | /// 19 | public interface IActor 20 | { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Dapr.Actors/Runtime/IActorContextualState.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading.Tasks; 15 | 16 | namespace Dapr.Actors.Runtime 17 | { 18 | /// 19 | /// 20 | /// 21 | internal interface IActorContextualState 22 | { 23 | /// 24 | /// 25 | Task SetStateContext(string stateContext); 26 | } 27 | } -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/BulkSubscribeAppResponseStatus.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AspNetCore 15 | { 16 | /// 17 | /// Status of the message handled in bulk subscribe handler. 18 | /// 19 | public enum BulkSubscribeAppResponseStatus { 20 | /// 21 | /// Success 22 | /// 23 | SUCCESS, 24 | /// 25 | /// Failure 26 | /// 27 | RETRY, 28 | /// 29 | /// Drop 30 | /// 31 | DROP 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/BulkSubscribeTopicOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Dapr.AspNetCore 2 | { 3 | /// 4 | /// This class defines configurations for the bulk subscribe endpoint. 5 | /// 6 | public class BulkSubscribeTopicOptions 7 | { 8 | /// 9 | /// Maximum number of messages in a bulk message from the message bus. 10 | /// 11 | public int MaxMessagesCount { get; set; } = 100; 12 | 13 | /// 14 | /// Maximum duration to wait for maxBulkSubCount messages by the message bus 15 | /// before sending the messages to Dapr. 16 | /// 17 | public int MaxAwaitDurationMs { get; set; } = 1000; 18 | 19 | /// 20 | /// The name of the topic to be bulk subscribed. 21 | /// 22 | public string TopicName { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/CloudEventPropertyNames.cs: -------------------------------------------------------------------------------- 1 | namespace Dapr 2 | { 3 | internal static class CloudEventPropertyNames 4 | { 5 | public const string Data = "data"; 6 | public const string DataContentType = "datacontenttype"; 7 | public const string DataBase64 = "data_base64"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/Dapr.AspNetCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | This package contains the reference assemblies for developing services using Dapr and AspNetCore. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/FromStateBindingSource.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr 15 | { 16 | using Microsoft.AspNetCore.Mvc.ModelBinding; 17 | 18 | internal class FromStateBindingSource : BindingSource 19 | { 20 | public FromStateBindingSource(string storeName, string key) 21 | : base("state", "Dapr state store", isGreedy: true, isFromRequest: false) 22 | { 23 | this.StoreName = storeName; 24 | this.Key = key; 25 | } 26 | 27 | public string StoreName { get; } 28 | 29 | public string Key { get; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/IBulkSubscribeMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Dapr.AspNetCore 2 | { 3 | /// 4 | /// Bulk Subscribe Metadata that describes bulk subscribe configuration options. 5 | /// 6 | public interface IBulkSubscribeMetadata 7 | { 8 | /// 9 | /// Gets the maximum number of messages in a bulk message from the message bus. 10 | /// 11 | int MaxMessagesCount { get; } 12 | 13 | /// 14 | /// Gets the Maximum duration to wait for maxBulkSubCount messages by the message bus 15 | /// before sending the messages to Dapr. 16 | /// 17 | int MaxAwaitDurationMs { get; } 18 | 19 | /// 20 | /// The name of the topic to be bulk subscribed. 21 | /// 22 | public string TopicName { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/IDeadLetterTopicMetadata.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr 15 | { 16 | /// 17 | /// IDeadLetterTopicMetadata that describes the metadata of a dead letter topic. 18 | /// 19 | public interface IDeadLetterTopicMetadata 20 | { 21 | /// 22 | /// Gets the dead letter topic name 23 | /// 24 | public string DeadLetterTopic { get; } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/IRawTopicMetadata.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr 15 | { 16 | /// 17 | /// RawMetadata that describes subscribe endpoint to enable or disable processing raw messages. 18 | /// 19 | public interface IRawTopicMetadata 20 | { 21 | /// 22 | /// Gets the enable or disable value for processing raw messages. 23 | /// 24 | bool? EnableRawPayload { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Dapr.AspNetCore.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b1f597635c44597fcecb493e2b1327033b29b1a98ac956a1a538664b68f87d45fbaada0438a15a6265e62864947cc067d8da3a7d93c5eb2fcbb850e396c8684dba74ea477d82a1bbb18932c0efb30b64ff1677f85ae833818707ac8b49ad8062ca01d2c89d8ab1843ae73e8ba9649cd28666b539444dcdee3639f95e2a099bb2")] -------------------------------------------------------------------------------- /src/Dapr.AspNetCore/SubscribeOptions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr 15 | { 16 | /// 17 | /// This class defines configurations for the subscribe endpoint. 18 | /// 19 | public class SubscribeOptions 20 | { 21 | /// 22 | /// Gets or Sets a value which indicates whether to enable or disable processing raw messages. 23 | /// 24 | public bool EnableRawPayload { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Dapr.Client/ConcurrencyMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Client 15 | { 16 | /// 17 | /// Concurrency mode for state operations with Dapr. 18 | /// 19 | public enum ConcurrencyMode 20 | { 21 | /// 22 | /// State operations will be handled in a first-write-wins fashion 23 | /// 24 | FirstWrite, 25 | 26 | /// 27 | /// State operations will be handled in a last-write-wins fashion 28 | /// 29 | LastWrite, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Dapr.Client/ConsistencyMode.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Client 15 | { 16 | /// 17 | /// Consistency mode for state operations with Dapr. 18 | /// 19 | public enum ConsistencyMode 20 | { 21 | /// 22 | /// Eventual consistency. 23 | /// 24 | Eventual, 25 | 26 | /// 27 | /// Strong consistency. 28 | /// 29 | Strong, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Dapr.Client/Constants.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Net.Mime; 15 | 16 | namespace Dapr.Client 17 | { 18 | internal class Constants 19 | { 20 | public const string ContentTypeApplicationJson = MediaTypeNames.Application.Json; 21 | public const string ContentTypeApplicationGrpc = "application/grpc"; 22 | public const string ContentTypeCloudEvent = "application/cloudevents+json"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Dapr.Client/Dapr.Client.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | This package contains the reference assemblies for developing services using Dapr. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Dapr.Client/StartWorkflowResponse.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Client 15 | { 16 | /// 17 | /// Initializes a new . 18 | /// 19 | /// The instance ID associated with this response. 20 | public record StartWorkflowResponse(string InstanceId); 21 | } 22 | -------------------------------------------------------------------------------- /src/Dapr.Client/StateOperationType.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Client 15 | { 16 | /// 17 | /// Operation type for state operations with Dapr. 18 | /// 19 | public enum StateOperationType 20 | { 21 | /// 22 | /// Upsert a new or existing state 23 | /// 24 | Upsert, 25 | 26 | /// 27 | /// Delete a state 28 | /// 29 | Delete, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Dapr.Client/StateOptions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Client 15 | { 16 | /// 17 | /// Options when perfroming state operations with Dapr. 18 | /// 19 | public class StateOptions 20 | { 21 | /// 22 | /// Consistency mode for state operations with Dapr. 23 | /// 24 | public ConsistencyMode? Consistency { get; set; } 25 | 26 | /// 27 | /// Concurrency mode for state operations with Dapr. 28 | /// 29 | public ConcurrencyMode? Concurrency { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Dapr.Client/SubscribeConfigurationResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Dapr.Client 4 | { 5 | /// 6 | /// Response for a Subscribe Configuration request. 7 | /// 8 | public class SubscribeConfigurationResponse 9 | { 10 | private ConfigurationSource source; 11 | 12 | /// 13 | /// Constructor. 14 | /// 15 | /// The that provides the actual data from the subscription. 16 | public SubscribeConfigurationResponse(ConfigurationSource source) : base() 17 | { 18 | this.source = source; 19 | } 20 | 21 | /// 22 | /// The Id of the Subscription. This will be until the first result has been streamed. 23 | /// After that time, the Id can be used to unsubscribe. 24 | /// 25 | public string Id 26 | { 27 | get 28 | { 29 | return source.Id; 30 | } 31 | } 32 | 33 | /// 34 | /// Get the that is used to read the actual subscribed configuration data. 35 | /// 36 | public IAsyncEnumerable> Source => source; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Dapr.Client/UnsubscribeConfigurationResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Dapr.Client 2 | { 3 | /// 4 | /// Response from an Unsubscribe Configuration call. 5 | /// 6 | public class UnsubscribeConfigurationResponse 7 | { 8 | /// 9 | /// Boolean representing if the request was successful or not. 10 | /// 11 | public bool Ok { get; } 12 | 13 | /// 14 | /// The message from the Configuration API. 15 | /// 16 | public string Message { get; } 17 | 18 | /// 19 | /// Constructor. 20 | /// 21 | /// Boolean indicating success. 22 | /// Message from the Configuration API. 23 | public UnsubscribeConfigurationResponse(bool ok, string message) 24 | { 25 | Ok = ok; 26 | Message = message; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Dapr.Common/Dapr.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6;net7;net8;net9 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Dapr.Extensions.Configuration/Dapr.Extensions.Configuration.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | 6 | 7 | 8 | 9 | Dapr Secret Store configuration provider implementation for Microsoft.Extensions.Configuration. 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Dapr.Jobs/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Runtime.CompilerServices; 15 | 16 | [assembly: InternalsVisibleTo("Dapr.Jobs.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b1f597635c44597fcecb493e2b1327033b29b1a98ac956a1a538664b68f87d45fbaada0438a15a6265e62864947cc067d8da3a7d93c5eb2fcbb850e396c8684dba74ea477d82a1bbb18932c0efb30b64ff1677f85ae833818707ac8b49ad8062ca01d2c89d8ab1843ae73e8ba9649cd28666b539444dcdee3639f95e2a099bb2" )] 17 | -------------------------------------------------------------------------------- /src/Dapr.Jobs/Dapr.Jobs.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | enable 5 | enable 6 | Dapr.Jobs 7 | Dapr Jobs Authoring SDK 8 | Dapr Jobs SDK for scheduling jobs and tasks with Dapr 9 | alpha 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Dapr.Messaging/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Runtime.CompilerServices; 15 | 16 | [assembly: InternalsVisibleTo("Dapr.Messaging.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b1f597635c44597fcecb493e2b1327033b29b1a98ac956a1a538664b68f87d45fbaada0438a15a6265e62864947cc067d8da3a7d93c5eb2fcbb850e396c8684dba74ea477d82a1bbb18932c0efb30b64ff1677f85ae833818707ac8b49ad8062ca01d2c89d8ab1843ae73e8ba9649cd28666b539444dcdee3639f95e2a099bb2")] 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Dapr.Messaging/Dapr.Messaging.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | This package contains the reference assemblies for developing messaging services using Dapr. 5 | enable 6 | enable 7 | Dapr.Messaging 8 | Dapr Messaging SDK 9 | Dapr Messaging SDK for building applications that utilize messaging components. 10 | alpha 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Dapr.Messaging/PublishSubscribe/MessageHandlingPolicy.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | 15 | namespace Dapr.Messaging.PublishSubscribe; 16 | 17 | /// 18 | /// Defines the policy for handling streaming message subscriptions, including retry logic and timeout settings. 19 | /// 20 | /// The duration to wait before timing out a message handling operation. 21 | /// The default action to take when a message handling operation times out. 22 | public sealed record MessageHandlingPolicy(TimeSpan TimeoutDuration, TopicResponseAction DefaultResponseAction); 23 | 24 | -------------------------------------------------------------------------------- /src/Dapr.Messaging/PublishSubscribe/TopicMessageHandler.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2024 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.Messaging.PublishSubscribe; 15 | 16 | /// 17 | /// The handler delegate responsible for processing the topic message. 18 | /// 19 | /// The message request to process. 20 | /// Cancellation token. 21 | /// The acknowledgement behavior to report back to the pub/sub endpoint about the message. 22 | public delegate Task TopicMessageHandler(TopicMessage request, 23 | CancellationToken cancellationToken = default); 24 | -------------------------------------------------------------------------------- /src/Dapr.Protos/Dapr.Protos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6;net7;net8;net9 5 | enable 6 | enable 7 | This package contains the reference protos used by develop services using Dapr. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/Dapr.Workflow/Dapr.Workflow.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | net6;net7;net8;net9 7 | enable 8 | Dapr.Workflow 9 | Dapr Workflow Authoring SDK 10 | Dapr Workflow SDK for building workflows as code with Dapr 11 | 0.3.0 12 | alpha 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/Dapr.Workflow/IWorkflowContext.cs: -------------------------------------------------------------------------------- 1 | namespace Dapr.Workflow; 2 | 3 | /// 4 | /// Provides functionality available to orchestration code. 5 | /// 6 | public interface IWorkflowContext 7 | { 8 | /// 9 | /// Gets a value indicating whether the orchestration or operation is currently replaying itself. 10 | /// 11 | /// 12 | /// This property is useful when there is logic that needs to run only when *not* replaying. For example, 13 | /// certain types of application logging may become too noisy when duplicated as part of replay. The 14 | /// application code could check to see whether the function is being replayed and then issue 15 | /// the log statements when this value is false. 16 | /// 17 | /// 18 | /// true if the orchestration or operation is currently being replayed; otherwise false. 19 | /// 20 | bool IsReplaying { get; } 21 | } 22 | -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net6;net8;net9 7 | $(RepoRoot)bin\$(Configuration)\prod\$(MSBuildProjectName)\ 8 | 9 | $(OutputPath)$(MSBuildProjectName).xml 10 | 11 | 12 | 13 | 14 | true 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | true 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/Dapr.AI.Test/Dapr.AI.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | runtime; build; native; contentfiles; analyzers; buildtransitive 8 | all 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/Dapr.Actors.AspNetCore.IntegrationTest.App/Dapr.Actors.AspNetCore.IntegrationTest.App.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/Dapr.Actors.AspNetCore.IntegrationTest/Dapr.Actors.AspNetCore.IntegrationTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | runtime; build; native; contentfiles; analyzers; buildtransitive 5 | all 6 | 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/Dapr.Actors.AspNetCore.Test/Dapr.Actors.AspNetCore.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dapr.Actors.AspNetCore 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/Dapr.Actors.Generators.Test/AdditionalMetadataReferences.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Microsoft.CodeAnalysis; 15 | 16 | namespace Dapr.Actors.Generators; 17 | 18 | internal static class AdditionalMetadataReferences 19 | { 20 | public static readonly MetadataReference Actors = MetadataReference.CreateFromFile(typeof(Dapr.Actors.Client.ActorProxy).Assembly.Location); 21 | } -------------------------------------------------------------------------------- /test/Dapr.Actors.Generators.Test/Dapr.Actors.Generators.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | enable 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | runtime; build; native; contentfiles; analyzers; buildtransitive 22 | all 23 | 24 | 25 | runtime; build; native; contentfiles; analyzers; buildtransitive 26 | all 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/Dapr.Actors.Generators.Test/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | global using Xunit; -------------------------------------------------------------------------------- /test/Dapr.Actors.Test/Dapr.Actors.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Dapr.Actors 4 | $(DefineConstants);ACTORS 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | all 19 | runtime; build; native; contentfiles; analyzers; buildtransitive 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /test/Dapr.Actors.Test/Runtime/ActorReminderInfoTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | using System.Threading.Tasks; 5 | using Xunit; 6 | 7 | namespace Dapr.Actors.Runtime 8 | { 9 | public class ActorReminderInfoTests 10 | { 11 | [Fact] 12 | public async Task TestActorReminderInfo_SerializeExcludesNullTtl() 13 | { 14 | var info = new ReminderInfo(new byte[] { }, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10), 1); 15 | var serialized = await info.SerializeAsync(); 16 | 17 | Assert.DoesNotContain("ttl", serialized); 18 | var info2 = await ReminderInfo.DeserializeAsync(new MemoryStream(Encoding.UTF8.GetBytes(serialized))); 19 | Assert.Null(info2.Ttl); 20 | } 21 | 22 | [Fact] 23 | public async Task TestActorReminderInfo_SerializeIncludesTtlWhenSet() 24 | { 25 | var info = new ReminderInfo(new byte[] { }, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10), 1, TimeSpan.FromSeconds(1)); 26 | var serialized = await info.SerializeAsync(); 27 | 28 | Assert.Contains("ttl", serialized); 29 | var info2 = await ReminderInfo.DeserializeAsync(new MemoryStream(Encoding.UTF8.GetBytes(serialized))); 30 | Assert.NotNull(info2.Ttl); 31 | Assert.Equal(TimeSpan.FromSeconds(1), info2.Ttl); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/Dapr.AspNetCore.IntegrationTest.App/CustomTopicAttribute.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AspNetCore.IntegrationTest.App 15 | { 16 | using System; 17 | 18 | public class CustomTopicAttribute : Attribute, ITopicMetadata 19 | { 20 | public CustomTopicAttribute(string pubsubName, string name) 21 | { 22 | this.Name = "custom-" + name; 23 | this.PubsubName = "custom-" + pubsubName; 24 | } 25 | 26 | public string Name { get; } 27 | 28 | public string PubsubName { get; } 29 | 30 | public new string Match { get; } 31 | 32 | public int Priority { get; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/Dapr.AspNetCore.IntegrationTest.App/Dapr.AspNetCore.IntegrationTest.App.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/Dapr.AspNetCore.IntegrationTest.App/UserInfo.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AspNetCore.IntegrationTest.App 15 | { 16 | using System.ComponentModel.DataAnnotations; 17 | 18 | public class UserInfo 19 | { 20 | [Required] 21 | public string Name { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /test/Dapr.AspNetCore.IntegrationTest.App/Widget.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.AspNetCore.IntegrationTest.App 15 | { 16 | public class Widget 17 | { 18 | public string Size { get; set; } 19 | 20 | public int Count { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Dapr.AspNetCore.Test/Dapr.AspNetCore.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | runtime; build; native; contentfiles; analyzers; buildtransitive 6 | all 7 | 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/Dapr.Client.Test/Extensions/EnumExtensionTest.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Xunit; 3 | 4 | namespace Dapr.Client.Test.Extensions 5 | { 6 | public class EnumExtensionTest 7 | { 8 | [Fact] 9 | public void GetValueFromEnumMember_RedResolvesAsExpected() 10 | { 11 | var value = TestEnum.Red.GetValueFromEnumMember(); 12 | Assert.Equal("red", value); 13 | } 14 | 15 | [Fact] 16 | public void GetValueFromEnumMember_YellowResolvesAsExpected() 17 | { 18 | var value = TestEnum.Yellow.GetValueFromEnumMember(); 19 | Assert.Equal("YELLOW", value); 20 | } 21 | 22 | [Fact] 23 | public void GetValueFromEnumMember_BlueResolvesAsExpected() 24 | { 25 | var value = TestEnum.Blue.GetValueFromEnumMember(); 26 | Assert.Equal("Blue", value); 27 | } 28 | } 29 | 30 | public enum TestEnum 31 | { 32 | [EnumMember(Value = "red")] 33 | Red, 34 | [EnumMember(Value = "YELLOW")] 35 | Yellow, 36 | Blue 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/Dapr.Client.Test/Protos/test.proto: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | syntax = "proto3"; 15 | 16 | option csharp_namespace = "Dapr.Client.Autogen.Test.Grpc.v1"; 17 | 18 | message TestRun { 19 | repeated TestCase tests = 1; 20 | } 21 | 22 | message TestCase { 23 | string name = 1; 24 | } 25 | 26 | message Request { 27 | string RequestParameter = 1; 28 | } 29 | 30 | message Response { 31 | string Name = 1; 32 | } -------------------------------------------------------------------------------- /test/Dapr.Common.Test/Dapr.Common.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | runtime; build; native; contentfiles; analyzers; buildtransitive 6 | all 7 | 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/Dapr.Common.Test/Extensions/EnumExtensionsTest.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Dapr.Common.Extensions; 3 | using Xunit; 4 | 5 | namespace Dapr.Common.Test.Extensions; 6 | 7 | public class EnumExtensionTest 8 | { 9 | [Fact] 10 | public void GetValueFromEnumMember_RedResolvesAsExpected() 11 | { 12 | var value = TestEnum.Red.GetValueFromEnumMember(); 13 | Assert.Equal("red", value); 14 | } 15 | 16 | [Fact] 17 | public void GetValueFromEnumMember_YellowResolvesAsExpected() 18 | { 19 | var value = TestEnum.Yellow.GetValueFromEnumMember(); 20 | Assert.Equal("YELLOW", value); 21 | } 22 | 23 | [Fact] 24 | public void GetValueFromEnumMember_BlueResolvesAsExpected() 25 | { 26 | var value = TestEnum.Blue.GetValueFromEnumMember(); 27 | Assert.Equal("Blue", value); 28 | } 29 | } 30 | 31 | public enum TestEnum 32 | { 33 | [EnumMember(Value = "red")] 34 | Red, 35 | [EnumMember(Value = "YELLOW")] 36 | Yellow, 37 | Blue 38 | } 39 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors.Generators/Clients/IClientActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.Actors.Generators; 15 | 16 | namespace Dapr.E2E.Test.Actors.Generators.Clients; 17 | 18 | internal record ClientState(string Value); 19 | 20 | [GenerateActorClient] 21 | internal interface IClientActor 22 | { 23 | [ActorMethod(Name = "GetState")] 24 | Task GetStateAsync(CancellationToken cancellationToken = default); 25 | 26 | [ActorMethod(Name = "SetState")] 27 | Task SetStateAsync(ClientState state, CancellationToken cancellationToken = default); 28 | } 29 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors.Generators/Clients/IRemoteActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.Generators.Clients; 15 | 16 | public record RemoteState(string Value); 17 | 18 | public interface IRemoteActor : IPingActor 19 | { 20 | Task GetState(); 21 | 22 | Task SetState(RemoteState state); 23 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors.Generators/Dapr.E2E.Test.Actors.Generators.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | enable 5 | enable 6 | 7 | false 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | all 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors.Generators/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | global using Xunit; -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors.Generators/IPingActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2023 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using Dapr.Actors; 15 | 16 | namespace Dapr.E2E.Test.Actors.Generators; 17 | 18 | public interface IPingActor : IActor 19 | { 20 | Task Ping(); 21 | } 22 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Dapr.E2E.Test.Actors.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/ExceptionTesting/IExceptionActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2022 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | using Dapr.Actors; 14 | using System.Threading.Tasks; 15 | 16 | namespace Dapr.E2E.Test.Actors.ExceptionTesting 17 | { 18 | public interface IExceptionActor : IPingActor, IActor 19 | { 20 | Task ExceptionExample(); 21 | } 22 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/IPingActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading.Tasks; 15 | using Dapr.Actors; 16 | 17 | namespace Dapr.E2E.Test.Actors 18 | { 19 | public interface IPingActor : IActor 20 | { 21 | Task Ping(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/ISerializationActor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.Json; 4 | using System.Text.Json.Serialization; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Dapr.Actors; 8 | 9 | namespace Dapr.E2E.Test.Actors 10 | { 11 | public interface ISerializationActor : IActor, IPingActor 12 | { 13 | Task SendAsync(string name, SerializationPayload payload, CancellationToken cancellationToken = default); 14 | Task AnotherMethod(DateTime payload); 15 | } 16 | 17 | public record SerializationPayload(string Message) 18 | { 19 | public JsonElement Value { get; set; } 20 | 21 | [JsonExtensionData] 22 | public Dictionary ExtensionData { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reentrancy/CallRecord.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System; 15 | 16 | namespace Dapr.E2E.Test.Actors.Reentrancy 17 | { 18 | public class CallRecord 19 | { 20 | public bool IsEnter { get; set; } 21 | public DateTime Timestamp { get; set; } 22 | 23 | public int CallNumber { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reentrancy/IReentrantActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading.Tasks; 15 | using Dapr.Actors; 16 | 17 | namespace Dapr.E2E.Test.Actors.Reentrancy 18 | { 19 | public interface IReentrantActor : IPingActor, IActor 20 | { 21 | Task ReentrantCall(ReentrantCallOptions callOptions); 22 | 23 | Task GetState(int callNumber); 24 | } 25 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reentrancy/ReentrantCallOptions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.Reentrancy 15 | { 16 | public class ReentrantCallOptions 17 | { 18 | public int CallsRemaining { get; set; } 19 | 20 | public int CallNumber { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reentrancy/State.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Collections.Generic; 15 | 16 | namespace Dapr.E2E.Test.Actors.Reentrancy 17 | { 18 | public class State 19 | { 20 | public List Records { get; set; } = new List(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/RegressionActor/IRegression762Actor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading.Tasks; 15 | using Dapr.Actors; 16 | 17 | /// 18 | /// This actor is being used to test the specific regression found in: 19 | /// 20 | /// https://github.com/dapr/dotnet-sdk/issues/762 21 | /// 22 | namespace Dapr.E2E.Test.Actors.ErrorTesting 23 | { 24 | public interface IRegression762Actor : IPingActor, IActor 25 | { 26 | Task GetState(string id); 27 | 28 | Task SaveState(StateCall call); 29 | 30 | Task RemoveState(string id); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/RegressionActor/StateCall.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.ErrorTesting 15 | { 16 | public class StateCall 17 | { 18 | public string Key { get; set; } 19 | public string Value { get; set; } 20 | public string Operation { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reminders/StartReminderOptions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.Reminders 15 | { 16 | public class StartReminderOptions 17 | { 18 | public int Total { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Reminders/State.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System; 15 | 16 | namespace Dapr.E2E.Test.Actors.Reminders 17 | { 18 | public class State 19 | { 20 | public int Count { get; set; } 21 | 22 | public bool IsReminderRunning { get; set; } 23 | 24 | public DateTime Timestamp { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/State/IStateActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System; 15 | using System.Threading.Tasks; 16 | using Dapr.Actors; 17 | 18 | namespace Dapr.E2E.Test.Actors.State 19 | { 20 | public interface IStateActor : IPingActor, IActor 21 | { 22 | Task GetState(string key); 23 | 24 | Task SetState(string key, string value, TimeSpan? ttl); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Timers/ITimerActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System; 15 | using System.Threading.Tasks; 16 | using Dapr.Actors; 17 | 18 | namespace Dapr.E2E.Test.Actors.Timers 19 | { 20 | public interface ITimerActor : IPingActor, IActor 21 | { 22 | Task StartTimer(StartTimerOptions options); 23 | 24 | Task StartTimerWithTtl(TimeSpan ttl); 25 | 26 | Task GetState(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Timers/StartTimerOptions.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.Timers 15 | { 16 | public class StartTimerOptions 17 | { 18 | public int Total { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/Timers/State.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System; 15 | 16 | namespace Dapr.E2E.Test.Actors.Timers 17 | { 18 | public class State 19 | { 20 | public int Count { get; set; } 21 | 22 | public bool IsTimerRunning { get; set; } 23 | 24 | public DateTime Timestamp { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/WeaklyTypedTesting/DerivedResponse.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test.Actors.WeaklyTypedTesting 15 | { 16 | public class DerivedResponse : ResponseBase 17 | { 18 | public string DerivedProperty { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/WeaklyTypedTesting/IWeaklyTypedTestingActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Threading.Tasks; 15 | using Dapr.Actors; 16 | 17 | namespace Dapr.E2E.Test.Actors.WeaklyTypedTesting 18 | { 19 | public interface IWeaklyTypedTestingActor : IPingActor, IActor 20 | { 21 | Task GetPolymorphicResponse(); 22 | 23 | Task GetNullResponse(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.Actors/WeaklyTypedTesting/ResponseBase.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | using System.Text.Json.Serialization; 15 | 16 | namespace Dapr.E2E.Test.Actors.WeaklyTypedTesting 17 | { 18 | #if NET7_0_OR_GREATER 19 | [JsonDerivedType(typeof(DerivedResponse), typeDiscriminator: nameof(DerivedResponse))] 20 | #endif 21 | public class ResponseBase 22 | { 23 | public string BasePropeprty { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App.Grpc/Dapr.E2E.Test.App.Grpc.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App.ReentrantActor/Dapr.E2E.Test.App.ReentrantActors.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App.ReentrantActor/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App.ReentrantActor/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App/Account.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test 15 | { 16 | /// 17 | /// Class representing an Account for samples. 18 | /// 19 | public class Account 20 | { 21 | /// 22 | /// Gets or sets account id. 23 | /// 24 | public string Id { get; set; } 25 | 26 | /// 27 | /// Gets or sets account balance. 28 | /// 29 | public decimal Balance { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App/Actors/ExceptionActor.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2022 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | using Dapr.Actors.Runtime; 14 | using System.Threading.Tasks; 15 | 16 | namespace Dapr.E2E.Test.Actors.ExceptionTesting 17 | { 18 | public class ExceptionActor : Actor, IExceptionActor 19 | { 20 | public ExceptionActor(ActorHost host) 21 | : base(host) 22 | { 23 | } 24 | 25 | public Task Ping() 26 | { 27 | return Task.CompletedTask; 28 | } 29 | 30 | public Task ExceptionExample() 31 | { 32 | throw new System.Exception(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App/Actors/SerializationActor.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Dapr.Actors.Runtime; 6 | 7 | namespace Dapr.E2E.Test.Actors.Serialization 8 | { 9 | public class SerializationActor : Actor, ISerializationActor 10 | { 11 | public SerializationActor(ActorHost host) 12 | : base(host) 13 | { 14 | } 15 | 16 | public Task Ping() 17 | { 18 | return Task.CompletedTask; 19 | } 20 | 21 | public Task SendAsync(string name, 22 | SerializationPayload payload, CancellationToken cancellationToken = default) 23 | { 24 | return Task.FromResult(payload); 25 | } 26 | 27 | public Task AnotherMethod(DateTime payload){ 28 | return Task.FromResult(payload); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test.App/Dapr.E2E.Test.App.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/AVeryCoolWorkAroundTest.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | // This test has been added as a workaround for https://github.com/NasAmin/trx-parser/issues/111 14 | // to report dummy test results in Dapr.E2E.Test.dll 15 | // Can delete this once this bug is fixed 16 | namespace Dapr.E2E.WorkAround 17 | { 18 | using Xunit; 19 | 20 | public class WorkAroundTests 21 | { 22 | [Fact] 23 | public void AVeryCoolWorkAroundTest() 24 | { 25 | Assert.True(true); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/DaprRunConfiguration.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | namespace Dapr.E2E.Test 15 | { 16 | public class DaprRunConfiguration 17 | { 18 | public bool UseAppPort { get; set; } 19 | 20 | public string AppId { get; set; } 21 | 22 | public string AppProtocol { get; set; } 23 | 24 | public bool AppJsonSerialization { get; set; } 25 | 26 | public string ConfigurationPath { get; set; } 27 | 28 | public string TargetProject { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/components/pubsub.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: pubsub 5 | spec: 6 | type: pubsub.redis 7 | metadata: 8 | - name: redisHost 9 | value: localhost:6379 10 | - name: redisPassword 11 | value: "" 12 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/components/statestore.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: statestore 5 | spec: 6 | type: state.redis 7 | metadata: 8 | - name: redisHost 9 | value: localhost:6379 10 | - name: redisPassword 11 | value: "" 12 | - name: actorStateStore 13 | value: "true" 14 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/configuration/featureconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: dapr.io/v1alpha1 2 | kind: Configuration 3 | metadata: 4 | name: daprConfig 5 | spec: 6 | tracing: 7 | samplingRate: "1" 8 | zipkin: 9 | endpointAddress: http://localhost:9411/api/v2/spans 10 | features: 11 | - name: "Actor.Reentrancy" 12 | enabled: true 13 | - name: "proxy.grpc" 14 | enabled: true 15 | - name: "ActorStateTTL" 16 | enabled: true 17 | -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/deploy/local-test-kafka.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | zookeeper: 4 | image: wurstmeister/zookeeper:latest 5 | ports: 6 | - "2181:2181" 7 | kafka: 8 | image: wurstmeister/kafka:latest 9 | ports: 10 | - "9092:9092" 11 | environment: 12 | KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1 13 | KAFKA_CREATE_TOPICS: "sample:1:1" 14 | KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 -------------------------------------------------------------------------------- /test/Dapr.E2E.Test/deploy/local-test-vault.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | hashicorp_vault: 4 | image: vault 5 | ports: 6 | - "8200:8200" 7 | cap_add: 8 | - IPC_LOCK 9 | environment: 10 | VAULT_DEV_ROOT_TOKEN_ID: "myroot" -------------------------------------------------------------------------------- /test/Dapr.Jobs.Test/Dapr.Jobs.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | runtime; build; native; contentfiles; analyzers; buildtransitive 6 | all 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/Dapr.Messaging.Test/protos/test.proto: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------ 2 | // Copyright 2021 The Dapr Authors 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // http://www.apache.org/licenses/LICENSE-2.0 7 | // Unless required by applicable law or agreed to in writing, software 8 | // distributed under the License is distributed on an "AS IS" BASIS, 9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | // See the License for the specific language governing permissions and 11 | // limitations under the License. 12 | // ------------------------------------------------------------------------ 13 | 14 | syntax = "proto3"; 15 | 16 | option csharp_namespace = "Dapr.Client.Autogen.Test.Grpc.v1"; 17 | 18 | message TestRun { 19 | repeated TestCase tests = 1; 20 | } 21 | 22 | message TestCase { 23 | string name = 1; 24 | } 25 | 26 | message Request { 27 | string RequestParameter = 1; 28 | } 29 | 30 | message Response { 31 | string Name = 1; 32 | } -------------------------------------------------------------------------------- /test/Dapr.Workflow.Test/Dapr.Workflow.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | enable 4 | enable 5 | false 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net6;net7;net8;net9 6 | 7 | 8 | $(RepoRoot)bin\$(Configuration)\test\$(MSBuildProjectName)\ 9 | 10 | false 11 | 12 | 13 | 14 | 15 | 16 | 17 | --------------------------------------------------------------------------------