Skip to content

Commit d89a3c4

Browse files
authored
Merge pull request #111 from aspnetboilerplate/upgrade-to-abp-10.0-and-dotnet-9
Upgrade to ABP 10.0 and .NET 9
2 parents 65a8652 + 54697fa commit d89a3c4

File tree

71 files changed

+2957
-1306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2957
-1306
lines changed
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<Version>1.0.0.0</Version>
54
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@@ -9,16 +8,13 @@
98
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
109
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1110
<RootNamespace>AbpCompanyName.AbpProjectName</RootNamespace>
12-
<TargetFramework>net8.0</TargetFramework>
11+
<TargetFramework>net9.0</TargetFramework>
1312
</PropertyGroup>
14-
1513
<ItemGroup>
1614
<ProjectReference Include="..\AbpCompanyName.AbpProjectName.Core\AbpCompanyName.AbpProjectName.Core.csproj" />
1715
</ItemGroup>
18-
1916
<ItemGroup>
20-
<PackageReference Include="Abp.EntityFrameworkCore" Version="9.4.1" />
21-
<PackageReference Include="Abp.AutoMapper" Version="9.4.1" />
17+
<PackageReference Include="Abp.EntityFrameworkCore" Version="10.0.0" />
18+
<PackageReference Include="Abp.AutoMapper" Version="10.0.0" />
2219
</ItemGroup>
23-
24-
</Project>
20+
</Project>
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using Abp.Application.Services;
22

3-
namespace AbpCompanyName.AbpProjectName
3+
namespace AbpCompanyName.AbpProjectName;
4+
5+
/// <summary>
6+
/// Derive your application services from this class.
7+
/// </summary>
8+
public abstract class AbpProjectNameAppServiceBase : ApplicationService
49
{
5-
/// <summary>
6-
/// Derive your application services from this class.
7-
/// </summary>
8-
public abstract class AbpProjectNameAppServiceBase : ApplicationService
10+
protected AbpProjectNameAppServiceBase()
911
{
10-
protected AbpProjectNameAppServiceBase()
11-
{
12-
LocalizationSourceName = AbpProjectNameConsts.LocalizationSourceName;
13-
}
12+
LocalizationSourceName = AbpProjectNameConsts.LocalizationSourceName;
1413
}
1514
}

src/AbpCompanyName.AbpProjectName.Application/AbpProjectNameApplicationModule.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
using Abp.Modules;
33
using Abp.Reflection.Extensions;
44

5-
namespace AbpCompanyName.AbpProjectName
5+
namespace AbpCompanyName.AbpProjectName;
6+
7+
[DependsOn(
8+
typeof(AbpProjectNameCoreModule),
9+
typeof(AbpAutoMapperModule))]
10+
public class AbpProjectNameApplicationModule : AbpModule
611
{
7-
[DependsOn(
8-
typeof(AbpProjectNameCoreModule),
9-
typeof(AbpAutoMapperModule))]
10-
public class AbpProjectNameApplicationModule : AbpModule
12+
public override void Initialize()
1113
{
12-
public override void Initialize()
13-
{
14-
IocManager.RegisterAssemblyByConvention(typeof(AbpProjectNameApplicationModule).GetAssembly());
15-
}
14+
IocManager.RegisterAssemblyByConvention(typeof(AbpProjectNameApplicationModule).GetAssembly());
1615
}
1716
}

src/AbpCompanyName.AbpProjectName.Application/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<Version>1.0.0.0</Version>
54
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@@ -9,17 +8,14 @@
98
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
109
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1110
<RootNamespace>AbpCompanyName.AbpProjectName</RootNamespace>
12-
<TargetFramework>net8.0</TargetFramework>
11+
<TargetFramework>net9.0</TargetFramework>
1312
</PropertyGroup>
14-
1513
<ItemGroup>
1614
<EmbeddedResource Include="Localization\SourceFiles\*.json" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
1715
</ItemGroup>
18-
1916
<ItemGroup>
20-
<PackageReference Include="Abp" Version="9.4.1" />
21-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
22-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
17+
<PackageReference Include="Abp" Version="10.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
19+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
2320
</ItemGroup>
24-
25-
</Project>
21+
</Project>
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
namespace AbpCompanyName.AbpProjectName
1+
namespace AbpCompanyName.AbpProjectName;
2+
3+
public class AbpProjectNameConsts
24
{
3-
public class AbpProjectNameConsts
4-
{
5-
public const string LocalizationSourceName = "AbpProjectName";
5+
public const string LocalizationSourceName = "AbpProjectName";
6+
7+
public const string ConnectionStringName = "Default";
68

7-
public const string ConnectionStringName = "Default";
8-
9-
/// <summary>
10-
/// Default pass phrase for SimpleStringCipher decrypt/encrypt operations
11-
/// </summary>
12-
public const string DefaultPassPhrase = "{{DEFAULT_PASS_PHRASE_HERE}}";
13-
}
9+
/// <summary>
10+
/// Default pass phrase for SimpleStringCipher decrypt/encrypt operations
11+
/// </summary>
12+
public const string DefaultPassPhrase = "{{DEFAULT_PASS_PHRASE_HERE}}";
1413
}

src/AbpCompanyName.AbpProjectName.Core/AbpProjectNameCoreModule.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22
using Abp.Reflection.Extensions;
33
using AbpCompanyName.AbpProjectName.Localization;
44

5-
namespace AbpCompanyName.AbpProjectName
5+
namespace AbpCompanyName.AbpProjectName;
6+
7+
public class AbpProjectNameCoreModule : AbpModule
68
{
7-
public class AbpProjectNameCoreModule : AbpModule
9+
public override void PreInitialize()
810
{
9-
public override void PreInitialize()
10-
{
11-
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
11+
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
12+
13+
AbpProjectNameLocalizationConfigurer.Configure(Configuration.Localization);
1214

13-
AbpProjectNameLocalizationConfigurer.Configure(Configuration.Localization);
14-
15-
Configuration.Settings.SettingEncryptionConfiguration.DefaultPassPhrase = AbpProjectNameConsts.DefaultPassPhrase;
16-
}
15+
Configuration.Settings.SettingEncryptionConfiguration.DefaultPassPhrase = AbpProjectNameConsts.DefaultPassPhrase;
16+
}
1717

18-
public override void Initialize()
19-
{
20-
IocManager.RegisterAssemblyByConvention(typeof(AbpProjectNameCoreModule).GetAssembly());
21-
}
18+
public override void Initialize()
19+
{
20+
IocManager.RegisterAssemblyByConvention(typeof(AbpProjectNameCoreModule).GetAssembly());
2221
}
2322
}
Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
1-
using System.Collections.Concurrent;
2-
using Abp.Extensions;
1+
using Abp.Extensions;
32
using Microsoft.Extensions.Configuration;
3+
using System.Collections.Concurrent;
44

5-
namespace AbpCompanyName.AbpProjectName.Configuration
5+
namespace AbpCompanyName.AbpProjectName.Configuration;
6+
7+
public static class AppConfigurations
68
{
7-
public static class AppConfigurations
9+
private static readonly ConcurrentDictionary<string, IConfigurationRoot> ConfigurationCache;
10+
11+
static AppConfigurations()
812
{
9-
private static readonly ConcurrentDictionary<string, IConfigurationRoot> ConfigurationCache;
13+
ConfigurationCache = new ConcurrentDictionary<string, IConfigurationRoot>();
14+
}
1015

11-
static AppConfigurations()
12-
{
13-
ConfigurationCache = new ConcurrentDictionary<string, IConfigurationRoot>();
14-
}
16+
public static IConfigurationRoot Get(string path, string environmentName = null)
17+
{
18+
var cacheKey = path + "#" + environmentName;
19+
return ConfigurationCache.GetOrAdd(
20+
cacheKey,
21+
_ => BuildConfiguration(path, environmentName)
22+
);
23+
}
1524

16-
public static IConfigurationRoot Get(string path, string environmentName = null)
17-
{
18-
var cacheKey = path + "#" + environmentName;
19-
return ConfigurationCache.GetOrAdd(
20-
cacheKey,
21-
_ => BuildConfiguration(path, environmentName)
22-
);
23-
}
25+
private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null)
26+
{
27+
var builder = new ConfigurationBuilder()
28+
.SetBasePath(path)
29+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
2430

25-
private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null)
31+
if (!environmentName.IsNullOrWhiteSpace())
2632
{
27-
var builder = new ConfigurationBuilder()
28-
.SetBasePath(path)
29-
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
30-
31-
if (!environmentName.IsNullOrWhiteSpace())
32-
{
33-
builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true);
34-
}
35-
36-
builder = builder.AddEnvironmentVariables();
37-
38-
return builder.Build();
33+
builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true);
3934
}
35+
36+
builder = builder.AddEnvironmentVariables();
37+
38+
return builder.Build();
4039
}
4140
}
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
using System.Reflection;
2-
using Abp.Configuration.Startup;
1+
using Abp.Configuration.Startup;
32
using Abp.Localization;
43
using Abp.Localization.Dictionaries;
54
using Abp.Localization.Dictionaries.Json;
65
using Abp.Reflection.Extensions;
76

8-
namespace AbpCompanyName.AbpProjectName.Localization
7+
namespace AbpCompanyName.AbpProjectName.Localization;
8+
9+
public static class AbpProjectNameLocalizationConfigurer
910
{
10-
public static class AbpProjectNameLocalizationConfigurer
11+
public static void Configure(ILocalizationConfiguration localizationConfiguration)
1112
{
12-
public static void Configure(ILocalizationConfiguration localizationConfiguration)
13-
{
14-
localizationConfiguration.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flags england", isDefault: true));
15-
localizationConfiguration.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flags tr"));
13+
localizationConfiguration.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flags england", isDefault: true));
14+
localizationConfiguration.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flags tr"));
1615

17-
localizationConfiguration.Sources.Add(
18-
new DictionaryBasedLocalizationSource(AbpProjectNameConsts.LocalizationSourceName,
19-
new JsonEmbeddedFileLocalizationDictionaryProvider(
20-
typeof(AbpProjectNameLocalizationConfigurer).GetAssembly(),
21-
"AbpCompanyName.AbpProjectName.Localization.SourceFiles"
22-
)
16+
localizationConfiguration.Sources.Add(
17+
new DictionaryBasedLocalizationSource(AbpProjectNameConsts.LocalizationSourceName,
18+
new JsonEmbeddedFileLocalizationDictionaryProvider(
19+
typeof(AbpProjectNameLocalizationConfigurer).GetAssembly(),
20+
"AbpCompanyName.AbpProjectName.Localization.SourceFiles"
2321
)
24-
);
25-
}
22+
)
23+
);
2624
}
2725
}

src/AbpCompanyName.AbpProjectName.Core/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

src/AbpCompanyName.AbpProjectName.Core/Web/WebContentFolderHelper.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,38 @@
22
using System.IO;
33
using System.Linq;
44

5-
namespace AbpCompanyName.AbpProjectName.Web
5+
namespace AbpCompanyName.AbpProjectName.Web;
6+
7+
/// <summary>
8+
/// This class is used to find root path of the web project in;
9+
/// unit tests (to find views) and entity framework core command line commands (to find conn string).
10+
/// </summary>
11+
public static class WebContentDirectoryFinder
612
{
7-
/// <summary>
8-
/// This class is used to find root path of the web project in;
9-
/// unit tests (to find views) and entity framework core command line commands (to find conn string).
10-
/// </summary>
11-
public static class WebContentDirectoryFinder
13+
public static string CalculateContentRootFolder()
1214
{
13-
public static string CalculateContentRootFolder()
15+
var coreAssemblyDirectoryPath = Path.GetDirectoryName(AppContext.BaseDirectory);
16+
if (coreAssemblyDirectoryPath == null)
1417
{
15-
var coreAssemblyDirectoryPath = Path.GetDirectoryName(AppContext.BaseDirectory);
16-
if (coreAssemblyDirectoryPath == null)
17-
{
18-
throw new Exception("Could not find location of AbpCompanyName.AbpProjectName.Core assembly!");
19-
}
18+
throw new Exception("Could not find location of AbpCompanyName.AbpProjectName.Core assembly!");
19+
}
2020

21-
var directoryInfo = new DirectoryInfo(coreAssemblyDirectoryPath);
22-
while (!DirectoryContains(directoryInfo.FullName, "AbpCompanyName.AbpProjectName.sln"))
21+
var directoryInfo = new DirectoryInfo(coreAssemblyDirectoryPath);
22+
while (!DirectoryContains(directoryInfo.FullName, "AbpCompanyName.AbpProjectName.sln"))
23+
{
24+
if (directoryInfo.Parent == null)
2325
{
24-
if (directoryInfo.Parent == null)
25-
{
26-
throw new Exception("Could not find content root folder!");
27-
}
28-
29-
directoryInfo = directoryInfo.Parent;
26+
throw new Exception("Could not find content root folder!");
3027
}
3128

32-
return Path.Combine(directoryInfo.FullName, $"src{Path.DirectorySeparatorChar}AbpCompanyName.AbpProjectName.Web");
29+
directoryInfo = directoryInfo.Parent;
3330
}
3431

35-
private static bool DirectoryContains(string directory, string fileName)
36-
{
37-
return Directory.GetFiles(directory).Any(filePath => string.Equals(Path.GetFileName(filePath), fileName));
38-
}
32+
return Path.Combine(directoryInfo.FullName, $"src{Path.DirectorySeparatorChar}AbpCompanyName.AbpProjectName.Web");
33+
}
34+
35+
private static bool DirectoryContains(string directory, string fileName)
36+
{
37+
return Directory.GetFiles(directory).Any(filePath => string.Equals(Path.GetFileName(filePath), fileName));
3938
}
4039
}

0 commit comments

Comments
 (0)