-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3be7fd0
commit c790bbb
Showing
86 changed files
with
567 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 0 additions & 73 deletions
73
src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/ServiceExtensions.cs
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
src/ApiGateways/Masa.Tsc.ApiGateways.Caller/Extensions/TscCallerServiceExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class TscCallerServiceExtensions | ||
{ | ||
internal const string DEFAULT_CLIENT_NAME = "masa.tsc.apigateways.caller"; | ||
internal const string AUTH_CLIENT_NAME = "masa.tsc.auth.apigateways.caller"; | ||
|
||
//public static IServiceCollection AddTscApiCaller(this IServiceCollection services, string appid, string authAppid) | ||
//{ | ||
// try | ||
// { | ||
// var caller = services.BuildServiceProvider().GetRequiredService<ICallerFactory>().Create(DEFAULT_CLIENT_NAME); | ||
// if (caller != null) | ||
// return services; | ||
// } | ||
// catch | ||
// { | ||
// IServiceProvider serviceProviderCopy = services.BuildServiceProvider(); | ||
// services.AddCaller(DEFAULT_CLIENT_NAME, builder => | ||
// { | ||
// builder.UseDapr(options => options.AppId = appid, | ||
// builder => builder.UseDaprApiToken(serviceProviderCopy.GetRequiredService<TokenProvider>()?.AccessToken)); | ||
// }).AddCaller(AUTH_CLIENT_NAME, builder => | ||
// { | ||
// builder.UseDapr(options => options.AppId = authAppid, | ||
// builder => builder.UseDaprApiToken(serviceProviderCopy.GetRequiredService<TokenProvider>()?.AccessToken)); | ||
// }); | ||
|
||
// services.AddScoped(serviceProvider => | ||
// { | ||
// serviceProviderCopy = serviceProvider; | ||
// var callerFactory = serviceProvider.GetRequiredService<ICallerFactory>(); | ||
// var client = new TscCaller(serviceProviderCopy, callerFactory); | ||
// return client; | ||
// }); | ||
// } | ||
|
||
// return services; | ||
//} | ||
|
||
public static IServiceCollection AddTscHttpApiCaller(this IServiceCollection services, string tscApiUrl, string authApiUrl) | ||
{ | ||
try | ||
{ | ||
var caller = services.BuildServiceProvider().GetRequiredService<ICallerFactory>().Create(DEFAULT_CLIENT_NAME); | ||
if (caller != null) | ||
return services; | ||
} | ||
catch | ||
{ | ||
services.AddCaller(DEFAULT_CLIENT_NAME, builder => | ||
{ | ||
builder.UseHttpClient(options => options.BaseAddress = tscApiUrl).UseAuthentication(); | ||
}) | ||
.AddCaller(AUTH_CLIENT_NAME, builder => | ||
{ | ||
builder.UseHttpClient(options => options.BaseAddress = authApiUrl).UseAuthentication(); | ||
}); | ||
|
||
services.AddScoped(serviceProvider => | ||
{ | ||
var callerFactory = serviceProvider.GetRequiredService<ICallerFactory>(); | ||
var client = new TscCaller(serviceProvider, callerFactory); | ||
return client; | ||
}); | ||
} | ||
|
||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 11 additions & 15 deletions
26
src/Contracts/Masa.Tsc.Contracts.Admin/Masa.Tsc.Contracts.Admin.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="Instruments\Query\**" /> | ||
<EmbeddedResource Remove="Instruments\Query\**" /> | ||
<None Remove="Instruments\Query\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentValidation" Version="11.4.0" /> | ||
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Tsc.Contracts" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Masa.Contrib.Authentication.Identity" Version="$(MasaFrameworkPackageVersion)" /> | ||
<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Masa.Contrib.StackSdks.Pm" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Masa.Contrib.Configuration.ConfigurationApi.Dcc" Version="$(MasaFrameworkPackageVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" /> | ||
<!--<PackageReference Include="Masa.BuildingBlocks.StackSdks.Tsc.Contracts" Version="$(MasaSdkPackageVersion)" />--> | ||
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Auth.Contracts" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Masa.BuildingBlocks.StackSdks.Pm" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" /> | ||
<!--<PackageReference Include="Masa.Contrib.Authentication.Identity" Version="$(MasaFrameworkPackageVersion)" />--> | ||
<!--<PackageReference Include="Masa.Contrib.StackSdks.Auth" Version="$(MasaSdkPackageVersion)" /> | ||
<PackageReference Include="Masa.Contrib.StackSdks.Pm" Version="$(MasaSdkPackageVersion)" />--> | ||
<!--<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />--> | ||
<PackageReference Include="Util.Reflection" Version="1.0.3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Infrastructure\Masa.Tsc.Storage.Prometheus\Masa.Tsc.Storage.Prometheus.csproj" /> | ||
<ProjectReference Include="..\..\Infrastructure\Masa.Tsc.Storage.Prometheus.Shared\Masa.Tsc.Storage.Prometheus.Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
20 changes: 12 additions & 8 deletions
20
src/Infrastructure/Masa.Tsc.Domain.Shared/Masa.Tsc.Domain.Shared.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Contracts\Masa.Tsc.Contracts.Admin\Masa.Tsc.Contracts.Admin.csproj" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Contracts\Masa.Tsc.Contracts.Admin\Masa.Tsc.Contracts.Admin.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Masa.BuildingBlocks.Ddd.Domain" Version="$(MasaFrameworkPackageVersion)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.