committed by
GitHub
33 changed files with 855 additions and 84 deletions
@ -0,0 +1,72 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Options; |
|||
using System; |
|||
|
|||
namespace Dapr.Client |
|||
{ |
|||
public static class DaprClientBuilderExtensions |
|||
{ |
|||
public static IDaprClientBuilder ConfigureDaprClient(this IDaprClientBuilder builder, Action<DaprClient> configureClient) |
|||
{ |
|||
if (builder == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
if (configureClient == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(configureClient)); |
|||
} |
|||
|
|||
builder.Services.Configure<DaprClientFactoryOptions>(builder.Name, options => |
|||
{ |
|||
options.DaprClientActions.Add(configureClient); |
|||
}); |
|||
|
|||
return builder; |
|||
} |
|||
|
|||
public static IDaprClientBuilder ConfigureDaprClient(this IDaprClientBuilder builder, Action<DaprClientBuilder> configureBuilder) |
|||
{ |
|||
if (builder == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
if (configureBuilder == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(configureBuilder)); |
|||
} |
|||
|
|||
builder.Services.Configure<DaprClientFactoryOptions>(builder.Name, options => |
|||
{ |
|||
options.DaprClientBuilderActions.Add(configureBuilder); |
|||
}); |
|||
|
|||
return builder; |
|||
} |
|||
|
|||
public static IDaprClientBuilder ConfigureDaprClient(this IDaprClientBuilder builder, Action<IServiceProvider, DaprClientBuilder> configureClientBuilder) |
|||
{ |
|||
if (builder == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(builder)); |
|||
} |
|||
|
|||
if (configureClientBuilder == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(configureClientBuilder)); |
|||
} |
|||
|
|||
builder.Services.AddTransient<IConfigureOptions<DaprClientFactoryOptions>>(services => |
|||
{ |
|||
return new ConfigureNamedOptions<DaprClientFactoryOptions>(builder.Name, (options) => |
|||
{ |
|||
options.DaprClientBuilderActions.Add(client => configureClientBuilder(services, client)); |
|||
}); |
|||
}); |
|||
|
|||
return builder; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using Grpc.Net.Client; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json; |
|||
|
|||
namespace Dapr.Client |
|||
{ |
|||
public class DaprClientFactoryOptions |
|||
{ |
|||
public string DaprApiToken{ get; set; } |
|||
public string HttpEndpoint { get; set; } |
|||
public string GrpcEndpoint { get; set; } |
|||
public GrpcChannelOptions GrpcChannelOptions { get; set; } |
|||
public JsonSerializerOptions JsonSerializerOptions { get; set; } |
|||
public IList<Action<DaprClient>> DaprClientActions { get; } = new List<Action<DaprClient>>(); |
|||
public IList<Action<DaprClientBuilder>> DaprClientBuilderActions { get; } = new List<Action<DaprClientBuilder>>(); |
|||
public DaprClientFactoryOptions() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace Dapr.Client |
|||
{ |
|||
internal class DefaultDaprClientBuilder : IDaprClientBuilder |
|||
{ |
|||
public DefaultDaprClientBuilder(IServiceCollection services, string name) |
|||
{ |
|||
Services = services; |
|||
Name = name; |
|||
} |
|||
|
|||
public string Name { get; } |
|||
|
|||
public IServiceCollection Services { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
using Microsoft.Extensions.Options; |
|||
using System; |
|||
using System.Collections.Concurrent; |
|||
using System.Threading; |
|||
|
|||
namespace Dapr.Client |
|||
{ |
|||
public class DefaultDaprClientFactory : IDaprClientFactory |
|||
{ |
|||
private readonly IOptionsMonitor<DaprClientFactoryOptions> _optionsMonitor; |
|||
|
|||
private readonly Func<string, Lazy<DaprClient>> _daprClientFactory; |
|||
internal readonly ConcurrentDictionary<string, Lazy<DaprClient>> _daprClients; |
|||
|
|||
public DefaultDaprClientFactory( |
|||
IOptionsMonitor<DaprClientFactoryOptions> optionsMonitor) |
|||
{ |
|||
_optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); |
|||
|
|||
_daprClients = new ConcurrentDictionary<string, Lazy<DaprClient>>(); |
|||
|
|||
_daprClientFactory = (name) => |
|||
{ |
|||
return new Lazy<DaprClient>(() => |
|||
{ |
|||
return InternalCreateDaprClient(name); |
|||
}, LazyThreadSafetyMode.ExecutionAndPublication); |
|||
}; |
|||
} |
|||
|
|||
public DaprClient CreateClient(string name) |
|||
{ |
|||
if (name == null) |
|||
{ |
|||
throw new ArgumentNullException(nameof(name)); |
|||
} |
|||
|
|||
var client = _daprClients.GetOrAdd(name, _daprClientFactory).Value; |
|||
|
|||
var options = _optionsMonitor.Get(name); |
|||
for (int i = 0; i < options.DaprClientActions.Count; i++) |
|||
{ |
|||
options.DaprClientActions[i](client); |
|||
} |
|||
|
|||
return client; |
|||
} |
|||
|
|||
internal DaprClient InternalCreateDaprClient(string name) |
|||
{ |
|||
var builder = new DaprClientBuilder(); |
|||
|
|||
var options = _optionsMonitor.Get(name); |
|||
|
|||
if (!string.IsNullOrWhiteSpace(options.HttpEndpoint)) |
|||
{ |
|||
builder.UseHttpEndpoint(options.HttpEndpoint); |
|||
} |
|||
if (!string.IsNullOrWhiteSpace(options.GrpcEndpoint)) |
|||
{ |
|||
builder.UseGrpcEndpoint(options.GrpcEndpoint); |
|||
} |
|||
if (options.GrpcChannelOptions != null) |
|||
{ |
|||
builder.UseGrpcChannelOptions(options.GrpcChannelOptions); |
|||
} |
|||
if (options.JsonSerializerOptions != null) |
|||
{ |
|||
builder.UseJsonSerializationOptions(options.JsonSerializerOptions); |
|||
} |
|||
|
|||
builder.UseDaprApiToken(options.DaprApiToken); |
|||
|
|||
for (int i = 0; i < options.DaprClientBuilderActions.Count; i++) |
|||
{ |
|||
options.DaprClientBuilderActions[i](builder); |
|||
} |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace Dapr.Client |
|||
{ |
|||
public interface IDaprClientBuilder |
|||
{ |
|||
string Name { get; } |
|||
IServiceCollection Services { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Dapr.Client |
|||
{ |
|||
public interface IDaprClientFactory |
|||
{ |
|||
DaprClient CreateClient(string name); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using Dapr.Client; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Client |
|||
{ |
|||
public class AbpDaprClientBuilderOptions |
|||
{ |
|||
public List<Action<string, DaprClient>> ProxyClientActions { get; } |
|||
|
|||
public List<Action<string, IServiceProvider, DaprClientBuilder>> ProxyClientBuildActions { get; } |
|||
|
|||
internal HashSet<string> ConfiguredProxyClients { get; } |
|||
|
|||
public AbpDaprClientBuilderOptions() |
|||
{ |
|||
ConfiguredProxyClients = new HashSet<string>(); |
|||
ProxyClientActions = new List<Action<string, DaprClient>>(); |
|||
ProxyClientBuildActions = new List<Action<string, IServiceProvider, DaprClientBuilder>>(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using Grpc.Net.Client; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Client |
|||
{ |
|||
public class AbpDaprClientOptions |
|||
{ |
|||
public string GrpcEndpoint { get; set; } |
|||
public string HttpEndpoint { get; set; } |
|||
public GrpcChannelOptions GrpcChannelOptions { get; set; } |
|||
public AbpDaprClientOptions() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
namespace LINGYUN.Abp.Dapr.Client.DynamicProxying |
|||
{ |
|||
public class DaprClientProxy<TRemoteService> : IDaprClientProxy<TRemoteService> |
|||
{ |
|||
public TRemoteService Service { get; } |
|||
|
|||
public DaprClientProxy(TRemoteService service) |
|||
{ |
|||
Service = service; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace LINGYUN.Abp.Dapr.Client.DynamicProxying |
|||
{ |
|||
public interface IDaprClientProxy<out TRemoteService> |
|||
{ |
|||
TRemoteService Service { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="4.3.0" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="4.3.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\modules\dapr\LINGYUN.Abp.Dapr.Actors.AspNetCore\LINGYUN.Abp.Dapr.Actors.AspNetCore.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Dapr.Tests\LINGYUN.Abp.Dapr.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,39 @@ |
|||
using LINGYUN.Abp.Dapr.Actors.AspNetCore; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Dapr |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAspNetCoreMvcModule), |
|||
typeof(AbpDaprActorsAspNetCoreModule) |
|||
)] |
|||
public class AbpDaprAspNetCoreTestHostModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<IMvcBuilder>(builder => |
|||
{ |
|||
builder.AddApplicationPart(typeof(AbpDaprAspNetCoreTestHostModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
var configuration = context.Services.GetConfiguration(); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
|
|||
app.UseRouting(); |
|||
app.UseAuditing(); |
|||
app.UseConfiguredEndpoints(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
using Dapr.Actors.Runtime; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Actors |
|||
{ |
|||
public class TestActor : Actor, ITestActor, ISingletonDependency |
|||
{ |
|||
public TestActor(ActorHost host) : base(host) |
|||
{ |
|||
} |
|||
|
|||
public async Task<ListResultDto<NameValue>> GetAsync() |
|||
{ |
|||
var values = await GetValuesByStateAsync(); |
|||
|
|||
return new ListResultDto<NameValue>(values); |
|||
} |
|||
|
|||
public async Task<NameValue> UpdateAsync() |
|||
{ |
|||
var values = await GetValuesByStateAsync(); |
|||
|
|||
var inctement = await StateManager.AddOrUpdateStateAsync( |
|||
"test:actors:increment", |
|||
1, |
|||
(key, value) => |
|||
{ |
|||
return value + 1; |
|||
}); |
|||
|
|||
values[0].Value = $"value:updated:{inctement}"; |
|||
|
|||
return values[0]; |
|||
} |
|||
|
|||
public async Task ClearAsync() |
|||
{ |
|||
await StateManager.TryRemoveStateAsync("test:actors:increment"); |
|||
await StateManager.TryRemoveStateAsync("test:actors"); |
|||
} |
|||
|
|||
protected virtual async Task<List<NameValue>> GetValuesByStateAsync() |
|||
{ |
|||
return await StateManager |
|||
.GetOrAddStateAsync( |
|||
"test:actors", |
|||
new List<NameValue> |
|||
{ |
|||
new NameValue("name1", "value1"), |
|||
new NameValue("name2", "value2"), |
|||
new NameValue("name3", "value3"), |
|||
new NameValue("name4", "value4"), |
|||
new NameValue("name5", "value5") |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Collections.Generic; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.ServiceInvocation |
|||
{ |
|||
[RemoteService(Name = "TestDapr")] |
|||
[Route("api/dapr/test")] |
|||
public class TestAppService : AbpController, ITestAppService |
|||
{ |
|||
private static int _inctement; |
|||
private readonly List<NameValue> _cache = new List<NameValue> |
|||
{ |
|||
new NameValue("name1", "value1"), |
|||
new NameValue("name2", "value2"), |
|||
new NameValue("name3", "value3"), |
|||
new NameValue("name4", "value4"), |
|||
new NameValue("name5", "value5") |
|||
}; |
|||
|
|||
[HttpGet] |
|||
public Task<ListResultDto<NameValue>> GetAsync() |
|||
{ |
|||
return Task.FromResult(new ListResultDto<NameValue>(_cache)); |
|||
} |
|||
|
|||
[HttpPut] |
|||
public Task<NameValue> UpdateAsync() |
|||
{ |
|||
Interlocked.Increment(ref _inctement); |
|||
|
|||
_cache[0].Value = $"value:updated:{_inctement}"; |
|||
|
|||
return Task.FromResult(_cache[0]); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.AspNetCore.TestHost |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static int Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
internal static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}) |
|||
.UseAutofac(); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:29703", |
|||
"sslPort": 0 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"LINGYUN.Abp.Dapr.AspNetCore.TestHost": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": "true", |
|||
"launchBrowser": false, |
|||
"applicationUrl": "http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.AspNetCore.TestHost |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<AbpDaprAspNetCoreTestHostModule>(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> |
|||
<PackageReference Include="xunit" Version="2.4.1" /> |
|||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
<PackageReference Include="coverlet.collector" Version="1.3.0"> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\modules\dapr\LINGYUN.Abp.Dapr.Client\LINGYUN.Abp.Dapr.Client.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Dapr.Tests\LINGYUN.Abp.Dapr.Tests.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Update="appsettings.Development.json"> |
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|||
</None> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,34 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using System.Threading; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Client.Tests |
|||
{ |
|||
public class AbpDaptClientTestBase : AbpTestsBase<AbpDaptClientTestModule> |
|||
{ |
|||
// private Process _hostProcess;
|
|||
|
|||
//protected override void BeforeAddApplication(IServiceCollection services)
|
|||
//{
|
|||
// // TODO: 运行测试前先启动宿主进程 dapr run --app-id testdapr --app-port 5000 -H 10000 -- dotnet run --no-build
|
|||
// var workingDirectory = Path.Combine(Directory.GetCurrentDirectory(), "../../../../LINGYUN.Abp.Dapr.AspNetCore.TestHost");
|
|||
// _hostProcess = Process.Start(new ProcessStartInfo
|
|||
// {
|
|||
// WorkingDirectory = workingDirectory,
|
|||
// FileName = "powershell",
|
|||
// Arguments = "dapr run --app-id testdapr --app-port 5000 -H 10000 -- dotnet run --no-build",
|
|||
// UseShellExecute = true
|
|||
// });
|
|||
|
|||
// // 等待.NET进程启动完毕
|
|||
// Thread.Sleep(15000);
|
|||
//}
|
|||
|
|||
//public override void Dispose()
|
|||
//{
|
|||
// _hostProcess?.CloseMainWindow();
|
|||
//}
|
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
using Volo.Abp.Modularity; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Configuration; |
|||
using System.IO; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Client.Tests |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDaprTestModule), |
|||
typeof(AbpTestsBaseModule), |
|||
typeof(AbpDaprClientModule))] |
|||
public class AbpDaptClientTestModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.ReplaceConfiguration( |
|||
ConfigurationHelper.BuildConfiguration( |
|||
new AbpConfigurationBuilderOptions |
|||
{ |
|||
EnvironmentName = "Development", |
|||
BasePath = Directory.GetCurrentDirectory() |
|||
})); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddDaprClientProxies( |
|||
typeof(AbpDaprTestModule).Assembly, |
|||
"TestDapr"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using LINGYUN.Abp.Dapr.ServiceInvocation; |
|||
using Shouldly; |
|||
using System.Threading.Tasks; |
|||
using Xunit; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Client.Tests |
|||
{ |
|||
public class TestAppServiceTests : AbpDaptClientTestBase |
|||
{ |
|||
private readonly ITestAppService _service; |
|||
|
|||
public TestAppServiceTests() |
|||
{ |
|||
_service = GetRequiredService<ITestAppService>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Get_Result_Items_Count_Should_5() |
|||
{ |
|||
var result = await _service.GetAsync(); |
|||
|
|||
result.Items.Count.ShouldBe(5); |
|||
} |
|||
|
|||
[Fact] |
|||
public async Task Update_Result_Value_Should_Value_Updated_1() |
|||
{ |
|||
var result = await _service.UpdateAsync(); |
|||
|
|||
result.Value.ShouldBe("value:updated:1"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net5.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Dapr.Actors" Version="1.1.0" /> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.3.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Dapr |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpDddApplicationContractsModule))] |
|||
public class AbpDaprTestModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using Dapr.Actors; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.Actors |
|||
{ |
|||
[RemoteService(Name = "Test")] |
|||
public interface ITestActor : IActor |
|||
{ |
|||
Task<ListResultDto<NameValue>> GetAsync(); |
|||
|
|||
Task<NameValue> UpdateAsync(); |
|||
|
|||
Task ClearAsync(); |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace LINGYUN.Abp.Dapr.ServiceInvocation |
|||
{ |
|||
public interface ITestAppService : IApplicationService |
|||
{ |
|||
Task<ListResultDto<NameValue>> GetAsync(); |
|||
|
|||
Task<NameValue> UpdateAsync(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue