diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index ee66fbcf2c..cd48c0448a 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -27,12 +27,12 @@ jobs: with: fetch-depth: 0 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: 'npm/ng-packs/node_modules' key: ${{ runner.os }}-${{ hashFiles('npm/ng-packs/yarn.lock') }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: 'templates/app/angular/node_modules' key: ${{ runner.os }}-${{ hashFiles('templates/app/angular/yarn.lock') }} diff --git a/Directory.Packages.props b/Directory.Packages.props index 0a243a3067..e76cb94b80 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -119,7 +119,7 @@ - + diff --git a/docs/en/cli/index.md b/docs/en/cli/index.md index 44cab0caa4..02521e72cb 100644 --- a/docs/en/cli/index.md +++ b/docs/en/cli/index.md @@ -342,6 +342,7 @@ Note that this command can upgrade your solution from a previous version, and al * `--solution-name` or `-sn`: Specify the solution name. Search `*.sln` files in the directory by default. * `--check-all`: Check the new version of each package separately. Default is `false`. * `--version` or `-v`: Specifies the version to use for update. If not specified, latest version is used. +* * `--leptonx-version` or `-lv`: Specifies the LeptonX version to use for update. If not specified, latest version or the version that is compatible with `--version` argument is used. ### clean diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs index 1bcc1c1f45..2027ac1e69 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Microsoft/Extensions/DependencyInjection/AbpBlazorWebAppServiceCollectionExtensions.cs @@ -1,3 +1,4 @@ +using System; using JetBrains.Annotations; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -19,10 +20,14 @@ public static class AbpBlazorWebAppServiceCollectionExtensions return services; } + [Obsolete("Use AddBlazorWebAppServices instead. See https://github.com/abpframework/abp/issues/22622")] public static IServiceCollection AddBlazorWebAppTieredServices([NotNull] this IServiceCollection services) { Check.NotNull(services, nameof(services)); + // Compatibility with old template code + services.AddTransient(); + services.AddScoped(); services.Replace(ServiceDescriptor.Singleton()); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs index b35960f071..d3f05820b0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProvider.cs @@ -1,5 +1,7 @@ +using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Components.WebAssembly.WebApp; @@ -8,21 +10,26 @@ public class RemoteAuthenticationStateProvider : AuthenticationStateProvider { protected ICurrentPrincipalAccessor CurrentPrincipalAccessor { get; } protected WebAssemblyCachedApplicationConfigurationClient WebAssemblyCachedApplicationConfigurationClient { get; } + protected IServiceProvider ServiceProvider { get; } public RemoteAuthenticationStateProvider( ICurrentPrincipalAccessor currentPrincipalAccessor, - WebAssemblyCachedApplicationConfigurationClient webAssemblyCachedApplicationConfigurationClient) + WebAssemblyCachedApplicationConfigurationClient webAssemblyCachedApplicationConfigurationClient, + IServiceProvider serviceProvider) { CurrentPrincipalAccessor = currentPrincipalAccessor; WebAssemblyCachedApplicationConfigurationClient = webAssemblyCachedApplicationConfigurationClient; + ServiceProvider = serviceProvider; } public async override Task GetAuthenticationStateAsync() { - if (CurrentPrincipalAccessor.Principal.Identity == null || - !CurrentPrincipalAccessor.Principal.Identity.IsAuthenticated) + if (ServiceProvider.GetService() != null) { - await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + if (CurrentPrincipalAccessor.Principal.Identity == null || !CurrentPrincipalAccessor.Principal.Identity.IsAuthenticated) + { + await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); + } } return new AuthenticationState(CurrentPrincipalAccessor.Principal); diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs new file mode 100644 index 0000000000..780f96c631 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/RemoteAuthenticationStateProviderCompatible.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.AspNetCore.Components.WebAssembly.WebApp; + +/// +/// This class is used to indicate that the AddBlazorWebAppTieredServices method has been called for compatibility with the old template code +/// +internal sealed class AddBlazorWebAppTieredServicesHasBeenCalled +{ +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css index 08bdc5d283..de679b468a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css @@ -10,3 +10,8 @@ .dataTable tbody tr td div.dropdown ul.dropdown-menu li { cursor: pointer; } + +.abp-action-button ui.dropdown-menu[data-popper-reference-hidden]{ + visibility: hidden; + pointer-events: none; +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css index ffc3d272a3..cd5ab5591b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.min.css @@ -1 +1 @@ -.dataTable{width:100% !important;border-spacing:0 !important;}.table td,.table th{padding:8px 10px;}.dataTable tbody tr td button{cursor:pointer;}.dataTable tbody tr td div.dropdown ul.dropdown-menu li{cursor:pointer;} +.dataTable{width:100%!important;border-spacing:0!important}.table td,.table th{padding:8px 10px}.dataTable tbody tr td button{cursor:pointer}.dataTable tbody tr td div.dropdown ul.dropdown-menu li{cursor:pointer}.abp-action-button ui.dropdown-menu[data-popper-reference-hidden]{visibility:hidden;pointer-events:none} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss index 0ca0771faf..d2498b3cc7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.scss @@ -27,3 +27,10 @@ } } } + +.abp-action-button { + ui.dropdown-menu[data-popper-reference-hidden] { + visibility: hidden; + pointer-events: none; + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index d042bb6026..b9142b5aed 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -115,7 +115,7 @@ public static class AbpApplicationBuilderExtensions return app.UseMiddleware(); } - [Obsolete("Replace with AbpClaimsTransformation")] + [Obsolete("Use the TransformAbpClaims extension method from IServiceCollection instead.")] public static IApplicationBuilder UseAbpClaimsMap(this IApplicationBuilder app) { return app.UseMiddleware(); diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs index 2104edab0a..70fad0d19e 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/Claims/AbpClaimsMapMiddleware.cs @@ -11,7 +11,7 @@ using Volo.Abp.Security.Claims; namespace Volo.Abp.AspNetCore.Security.Claims; -[Obsolete("Replace with AbpClaimsTransformation")] +[Obsolete("Use the TransformAbpClaims extension method from IServiceCollection instead.")] public class AbpClaimsMapMiddleware : AbpMiddlewareBase, ITransientDependency { public async override Task InvokeAsync(HttpContext context, RequestDelegate next) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs index 8d77675c3c..d968ae6b12 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs @@ -2,24 +2,24 @@ public static class CliConsts { - public const string Command = "AbpCliCommand"; + public static string Command = "AbpCliCommand"; - public const string BranchPrefix = "branch@"; + public static string BranchPrefix = "branch@"; - public const string DocsLink = "https://abp.io/docs"; + public static string DocsLink = "https://abp.io/docs"; - public const string HttpClientName = "AbpHttpClient"; + public static string HttpClientName = "AbpHttpClient"; - public const string GithubHttpClientName = "GithubHttpClient"; + public static string GithubHttpClientName = "GithubHttpClient"; - public const string LogoutUrl = CliUrls.WwwAbpIo + "api/license/logout"; + public static string LogoutUrl = CliUrls.WwwAbpIo + "api/license/logout"; - public const string LicenseCodePlaceHolder = @""; + public static string LicenseCodePlaceHolder = @""; - public const string AppSettingsJsonFileName = "appsettings.json"; + public static string AppSettingsJsonFileName = "appsettings.json"; + + public static string AppSettingsSecretJsonFileName = "appsettings.secrets.json"; - public const string AppSettingsSecretJsonFileName = "appsettings.secrets.json"; - public static class MemoryKeys { public const string LatestCliVersionCheckDate = "LatestCliVersionCheckDate"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs index 35ae34b895..28cf42c2a2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliUrls.cs @@ -5,19 +5,18 @@ namespace Volo.Abp.Cli; public static class CliUrls { - public const string WwwAbpIo = WwwAbpIoProduction; - public const string AccountAbpIo = AccountAbpIoProduction; - public const string NuGetRootPath = NuGetRootPathProduction; - public const string LatestVersionCheckFullPath = - "https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json"; - - public const string WwwAbpIoProduction = "https://abp.io/"; - public const string AccountAbpIoProduction = "https://account.abp.io/"; - public const string NuGetRootPathProduction = "https://nuget.abp.io/"; - - public const string WwwAbpIoDevelopment = "https://localhost:44328/"; - public const string AccountAbpIoDevelopment = "https://localhost:44333/"; - public const string NuGetRootPathDevelopment = "https://localhost:44373/"; + public static string WwwAbpIo = WwwAbpIoProduction; + public static string AccountAbpIo = AccountAbpIoProduction; + public static string NuGetRootPath = NuGetRootPathProduction; + public static string LatestVersionCheckFullPath = "https://raw.githubusercontent.com/abpframework/abp/dev/latest-versions.json"; + + public static string WwwAbpIoProduction = "https://abp.io/"; + public static string AccountAbpIoProduction = "https://account.abp.io/"; + public static string NuGetRootPathProduction = "https://nuget.abp.io/"; + + public static string WwwAbpIoDevelopment = "https://localhost:44328/"; + public static string AccountAbpIoDevelopment = "https://localhost:44333/"; + public static string NuGetRootPathDevelopment = "https://localhost:44373/"; public static string GetNuGetServiceIndexUrl(string apiKey) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 9fb647806b..cc13e9d187 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -68,7 +68,7 @@ public class HelpCommand : IConsoleCommand, ITransientDependency sb.AppendLine("Command List:"); sb.AppendLine(""); - foreach (var command in AbpCliOptions.Commands.ToArray().Where(NotHiddenFromCommandList)) + foreach (var command in AbpCliOptions.Commands.ToArray().Where(NotHiddenFromCommandList).OrderBy(x => x.Key)) { var method = command.Value.GetMethod("GetShortDescription", BindingFlags.Static | BindingFlags.Public); if (method == null) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index ad0992af4e..8c6df3b0b9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -38,24 +38,25 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency var directory = commandLineArgs.Options.GetOrNull(Options.SolutionPath.Short, Options.SolutionPath.Long) ?? Directory.GetCurrentDirectory(); var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + var leptonXVersion = commandLineArgs.Options.GetOrNull(Options.LeptonXVersion.Short, Options.LeptonXVersion.Long); if (updateNuget || !updateNpm) { - await UpdateNugetPackages(commandLineArgs, directory, version); + await UpdateNugetPackages(commandLineArgs, directory, version, leptonXVersion); } if (updateNpm || !updateNuget) { - await UpdateNpmPackages(directory, version); + await UpdateNpmPackages(directory, version, leptonXVersion); } } - private async Task UpdateNpmPackages(string directory, string version) + private async Task UpdateNpmPackages(string directory, string version, string leptonXVersion) { - await _npmPackagesUpdater.Update(directory, version: version); + await _npmPackagesUpdater.Update(directory, version: version, leptonXVersion: leptonXVersion); } - private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory, string version) + private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory, string version, string leptonXVersion) { var solutions = new List(); var givenSolution = commandLineArgs.Options.GetOrNull(Options.SolutionName.Short, Options.SolutionName.Long); @@ -77,7 +78,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency { var solutionName = Path.GetFileName(solution).RemovePostFix(".sln"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, checkAll: checkAll, version: version, leptonXVersion: leptonXVersion); Logger.LogInformation("Volo packages are updated in {SolutionName} solution", solutionName); } @@ -90,7 +91,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency { var projectName = Path.GetFileName(project).RemovePostFix(".csproj"); - await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, checkAll: checkAll, version: version); + await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, checkAll: checkAll, version: version, leptonXVersion: leptonXVersion); Logger.LogInformation("Volo packages are updated in {ProjectName} project", projectName); return; @@ -120,6 +121,7 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency sb.AppendLine("-sn|--solution-name (Specify the solution name)"); sb.AppendLine("--check-all (Check the new version of each package separately)"); sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine("-lv|--leptonx-version (default: latest LeptonX version)"); sb.AppendLine(""); sb.AppendLine("Some examples:"); sb.AppendLine(""); @@ -167,5 +169,11 @@ public class UpdateCommand : IConsoleCommand, ITransientDependency public const string Short = "v"; public const string Long = "version"; } + + public static class LeptonXVersion + { + public const string Short = "lv"; + public const string Long = "leptonx-version"; + } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 2c88f1e8c5..d543b43d65 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -50,7 +50,7 @@ public class NpmPackagesUpdater : ITransientDependency public async Task Update(string rootDirectory, bool includePreviews = false, bool includeReleaseCandidates = false, - bool switchToStable = false, string version = null, bool includePreRc = false) + bool switchToStable = false, string version = null, string leptonXVersion = null, bool includePreRc = false) { var fileList = _packageJsonFileFinder.Find(rootDirectory); @@ -80,6 +80,7 @@ public class NpmPackagesUpdater : ITransientDependency var updated = await UpdatePackagesInFile(file, includePreviews, includeReleaseCandidates, switchToStable, version, + leptonXVersion, includePreRc); packagesUpdated.TryAdd(file, updated); @@ -162,6 +163,7 @@ public class NpmPackagesUpdater : ITransientDependency bool includeReleaseCandidates = false, bool switchToStable = false, string specifiedVersion = null, + string specifiedLeptonXVersion = null, bool includePreRc = false) { var packagesUpdated = false; @@ -177,7 +179,7 @@ public class NpmPackagesUpdater : ITransientDependency foreach (var abpPackage in abpPackages) { var updated = await TryUpdatingPackage(filePath, abpPackage, includePreviews, includeReleaseCandidates, - switchToStable, specifiedVersion, includePreRc); + switchToStable, specifiedVersion, specifiedLeptonXVersion, includePreRc); if (updated) { @@ -188,7 +190,7 @@ public class NpmPackagesUpdater : ITransientDependency var updatedContent = packageJson.ToString(Formatting.Indented); File.WriteAllText(filePath, updatedContent); - + return packagesUpdated; } @@ -199,6 +201,7 @@ public class NpmPackagesUpdater : ITransientDependency bool includeReleaseCandidates = false, bool switchToStable = false, string specifiedVersion = null, + string specifiedLeptonXVersion = null, bool includePreRc = false) { var currentVersion = (string)package.Value; @@ -207,18 +210,36 @@ public class NpmPackagesUpdater : ITransientDependency if (!specifiedVersion.IsNullOrWhiteSpace()) { - if (!SpecifiedVersionExists(specifiedVersion, package)) + if (package.Name.IndexOf("leptonx", StringComparison.InvariantCultureIgnoreCase) > 0 && !specifiedLeptonXVersion.IsNullOrWhiteSpace()) { - return false; - } + if (!SpecifiedVersionExists(specifiedLeptonXVersion, package)) + { + return false; + } - if (SemanticVersion.Parse(specifiedVersion) <= - SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) - { - return false; + if (SemanticVersion.Parse(specifiedLeptonXVersion) <= + SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) + { + return false; + } + + version = specifiedLeptonXVersion.EnsureStartsWith('^'); } + else + { + if (!SpecifiedVersionExists(specifiedVersion, package)) + { + return false; + } - version = specifiedVersion.EnsureStartsWith('^'); + if (SemanticVersion.Parse(specifiedVersion) <= + SemanticVersion.Parse(currentVersion.RemovePreFix("~", "^"))) + { + return false; + } + + version = specifiedVersion.EnsureStartsWith('^'); + } } else { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 4ece393913..924d6041b1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -27,7 +27,14 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency Logger = NullLogger.Instance; } - public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false, string version = null) + public async Task UpdateSolutionAsync( + string solutionPath, + bool includePreviews = false, + bool includeReleaseCandidates = false, + bool switchToStable = false, + bool checkAll = false, + string version = null, + string leptonXVersion = null) { var projectPaths = ProjectFinder.GetProjectFiles(solutionPath); @@ -58,6 +65,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency latestReleaseCandidateVersionInfo.Version, latestVersionFromMyGet, version, + leptonXVersion, latestStableVersions: latestStableVersions); fs.Seek(0, SeekOrigin.Begin); @@ -75,7 +83,14 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency } } - public async Task UpdateProjectAsync(string projectPath, bool includeNightlyPreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false, string version = null) + public async Task UpdateProjectAsync( + string projectPath, + bool includeNightlyPreviews = false, + bool includeReleaseCandidates = false, + bool switchToStable = false, + bool checkAll = false, + string version = null, + string leptonXVersion = null) { if (checkAll && version.IsNullOrWhiteSpace()) { @@ -102,6 +117,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency latestReleaseCandidateVersionInfo.Version, latestVersionFromMyGet, version, + leptonXVersion, latestStableVersions: latestStableVersions); fs.Seek(0, SeekOrigin.Begin); @@ -166,6 +182,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency SemanticVersion latestNugetReleaseCandidateVersion = null, string latestMyGetVersion = null, string specifiedVersion = null, + string specifiedLeptonXVersion = null, List latestStableVersions = null) { string packageId = null; @@ -222,21 +239,35 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency var leptonXPackageVersion = latestStableVersions? .FirstOrDefault(v => v.Version.Equals(specifiedVersion, StringComparison.InvariantCultureIgnoreCase))?.LeptonX?.Version; - if ((isLeptonXPackage && string.IsNullOrWhiteSpace(leptonXPackageVersion)) || isStudioPackage) + if ((isLeptonXPackage && string.IsNullOrWhiteSpace(leptonXPackageVersion) && specifiedLeptonXVersion.IsNullOrWhiteSpace()) || isStudioPackage) { Logger.LogWarning("Package: {PackageId} could not be updated. Please manually update the package version yourself to prevent version mismatches!", packageId); continue; } - var isLeptonXPackageWithVersion = isLeptonXPackage && !string.IsNullOrWhiteSpace(leptonXPackageVersion); - - if (isLeptonXPackageWithVersion || await SpecifiedVersionExists(specifiedVersion, packageId)) + if (isLeptonXPackage) { - TryUpdatingPackage(isLeptonXPackageWithVersion ? leptonXPackageVersion : specifiedVersion); + var isLeptonXPackageWithVersion = isLeptonXPackage && !string.IsNullOrWhiteSpace(leptonXPackageVersion); + + if (isLeptonXPackageWithVersion || await SpecifiedVersionExists(specifiedLeptonXVersion, packageId)) + { + TryUpdatingPackage(specifiedLeptonXVersion ?? leptonXPackageVersion); + } + else + { + Logger.LogWarning($"Package \"{packageId}\" specified version v{specifiedLeptonXVersion} does not exist!"); + } } else { - Logger.LogWarning("Package \"{PackageId}\" specified version v{SpecifiedVersion} does not exist!", packageId, specifiedVersion); + if (await SpecifiedVersionExists(specifiedVersion, packageId)) + { + TryUpdatingPackage(specifiedVersion); + } + else + { + Logger.LogWarning($"Package \"{packageId}\" specified version v{specifiedVersion} does not exist!"); + } } void TryUpdatingPackage(string versionToUpdate) diff --git a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs index 6f433ce918..7f72f0de71 100644 --- a/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs +++ b/framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializer.cs @@ -40,21 +40,10 @@ public class AbpSystemTextJsonSerializer : IJsonSerializer, ITransientDependency camelCase, indented, Options.JsonSerializerOptions - }, _ => + }, _ => new JsonSerializerOptions(Options.JsonSerializerOptions) { - var settings = new JsonSerializerOptions(Options.JsonSerializerOptions); - - if (camelCase) - { - settings.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; - } - - if (indented) - { - settings.WriteIndented = true; - } - - return settings; + PropertyNamingPolicy = camelCase ? JsonNamingPolicy.CamelCase : null, + WriteIndented = indented }); } } diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpGuidCustomBsonTypeMapper.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpGuidCustomBsonTypeMapper.cs new file mode 100644 index 0000000000..4cfacc39fd --- /dev/null +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpGuidCustomBsonTypeMapper.cs @@ -0,0 +1,13 @@ +using System; +using MongoDB.Bson; + +namespace Volo.Abp.MongoDB; + +public class AbpGuidCustomBsonTypeMapper : ICustomBsonTypeMapper +{ + public bool TryMapToBsonValue(object value, out BsonValue bsonValue) + { + bsonValue = new BsonBinaryData((Guid)value, GuidRepresentation.Standard); + return true; + } +} diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs index 8e8ad345fc..195491d989 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/AbpMongoDbModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using System; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using MongoDB.Bson; using MongoDB.Bson.Serialization; @@ -16,6 +17,12 @@ namespace Volo.Abp.MongoDB; [DependsOn(typeof(AbpDddDomainModule))] public class AbpMongoDbModule : AbpModule { + static AbpMongoDbModule() + { + BsonSerializer.TryRegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); + BsonTypeMapper.RegisterCustomTypeMapper(typeof(Guid), new AbpGuidCustomBsonTypeMapper()); + } + public override void PreConfigureServices(ServiceConfigurationContext context) { context.Services.AddConventionalRegistrar(new AbpMongoDbConventionalRegistrar()); @@ -23,8 +30,6 @@ public class AbpMongoDbModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { - BsonSerializer.TryRegisterSerializer(new GuidSerializer(GuidRepresentation.Standard)); - context.Services.TryAddTransient( typeof(IMongoDbContextProvider<>), typeof(UnitOfWorkMongoDbContextProvider<>) diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestBase.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestBase.cs index ebae706aca..e442ce48ad 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestBase.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpJsonTestBase.cs @@ -1,4 +1,9 @@ -using Volo.Abp.Testing; +using System; +using System.Collections.Concurrent; +using System.Reflection; +using Newtonsoft.Json; +using Volo.Abp.Json.Newtonsoft; +using Volo.Abp.Testing; namespace Volo.Abp.Json; @@ -12,6 +17,16 @@ public abstract class AbpJsonSystemTextJsonTestBase : AbpIntegratedTest { + protected AbpJsonNewtonsoftJsonTestBase() + { + var cache = typeof(AbpNewtonsoftJsonSerializer).GetField("JsonSerializerOptionsCache", BindingFlags.NonPublic | BindingFlags.Static); + if (cache != null) + { + var cacheValue = cache.GetValue(null)?.As>(); + cacheValue?.Clear(); + } + } + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) { options.UseAutofac(); diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs new file mode 100644 index 0000000000..9dc0c0afd3 --- /dev/null +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpNewtonsoftSerializerProviderTests.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Shouldly; +using Xunit; + +namespace Volo.Abp.Json; + +[Collection("AbpJsonNewtonsoftJsonTest")] +public class AbpNewtonsoftSerializerProviderTests : AbpJsonNewtonsoftJsonTestBase +{ + protected IJsonSerializer JsonSerializer; + + public AbpNewtonsoftSerializerProviderTests() + { + JsonSerializer = GetRequiredService(); + } + + public class File + { + public string FileName { get; set; } + + public Dictionary ExtraProperties { get; set; } + } + + [Fact] + public void Serialize_Deserialize_Test() + { + var defaultIndent = " "; // Default indent is 2 spaces + var newLine = Environment.NewLine; + var file = new File() + { + FileName = "abp", + ExtraProperties = new Dictionary() + { + { "One", 1 }, + { "Two", 2 } + } + }; + + var json = JsonSerializer.Serialize(file, camelCase: true); + json.ShouldBe("{\"fileName\":\"abp\",\"extraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: true, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"fileName\": \"abp\",{newLine}{defaultIndent}\"extraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + + json = JsonSerializer.Serialize(file, camelCase: false); + json.ShouldBe("{\"FileName\":\"abp\",\"ExtraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: false, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"FileName\": \"abp\",{newLine}{defaultIndent}\"ExtraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + } +} diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs index e32df85d7f..49b321d46d 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpSystemTextJsonSerializerProvider_Tests.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Text.Json; using Microsoft.Extensions.DependencyInjection; using Shouldly; using Volo.Abp.Data; @@ -11,11 +13,11 @@ namespace Volo.Abp.Json; public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSystemTextJsonTestBase { - protected AbpSystemTextJsonSerializer JsonSerializer; + protected IJsonSerializer JsonSerializer; public AbpSystemTextJsonSerializerProviderTestBase() { - JsonSerializer = GetRequiredService(); + JsonSerializer = GetRequiredService(); } public class TestExtensibleObjectClass : ExtensibleObject @@ -23,6 +25,13 @@ public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSyste public string Name { get; set; } } + public class File + { + public string FileName { get; set; } + + public Dictionary ExtraProperties { get; set; } + } + public class FileWithBoolean { public string Name { get; set; } @@ -74,6 +83,34 @@ public abstract class AbpSystemTextJsonSerializerProviderTestBase : AbpJsonSyste public class AbpSystemTextJsonSerializerProviderTests : AbpSystemTextJsonSerializerProviderTestBase { + [Fact] + public void Serialize_Deserialize_Test() + { + var defaultIndent = " "; // Default indent is 2 spaces + var newLine = Environment.NewLine; + var file = new File() + { + FileName = "abp", + ExtraProperties = new Dictionary() + { + { "One", 1 }, + { "Two", 2 } + } + }; + + var json = JsonSerializer.Serialize(file, camelCase: true); + json.ShouldBe("{\"fileName\":\"abp\",\"extraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: true, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"fileName\": \"abp\",{newLine}{defaultIndent}\"extraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + + json = JsonSerializer.Serialize(file, camelCase: false); + json.ShouldBe("{\"FileName\":\"abp\",\"ExtraProperties\":{\"One\":1,\"Two\":2}}"); + + json = JsonSerializer.Serialize(file, camelCase: false, indented: true); + json.ShouldBe($"{{{newLine}{defaultIndent}\"FileName\": \"abp\",{newLine}{defaultIndent}\"ExtraProperties\": {{{newLine}{defaultIndent}{defaultIndent}\"One\": 1,{newLine}{defaultIndent}{defaultIndent}\"Two\": 2{newLine}{defaultIndent}}}{newLine}}}"); + } + [Fact] public void Serialize_Deserialize_With_Boolean() { @@ -223,6 +260,8 @@ public class AbpSystemTextJsonSerializerProviderDateTimeFormatTests : AbpSystemT options.InputDateTimeFormats.Add("yyyy*MM*dd"); options.OutputDateTimeFormat = "yyyy*MM*dd HH*mm*ss"; }); + + base.AfterAddApplication(services); } [Fact] @@ -289,6 +328,8 @@ public class AbpSystemTextJsonSerializerProviderDatetimeKindUtcTests : AbpSystem { Kind = DateTimeKind.Utc; services.Configure(x => x.Kind = Kind); + + base.AfterAddApplication(services); } } @@ -298,6 +339,8 @@ public class AbpSystemTextJsonSerializerProviderDatetimeKindLocalTests : AbpSyst { Kind = DateTimeKind.Local; services.Configure(x => x.Kind = Kind); + + base.AfterAddApplication(services); } } diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs index cf6356477d..189a82cae0 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/InputAndOutputDateTimeFormat_Tests.cs @@ -31,6 +31,8 @@ public class InputAndOutputDateTimeFormatSystemTextJsonTests : AbpJsonSystemText { options.Kind = DateTimeKind.Utc; }); + + base.AfterAddApplication(services); } [Fact] @@ -59,6 +61,7 @@ public class InputAndOutputDateTimeFormatSystemTextJsonTests : AbpJsonSystemText } } +[Collection("AbpJsonNewtonsoftJsonTest")] public class InputAndOutputDateTimeFormatNewtonsoftTests : AbpJsonNewtonsoftJsonTestBase { private readonly IJsonSerializer _jsonSerializer; @@ -83,6 +86,8 @@ public class InputAndOutputDateTimeFormatNewtonsoftTests : AbpJsonNewtonsoftJson { options.Kind = DateTimeKind.Utc; }); + + base.AfterAddApplication(services); } [Fact] diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index e2ad9088cb..3df8699f6d 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using MongoDB.Driver.Linq; using Shouldly; +using Volo.Abp.Data; using Volo.Abp.Domain.Repositories; using Volo.Abp.TestApp; using Volo.Abp.TestApp.Domain; @@ -52,10 +53,12 @@ public class Repository_Basic_Tests : Repository_Basic_Tests p.PersonId == person.Id && p.Number == "1234567890").ShouldBeTrue(); + person.GetProperty("test-guid-property").ShouldBe(person.Id); + person.GetProperty("test-nullable-guid-property").ShouldBe(person.Id); } - + [Fact] public async Task Filter_Case_Insensitive() { (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "ISTANBUL").ShouldBeNull(); (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "istanbul").ShouldBeNull(); (await CityRepository.GetQueryableAsync()).FirstOrDefault(c => c.Name == "Istanbul").ShouldNotBeNull(); - + (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "douglas").ShouldNotBeNull(); (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "DOUGLAS").ShouldNotBeNull(); (await PersonRepository.GetQueryableAsync()).FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull(); diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs index ad3a39c746..ac9601cda3 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs @@ -1,31 +1,42 @@ using System; -using System.IO; -using Microsoft.AspNetCore.Hosting; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; -using Serilog.Events; namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo; public class Program { - public static int Main(string[] args) + public async static Task Main(string[] args) { Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() //TODO: Should be configurable! - .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .MinimumLevel.Debug() .Enrich.FromLogContext() - .WriteTo.File("Logs/logs.txt") + .WriteTo.Async(c => c.Console()) .CreateLogger(); try { Log.Information("Starting web host."); - CreateHostBuilder(args).Build().Run(); + var builder = WebApplication.CreateBuilder(args); + builder.Host.AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); return 0; } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } @@ -34,14 +45,4 @@ public class Program Log.CloseAndFlush(); } } - - - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }) - .UseAutofac() - .UseSerilog(); } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json index 07a310a660..7ad9d24119 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Properties/launchSettings.json @@ -1,27 +1,12 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:51339", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "Volo.AbpIo.Commercial.Web": { + "Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "http://localhost:5000", + "applicationUrl": "https://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } -} \ No newline at end of file +} diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs deleted file mode 100644 index 838cf43402..0000000000 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo; - -public class Startup -{ - public void ConfigureServices(IServiceCollection services) - { - services.AddApplication(); - } - - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) - { - app.InitializeApplication(); - } -} diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj index f8202b97ec..9aa8142fda 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj @@ -10,7 +10,7 @@ - + @@ -23,5 +23,5 @@ Always - + diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs index 4ebeb18498..c887825b2b 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs @@ -55,8 +55,8 @@ public class AbpAspNetCoreMvcUiThemeBasicDemoModule : AbpModule app.UseDeveloperExceptionPage(); } - app.MapAbpStaticAssets(); app.UseRouting(); + app.MapAbpStaticAssets(); app.UseConfiguredEndpoints(); } } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs index a27f797715..d2ca3053b8 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Program.cs @@ -1,30 +1,42 @@ using System; -using Microsoft.AspNetCore.Hosting; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; -using Serilog.Events; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo; public class Program { - public static int Main(string[] args) + public async static Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .Enrich.FromLogContext() - .WriteTo.Async(c => c.File("Logs/logs.txt")) .WriteTo.Async(c => c.Console()) .CreateLogger(); try { Log.Information("Starting web host."); - CreateHostBuilder(args).Build().Run(); + var builder = WebApplication.CreateBuilder(args); + builder.Host.AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); return 0; } catch (Exception ex) { + if (ex is HostAbortedException) + { + throw; + } + Log.Fatal(ex, "Host terminated unexpectedly!"); return 1; } @@ -33,14 +45,4 @@ public class Program Log.CloseAndFlush(); } } - - - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }) - .UseAutofac() - .UseSerilog(); } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json index 9bee4298ff..4ae3999794 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Properties/launchSettings.json @@ -1,24 +1,9 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:61659", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "http://localhost:5000", + "applicationUrl": "https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs deleted file mode 100644 index a11ca855da..0000000000 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/Startup.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo; - -public class Startup -{ - public void ConfigureServices(IServiceCollection services) - { - services.AddApplication(); - } - - public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) - { - app.InitializeApplication(); - } -} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 6dd0e1bde2..91b3770c6f 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -2,7 +2,11 @@ $(function () { var l = abp.localization.getResource('Docs'); var service = window.volo.docs.admin.documentsAdmin; - moment.localeData().preparse = (s)=>s; + var getFormattedDate = function ($datePicker) { + return $datePicker.data('date'); + }; + + moment.localeData().preparse = (s)=>s; moment.localeData().postformat = (s)=>s; var singleDatePicker = $('#DocumentsContainer .singledatepicker'); @@ -26,7 +30,7 @@ $(function () { var comboboxItems = []; - + service.getFilterItems() .then(function (result) { comboboxItems = result; @@ -41,13 +45,13 @@ $(function () { $projectId.on('change', function () { fillOptions(); }); - + var comboboxs = { version: $('#Version'), languageCode: $('#LanguageCode'), format: $('#Format') }; - + for (var key in comboboxs) { comboboxs[key].on('change', function () { fillOptions(); @@ -62,7 +66,7 @@ $(function () { comboboxs[key].empty(); } } - + function getSelectedItem() { var item = {}; for (var key in comboboxs) { @@ -70,13 +74,13 @@ $(function () { } return item; } - + function SetComboboxsValues(item) { for (var key in comboboxs) { comboboxs[key].val(item[key]); } } - + function addComboboxsEmptyItem() { for (var key in comboboxs) { comboboxs[key].append($('