Browse Source

Convert to local ABP references

pull/751/head
Halil ibrahim Kalkan 7 years ago
parent
commit
f92f5a611b
  1. 3
      samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj
  2. 84
      samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductServiceHostModule.cs
  3. 44
      samples/MicroserviceDemo/microservices/product/ProductService.Host/Program.cs
  4. 30
      samples/MicroserviceDemo/microservices/product/ProductService.Host/Startup.cs
  5. 3
      samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json
  6. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj
  7. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj
  8. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj
  9. 4
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj
  10. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj
  11. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj
  12. 2
      samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj
  13. 8
      samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj
  14. 6
      samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj

3
samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj

@ -25,6 +25,9 @@
<ProjectReference Include="..\..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\product\src\ProductManagement.Application\ProductManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\product\src\ProductManagement.EntityFrameworkCore\ProductManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\product\src\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

84
samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductServiceHostModule.cs

@ -0,0 +1,84 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using ProductManagement;
using ProductManagement.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Swagger;
using Volo.Abp;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.Security.Claims;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
namespace ProductService.Host
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(ProductManagementApplicationModule),
typeof(ProductManagementHttpApiModule),
typeof(ProductManagementEntityFrameworkCoreModule)
)]
public class ProductServiceHostModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:64999";
options.RequireHttpsMetadata = false;
options.ApiName = "ProductService";
//TODO: Should create an extension method for that (may require to create a new ABP package depending on the IdentityServer4.AccessTokenValidation)
options.InboundJwtClaimTypeMap["sub"] = AbpClaimTypes.UserId;
options.InboundJwtClaimTypeMap["role"] = AbpClaimTypes.Role;
options.InboundJwtClaimTypeMap["email"] = AbpClaimTypes.Email;
options.InboundJwtClaimTypeMap["email_verified"] = AbpClaimTypes.EmailVerified;
options.InboundJwtClaimTypeMap["phone_number"] = AbpClaimTypes.PhoneNumber;
options.InboundJwtClaimTypeMap["phone_number_verified"] = AbpClaimTypes.PhoneNumberVerified;
options.InboundJwtClaimTypeMap["name"] = AbpClaimTypes.UserName;
});
context.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Info {Title = "Product Service API", Version = "v1"});
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
});
Configure<AbpDbContextOptions>(options =>
{
options.UseSqlServer();
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseVirtualFiles();
app.UseAuthentication();
app.UseAbpRequestLocalization(); //TODO: localization?
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Product Service API");
});
app.UseAuditing();
app.UseMvcWithDefaultRouteAndArea();
}
}
}

44
samples/MicroserviceDemo/microservices/product/ProductService.Host/Program.cs

@ -1,24 +1,46 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Serilog;
using Microsoft.Extensions.Logging; using Serilog.Events;
namespace ProductService.Host namespace ProductService.Host
{ {
public class Program public class Program
{ {
public static void Main(string[] args) public static int Main(string[] args)
{ {
CreateWebHostBuilder(args).Build().Run(); Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.File("Logs/logs.txt")
.CreateLogger();
try
{
Log.Information("Starting IdentityService.Host.");
BuildWebHostInternal(args).Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "IdentityService.Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
} }
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => public static IWebHost BuildWebHostInternal(string[] args) =>
WebHost.CreateDefaultBuilder(args) new WebHostBuilder()
.UseStartup<Startup>(); .UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseSerilog()
.Build();
} }
} }

30
samples/MicroserviceDemo/microservices/product/ProductService.Host/Startup.cs

@ -1,34 +1,28 @@
using System; using System;
using System.Collections.Generic; using Volo.Abp;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ProductService.Host namespace ProductService.Host
{ {
public class Startup public class Startup
{ {
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services)
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{ {
services.AddApplication<ProductServiceHostModule>(options =>
{
options.UseAutofac();
options.Configuration.UserSecretsAssembly = typeof(Startup).Assembly;
});
return services.BuildServiceProviderFromFactory();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{ {
if (env.IsDevelopment()) app.InitializeApplication();
{
app.UseDeveloperExceptionPage();
}
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
} }
} }
} }

3
samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json

@ -1,6 +1,7 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Product;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=MsDemo_Product;Trusted_Connection=True;MultipleActiveResultSets=true",
"ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Ddd.Application\Volo.Abp.Ddd.Application.csproj" />
<ProjectReference Include="..\ProductManagement.Domain.Shared\ProductManagement.Domain.Shared.csproj" /> <ProjectReference Include="..\ProductManagement.Domain.Shared\ProductManagement.Domain.Shared.csproj" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="0.12.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj

@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="0.12.0" /> <ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\ProductManagement.Domain\ProductManagement.Domain.csproj" /> <ProjectReference Include="..\ProductManagement.Domain\ProductManagement.Domain.csproj" />
</ItemGroup> </ItemGroup>

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj

@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Localization" Version="0.12.0" /> <ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj

@ -6,9 +6,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore\Volo.Abp.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\ProductManagement.Domain.Shared\ProductManagement.Domain.Shared.csproj" /> <ProjectReference Include="..\ProductManagement.Domain.Shared\ProductManagement.Domain.Shared.csproj" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="0.12.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="0.12.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.EntityFrameworkCore\Volo.Abp.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\ProductManagement.Domain\ProductManagement.Domain.csproj" /> <ProjectReference Include="..\ProductManagement.Domain\ProductManagement.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="0.12.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Http.Client\Volo.Abp.Http.Client.csproj" />
<ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" />
<PackageReference Include="Volo.Abp.Http.Client" Version="0.12.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj

@ -6,8 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc\Volo.Abp.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\ProductManagement.Application.Contracts\ProductManagement.Application.Contracts.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="0.12.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

8
samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj

@ -14,20 +14,16 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="wwwroot\**" />
<Content Remove="Pages\**\*.cshtml" /> <Content Remove="Pages\**\*.cshtml" />
<Content Remove="Localization\Resources\**\*.json" /> <Content Remove="Localization\Resources\**\*.json" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="wwwroot\**" />
<Content Remove="Properties\launchSettings.json" /> <Content Remove="Properties\launchSettings.json" />
<None Include="Properties\launchSettings.json" /> <None Include="Properties\launchSettings.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" /> <ProjectReference Include="..\ProductManagement.HttpApi\ProductManagement.HttpApi.csproj" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="0.12.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared" Version="0.12.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

6
samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj

@ -6,9 +6,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="0.12.0" /> <ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<PackageReference Include="Volo.Abp.Authorization" Version="0.12.0" /> <ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.Authorization\Volo.Abp.Authorization.csproj" />
<PackageReference Include="Volo.Abp.TestBase" Version="0.12.0" /> <ProjectReference Include="..\..\..\..\..\..\framework\src\Volo.Abp.TestBase\Volo.Abp.TestBase.csproj" />
<ProjectReference Include="..\..\src\ProductManagement.Domain\ProductManagement.Domain.csproj" /> <ProjectReference Include="..\..\src\ProductManagement.Domain\ProductManagement.Domain.csproj" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save