chore 调整项目结构
This commit is contained in:
@ -1,17 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Domain.Shared\KonSoft.Dispatch.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.ObjectExtending" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="8.3.4" />
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Domain\KonSoft.Dispatch.Domain.csproj" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Application.Contracts\KonSoft.Dispatch.Application.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Account.Application" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Identity.Application" Version="8.3.4" />
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using KonSoft.Dispatch.Data;
|
||||
using Serilog;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Data;
|
||||
|
||||
namespace KonSoft.Dispatch.DbMigrator;
|
||||
|
||||
public class DbMigratorHostedService : IHostedService
|
||||
{
|
||||
private readonly IHostApplicationLifetime _hostApplicationLifetime;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime, IConfiguration configuration)
|
||||
{
|
||||
_hostApplicationLifetime = hostApplicationLifetime;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
using (var application = await AbpApplicationFactory.CreateAsync<DispatchDbMigratorModule>(options =>
|
||||
{
|
||||
options.Services.ReplaceConfiguration(_configuration);
|
||||
options.UseAutofac();
|
||||
options.Services.AddLogging(c => c.AddSerilog());
|
||||
options.AddDataMigrationEnvironment();
|
||||
}))
|
||||
{
|
||||
await application.InitializeAsync();
|
||||
|
||||
await application
|
||||
.ServiceProvider
|
||||
.GetRequiredService<DispatchDbMigrationService>()
|
||||
.MigrateAsync();
|
||||
|
||||
await application.ShutdownAsync();
|
||||
|
||||
_hostApplicationLifetime.StopApplication();
|
||||
}
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
using KonSoft.Dispatch.EntityFrameworkCore;
|
||||
using Volo.Abp.Autofac;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Caching.StackExchangeRedis;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace KonSoft.Dispatch.DbMigrator;
|
||||
|
||||
[DependsOn(
|
||||
typeof(AbpAutofacModule),
|
||||
typeof(AbpCachingStackExchangeRedisModule),
|
||||
typeof(DispatchEntityFrameworkCoreModule),
|
||||
typeof(DispatchApplicationContractsModule)
|
||||
)]
|
||||
public class DispatchDbMigratorModule : AbpModule
|
||||
{
|
||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||
{
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Dispatch:"; });
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="appsettings.json" />
|
||||
<Content Include="appsettings.json">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Remove="appsettings.secrets.json" />
|
||||
<Content Include="appsettings.secrets.json">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.4" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Application.Contracts\KonSoft.Dispatch.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.EntityFrameworkCore\KonSoft.Dispatch.EntityFrameworkCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Logs\**" />
|
||||
<Content Remove="Logs\**" />
|
||||
<EmbeddedResource Remove="Logs\**" />
|
||||
<None Remove="Logs\**" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,41 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace KonSoft.Dispatch.DbMigrator;
|
||||
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning)
|
||||
#if DEBUG
|
||||
.MinimumLevel.Override("KonSoft.Dispatch", LogEventLevel.Debug)
|
||||
#else
|
||||
.MinimumLevel.Override("KonSoft.Dispatch", LogEventLevel.Information)
|
||||
#endif
|
||||
.Enrich.FromLogContext()
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt"))
|
||||
.WriteTo.Async(c => c.Console())
|
||||
.CreateLogger();
|
||||
|
||||
await CreateHostBuilder(args).RunConsoleAsync();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.AddAppSettingsSecretsJson()
|
||||
.ConfigureLogging((context, logging) => logging.ClearProviders())
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
services.AddHostedService<DbMigratorHostedService>();
|
||||
});
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"Default": "Host=localhost;Port=5432;Database=Dispatch;User ID=root;Password=myPassword;"
|
||||
},
|
||||
"Redis": {
|
||||
"Configuration": "127.0.0.1"
|
||||
},
|
||||
"OpenIddict": {
|
||||
"Applications": {
|
||||
"Dispatch_Swagger": {
|
||||
"ClientId": "Dispatch_Swagger",
|
||||
"RootUrl": "https://localhost:44321"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
{
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@ -1,17 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Domain.Shared\KonSoft.Dispatch.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Emailing" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Identity.Domain" Version="8.3.4" />
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -9,7 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Domain\KonSoft.Dispatch.Domain.csproj" />
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="8.3.4" />
|
||||
|
||||
@ -1,17 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Application.Contracts\KonSoft.Dispatch.Application.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="8.3.4" />
|
||||
|
||||
@ -1,17 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Application.Contracts\KonSoft.Dispatch.Application.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="8.3.4" />
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>KonSoft.Dispatch</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\KonSoft.Dispatch.Application\KonSoft.Dispatch.Application.csproj" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Domain.Tests\KonSoft.Dispatch.Domain.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -12,9 +10,4 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\KonSoft.Dispatch.Domain\KonSoft.Dispatch.Domain.csproj" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.TestBase\KonSoft.Dispatch.TestBase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -9,8 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\KonSoft.Dispatch.EntityFrameworkCore\KonSoft.Dispatch.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\KonSoft.Dispatch.Application.Tests\KonSoft.Dispatch.Application.Tests.csproj" />
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.Sqlite" Version="8.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel" Version="8.3.4" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.3.4" />
|
||||
<ProjectReference Include="..\..\src\KonSoft.Dispatch.HttpApi.Client\KonSoft.Dispatch.HttpApi.Client.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
Reference in New Issue
Block a user