Skip to content

Commit

Permalink
update .net core 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KingYSoft committed Jun 12, 2024
1 parent 5baee30 commit 2e7d5d8
Show file tree
Hide file tree
Showing 21 changed files with 111 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>FacadeCompanyName.FacadeProjectName.Application</AssemblyName>
<PackageId>FacadeCompanyName.FacadeProjectName.Application</PackageId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>FacadeCompanyName.FacadeProjectName.DomainService.Share</AssemblyName>
<PackageId>FacadeCompanyName.FacadeProjectName.DomainService.Share</PackageId>
Expand All @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Facade.Dapper.Oracle" Version="4.4.4" />
<PackageReference Include="Facade.NLogger" Version="4.4.4" />
<PackageReference Include="Facade.Dapper.Oracle" Version="5.1.1" />
<PackageReference Include="Facade.NLogger" Version="5.1.1" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
public class FacadeConfiguration : IFacadeConfiguration
{
public string AppName { get; set; }
public string AppRootPath { get; set; }
public string AppEnvName { get; set; }
public bool IsDevelopment { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
{
public interface IFacadeConfiguration
{
string AppName { get; }

string AppName { get; }
string AppRootPath { get; }
/// <summary>
/// app running env name.
/// </summary>
string AppEnvName { get; }
/// <summary>
/// is local development
/// </summary>
bool IsDevelopment { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Abp.Dependency;
using Abp.Threading.Timers;
using Abp.Timing;
using FacadeCompanyName.FacadeProjectName.DomainService.Share;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FacadeCompanyName.FacadeProjectName.DomainService.BackgroundWorkers
{
public class ClearLoggerWorker: FacadeProjectNameBackgroundWorkerBase, ISingletonDependency
{
private readonly IFacadeConfiguration _facadeConfiguration;
public ClearLoggerWorker(AbpAsyncTimer timer, IFacadeConfiguration facadeConfiguration)
: base(timer)
{
timer.Period = 1000 * 60 * 60;
_facadeConfiguration = facadeConfiguration;
}
protected override async Task DoWorkAsync()
{
var rootPath = _facadeConfiguration.AppRootPath;
var logsPath = Path.Combine(rootPath, "App_Data", "Logs");
if (Directory.Exists(logsPath))
{
var lastMonth = Clock.Now.Subtract(TimeSpan.FromDays(90));
var path1 = Path.Combine(logsPath, lastMonth.ToString("yyyy"), lastMonth.ToString("MM"));
if (Directory.Exists(path1))
{
Directory.Delete(path1, true);
}
}
await Task.CompletedTask;
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>FacadeCompanyName.FacadeProjectName.DomainService</AssemblyName>
<PackageId>FacadeCompanyName.FacadeProjectName.DomainService</PackageId>
Expand All @@ -27,8 +27,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Facade.AutoMapper" Version="4.4.4" />
<PackageReference Include="Facade.Quartz" Version="4.4.4" />
<PackageReference Include="Facade.AutoMapper" Version="5.1.1" />
<PackageReference Include="Facade.Quartz" Version="5.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void PostInitialize()
if (Configuration.BackgroundJobs.IsJobExecutionEnabled)
{
//Worker DI.
//IocManager.Resolve<IBackgroundWorkerManager>().Add(IocManager.Resolve<DemoWorker>());
IocManager.Resolve<IBackgroundWorkerManager>().Add(IocManager.Resolve<ClearLoggerWorker>());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
public interface IAppFolders
{
/// <summary>
/// 临时文件下载文件夹 /downloads/temps
/// 临时文件下载文件夹 /temps//downloads/
/// </summary>
string TempFileDownloadFolder { get; }
/// <summary>
/// 临时文件上传文件夹 /uploads/temps
/// 临时文件上传文件夹 /temps/uploads/
/// </summary>
string TempFileUploadFolder { get; }

/// <summary>
/// 文件上传后保存的路径 /uploads/
/// 文件上传后保存的路径 /files/uploads/
/// </summary>
string FileUploadFolder { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public DemoSchedule(ILogger logger)
{
_logger = logger;
}
public override async Task Execute(IJobExecutionContext context)
public override async Task ExecuteJobAsync(IJobExecutionContext context)
{
_logger.Debug("DemoSchedule 执行了");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Abp.Quartz;
using Facade.Quartz;
using FacadeCompanyName.FacadeProjectName.DomainService.Share;

namespace FacadeCompanyName.FacadeProjectName.DomainService.Schedules
{
/// <summary>
/// 任务调度作业
/// </summary>
public abstract class ScheduleJobBase : JobBase
public abstract class ScheduleJobBase : FacadeScheduleJobBase
{
protected ScheduleJobBase() : base()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ public static class FacadeProjectNameServiceCollectionExtensions
/// <param name="appConfiguration"></param>
public static void ConfigureFacadeProjectNameService(this IServiceCollection services, IConfigurationRoot appConfiguration)
{
services.AddControllers().AddNewtonsoftJson(options =>
{
options.OutputFormatterMemoryBufferThreshold = 1024 * 1024;
options.InputFormatterMemoryBufferThreshold = 1024 * 1024;
});
services.AddControllers();

services.Configure<ApiBehaviorOptions>(options =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>FacadeCompanyName.FacadeProjectName.Web.Core</AssemblyName>
<PackageId>FacadeCompanyName.FacadeProjectName.Web.Core</PackageId>
Expand All @@ -14,12 +14,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Facade.AspNetCore" Version="4.4.4" />
<PackageReference Include="Facade.AspNetCore.Zero" Version="4.4.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.11" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Facade.AspNetCore" Version="5.1.1" />
<PackageReference Include="Facade.AspNetCore.Zero" Version="5.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />

<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public override void PreInitialize()
IocManager.RegisterIfNot<IFacadeConfiguration, FacadeConfiguration>(Abp.Dependency.DependencyLifeStyle.Singleton);
var facadeConfiguration = IocManager.Resolve<FacadeConfiguration>();
_appConfiguration.GetSection("FacadeConfiguration").Bind(facadeConfiguration);
facadeConfiguration.AppRootPath = _env.ContentRootPath;
facadeConfiguration.IsDevelopment = _env.EnvironmentName.Equals("Development", StringComparison.OrdinalIgnoreCase);
facadeConfiguration.AppEnvName = _env.EnvironmentName;

Configuration.Auditing.IsEnabled = false;
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
Expand All @@ -52,6 +55,7 @@ public override void PreInitialize()
Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(FacadeProjectNameConsts.ConnectionStringName);
Configuration.UnitOfWork.Timeout = new TimeSpan(0, 0, 30);

Configuration.Localization.Languages.Clear();
Configuration.Localization.Languages.Add(new LanguageInfo("zh", "中文简体", isDefault: true));
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));
ConfigureTokenAuth();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,19 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
var requestParams = context.ActionArguments;
#region 获取参数及token
var sb = new StringBuilder();
sb.Append(methodInfo.DeclaringType.FullName);
sb.Append(methodInfo.Name);
sb.Append(request.Method);
sb.Append(request.Host.ToString());
sb.Append(request.Path.ToString());
sb.Append(request.Protocol);

//_logger.Debug($"Debounce-{methodInfo.DeclaringType.FullName}-{methodInfo.Name}:" + Environment.NewLine + sb.ToString());
sb.Append(request.QueryString.ToString());
foreach (var kvp in requestParams)
{
sb.Append(kvp.Key).Append(kvp.Value.ToJsonString());
}
sb.Append(request.Host.ToString());
sb.Append(request.Path.ToString());
sb.Append(request.QueryString.ToString());
sb.Append(request.Protocol);
if (request.Headers.TryGetValue("Authorization", out var v))
{
var token = v.ToString();
Expand All @@ -104,9 +107,8 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
{
var obj = new ObjectResult(JsonSerializationHelper.DeserializeWithType(cacheValue));
context.Result = obj;
var d_type = context.ActionDescriptor.GetMethodInfo().DeclaringType;
var methodName = context.ActionDescriptor.GetMethodInfo().Name;
_logger.Debug($"Debounce-{d_type.FullName}-{methodName}" + cacheKey);
//context.Result = new ObjectResult(new JsonResponse(false, "数据正在处理中,请稍后再试..."));
_logger.Debug($"Debounce-{methodInfo.DeclaringType.FullName}-{methodInfo.Name}" + cacheKey);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\common.props" />

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>FacadeCompanyName.FacadeProjectName.Web.Host</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task SendNotificationsAsync(UserNotification[] userNotifications)
{
try
{
var onlineClients = _onlineClientManager.GetAllByUserId(userNotification);
var onlineClients = await _onlineClientManager.GetAllByUserIdAsync(userNotification);
foreach (var onlineClient in onlineClients)
{
var signalRClient = _hubContext.Clients.Client(onlineClient.ConnectionId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Facade.AspNetCore.TestBase" Version="4.4.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Facade.AspNetCore.TestBase" Version="5.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
using Castle.Facilities.Logging;
using Facade.NLogger;
using FacadeCompanyName.FacadeProjectName.Application;
using FacadeCompanyName.FacadeProjectName.DomainService.Share;
using FacadeCompanyName.FacadeProjectName.DomainService.Share;
using Microsoft.Extensions.Hosting;
using System;
using System.IO;

namespace FacadeCompanyName.FacadeProjectName.Tests
{
Expand All @@ -18,9 +21,9 @@ namespace FacadeCompanyName.FacadeProjectName.Tests
typeof(FacadeProjectNameApplicationModule)
)]
public class FacadeProjectNameTestModule : AbpModule
{
{
public FacadeProjectNameTestModule()
{
{
}

public override void PreInitialize()
Expand All @@ -31,15 +34,21 @@ public override void PreInitialize()
});
IocManager.Register<IFacadeConfiguration, FacadeConfiguration>(Abp.Dependency.DependencyLifeStyle.Singleton);
var facadeConfiguration = IocManager.Resolve<FacadeConfiguration>();
facadeConfiguration.AppName = "FacadeProjectName_Tests";

// Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
// Configuration.Modules.AbpAutoMapper().UseStaticMapper = false;

facadeConfiguration.AppName = "FacadeProjectName_Tests";
facadeConfiguration.AppRootPath = Directory.GetCurrentDirectory();
facadeConfiguration.IsDevelopment = true;
facadeConfiguration.AppEnvName = "Development";

// Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
// Configuration.Modules.AbpAutoMapper().UseStaticMapper = false;

Configuration.Auditing.IsEnabled = false;
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
Configuration.BackgroundJobs.IsJobExecutionEnabled = false;
Configuration.MultiTenancy.IsEnabled = FacadeProjectNameConsts.MultiTenancyEnabled;
Configuration.DefaultNameOrConnectionString = "Data Source=ORCL;Persist Security Info=True;User Id=ORCL;Password=ORCL;";

Configuration.Localization.Languages.Clear();
Configuration.Localization.Languages.Add(new LanguageInfo("zh", "ÖÐÎļòÌå", isDefault: true));
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English"));

Expand Down

0 comments on commit 2e7d5d8

Please sign in to comment.