From 1e10f8de591bc112b74c14c5c6e6e22ba7e7e819 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Fri, 2 Apr 2021 20:17:52 +0300 Subject: [PATCH 1/4] CLI HttpClient timeout increased --- .../Volo/Abp/Cli/Http/CliHttpClientFactory.cs | 7 ++-- .../ProjectBuilding/AbpIoSourceCodeStore.cs | 34 ++++++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClientFactory.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClientFactory.cs index a5608a1f88..841904673e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClientFactory.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClientFactory.cs @@ -8,12 +8,13 @@ namespace Volo.Abp.Cli.Http { public class CliHttpClientFactory : ISingletonDependency { - public static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(1); + public static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(2); private readonly IHttpClientFactory _clientFactory; private readonly ICancellationTokenProvider _cancellationTokenProvider; - public CliHttpClientFactory(IHttpClientFactory clientFactory, ICancellationTokenProvider cancellationTokenProvider) + public CliHttpClientFactory(IHttpClientFactory clientFactory, + ICancellationTokenProvider cancellationTokenProvider) { _clientFactory = clientFactory; _cancellationTokenProvider = cancellationTokenProvider; @@ -55,4 +56,4 @@ namespace Volo.Abp.Cli.Http } } } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index fdafa7c01c..20ebc4eb23 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -88,10 +88,11 @@ namespace Volo.Abp.Cli.ProjectBuilding if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) { Logger.LogInformation("Using local " + type + ": " + name + ", version: " + version); - return new TemplateFile(File.ReadAllBytes(Path.Combine(templateSource, name + "-" + version + ".zip")), version, latestVersion, nugetVersion); + return new TemplateFile(File.ReadAllBytes(Path.Combine(templateSource, name + "-" + version + ".zip")), + version, latestVersion, nugetVersion); } - var localCacheFile = Path.Combine(CliPaths.TemplateCache, name.Replace("/",".") + "-" + version + ".zip"); + var localCacheFile = Path.Combine(CliPaths.TemplateCache, name.Replace("/", ".") + "-" + version + ".zip"); #if DEBUG if (File.Exists(localCacheFile)) @@ -127,7 +128,8 @@ namespace Volo.Abp.Cli.ProjectBuilding return new TemplateFile(fileContent, version, latestVersion, nugetVersion); } - private async Task GetLatestSourceCodeVersionAsync(string name, string type, string url = null, bool includePreReleases = false) + private async Task GetLatestSourceCodeVersionAsync(string name, string type, string url = null, + bool includePreReleases = false) { if (url == null) { @@ -138,12 +140,14 @@ namespace Volo.Abp.Cli.ProjectBuilding { var client = _cliHttpClientFactory.CreateClient(); var stringContent = new StringContent( - JsonSerializer.Serialize(new GetLatestSourceCodeVersionDto { Name = name, IncludePreReleases = includePreReleases }), + JsonSerializer.Serialize(new GetLatestSourceCodeVersionDto + {Name = name, IncludePreReleases = includePreReleases}), Encoding.UTF8, MimeTypes.Application.Json ); - using (var response = await client.PostAsync(url, stringContent, _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)))) + using (var response = await client.PostAsync(url, stringContent, + _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)))) { await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); var result = await response.Content.ReadAsStringAsync(); @@ -170,12 +174,13 @@ namespace Volo.Abp.Cli.ProjectBuilding var client = _cliHttpClientFactory.CreateClient(); var stringContent = new StringContent( - JsonSerializer.Serialize(new GetTemplateNugetVersionDto { Name = name, Version = version }), + JsonSerializer.Serialize(new GetTemplateNugetVersionDto {Name = name, Version = version}), Encoding.UTF8, MimeTypes.Application.Json ); - using (var response = await client.PostAsync(url, stringContent, _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)))) + using (var response = await client.PostAsync(url, stringContent, + _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)))) { await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); var result = await response.Content.ReadAsStringAsync(); @@ -196,19 +201,20 @@ namespace Volo.Abp.Cli.ProjectBuilding try { - var client = _cliHttpClientFactory.CreateClient(); + var client = _cliHttpClientFactory.CreateClient(timeout: TimeSpan.FromMinutes(5)); if (input.TemplateSource.IsNullOrWhiteSpace()) { responseMessage = await client.PostAsync( url, new StringContent(JsonSerializer.Serialize(input), Encoding.UTF8, MimeTypes.Application.Json), - _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)) + _cliHttpClientFactory.GetCancellationToken(TimeSpan.FromMinutes(10)) ); } else { - responseMessage = await client.GetAsync(input.TemplateSource, _cliHttpClientFactory.GetCancellationToken()); + responseMessage = await client.GetAsync(input.TemplateSource, + _cliHttpClientFactory.GetCancellationToken()); } await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); @@ -219,7 +225,8 @@ namespace Volo.Abp.Cli.ProjectBuilding } catch (Exception ex) { - Console.WriteLine("Error occured while downloading source-code from {0} : {1}{2}{3}", url, responseMessage?.ToString(), Environment.NewLine, ex.Message); + Console.WriteLine("Error occured while downloading source-code from {0} : {1}{2}{3}", url, + responseMessage?.ToString(), Environment.NewLine, ex.Message); throw; } } @@ -239,7 +246,8 @@ namespace Volo.Abp.Cli.ProjectBuilding stringBuilder.AppendLine(cacheFile); } - var matches = Regex.Matches(stringBuilder.ToString(), $"({AppTemplate.TemplateName}|{AppProTemplate.TemplateName}|{ModuleTemplate.TemplateName}|{ModuleProTemplate.TemplateName}|{ConsoleTemplate.TemplateName}|{WpfTemplate.TemplateName})-(.+).zip"); + var matches = Regex.Matches(stringBuilder.ToString(), + $"({AppTemplate.TemplateName}|{AppProTemplate.TemplateName}|{ModuleTemplate.TemplateName}|{ModuleProTemplate.TemplateName}|{ConsoleTemplate.TemplateName}|{WpfTemplate.TemplateName})-(.+).zip"); foreach (Match match in matches) { templateList.Add((match.Groups[1].Value, match.Groups[2].Value)); @@ -282,4 +290,4 @@ namespace Volo.Abp.Cli.ProjectBuilding public string Version { get; set; } } } -} +} \ No newline at end of file From 3bcd9ba015403f64450aa24b319dc47e113cc681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 2 Apr 2021 20:26:35 +0300 Subject: [PATCH 2/4] Updated get started document for v4.3, for blazor server changes. --- docs/en/Getting-Started-Create-Solution.md | 10 ++++++---- docs/en/Getting-Started-Running-Solution.md | 12 ++++++------ docs/en/Getting-Started-Setup-Environment.md | 2 +- docs/en/Getting-Started.md | 2 +- docs/en/docs-params.json | 3 ++- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/en/Getting-Started-Create-Solution.md b/docs/en/Getting-Started-Create-Solution.md index 75a50a737f..a4be6a2658 100644 --- a/docs/en/Getting-Started-Create-Solution.md +++ b/docs/en/Getting-Started-Create-Solution.md @@ -13,17 +13,21 @@ ## Create a New Project +We will use the ABP CLI to create a new ABP project. + +> Alternatively, you can **create and download** projects from [ABP Framework website](https://abp.io/get-started) by easily selecting the all the options from the page. + Use the `new` command of the ABP CLI to create a new project: ````shell -abp new Acme.BookStore{{if UI == "NG"}} -u angular{{else if UI == "Blazor"}} -u blazor{{end}}{{if DB == "Mongo"}} -d mongodb{{end}}{{if Tiered == "Yes"}}{{if UI == "MVC"}} --tiered{{else}} --separate-identity-server{{end}}{{end}} +abp new Acme.BookStore{{if UI == "NG"}} -u angular{{else if UI == "Blazor"}} -u blazor{{end}}{{if UI == "BlazorServer"}} -u blazor-server{{if DB == "Mongo"}} -d mongodb{{end}}{{if Tiered == "Yes"}}{{if UI == "MVC"}} --tiered{{else}} --separate-identity-server{{end}}{{end}} ```` *You can use different level of namespaces; e.g. BookStore, Acme.BookStore or Acme.Retail.BookStore.* {{ if Tiered == "Yes" }} -{{ if UI == "MVC" }} +{{ if UI == "MVC" || UI == "BlazorServer" }} * `--tiered` argument is used to create N-tiered solution where authentication server, UI and API layers are physically separated. @@ -37,8 +41,6 @@ abp new Acme.BookStore{{if UI == "NG"}} -u angular{{else if UI == "Blazor"}} -u > [ABP CLI document](./CLI.md) covers all of the available commands and options. -> Alternatively, you can **create and download** projects from [ABP Framework website](https://abp.io/get-started) by easily selecting the all the options from the page. - ### The Solution Structure The solution has a layered structure (based on the [Domain Driven Design](Domain-Driven-Design.md)) and contains unit & integration test projects. See the [application template document](Startup-Templates/Application.md) to understand the solution structure in details. diff --git a/docs/en/Getting-Started-Running-Solution.md b/docs/en/Getting-Started-Running-Solution.md index 163a3890b2..a195a4e2a2 100644 --- a/docs/en/Getting-Started-Running-Solution.md +++ b/docs/en/Getting-Started-Running-Solution.md @@ -3,7 +3,7 @@ ````json //[doc-params] { - "UI": ["MVC", "Blazor", "NG"], + "UI": ["MVC", "Blazor", "BlazorServer", "NG"], "DB": ["EF", "Mongo"], "Tiered": ["Yes", "No"] } @@ -15,7 +15,7 @@ ### Connection String -Check the **connection string** in the `appsettings.json` file under the {{if Tiered == "Yes"}}`.IdentityServer` and `.HttpApi.Host` projects{{else}}{{if UI=="MVC"}}`.Web` project{{else}}`.HttpApi.Host` project{{end}}{{end}} +Check the **connection string** in the `appsettings.json` file under the {{if Tiered == "Yes"}}`.IdentityServer` and `.HttpApi.Host` projects{{else}}{{if UI=="MVC"}}`.Web` project{{else if UI=="BlazorServer"}}`.Blazor` project{{else}}`.HttpApi.Host` project{{end}}{{end}}. {{ if DB == "EF" }} @@ -91,7 +91,7 @@ Right click to the `.DbMigrator` project and select **Set as StartUp Project** ## Run the Application -{{ if UI == "MVC" }} +{{ if UI == "MVC" || UI == "BlazorServer" }} {{ if Tiered == "Yes" }} @@ -109,7 +109,7 @@ You can login, but you cannot enter to the main application here. This is **just This is the HTTP API that is used by the web application. -3. Lastly, ensure that the `.Web` project is the startup project and run the application which will open a **welcome** page in your browser +3. Lastly, ensure that the {{if UI=="MVC"}}`.Web`{{else}}`.Blazor`{{end}} project is the startup project and run the application which will open a **welcome** page in your browser ![mvc-tiered-app-home](images/bookstore-home.png) @@ -119,7 +119,7 @@ Click to the **login** button which will redirect you to the *authentication ser {{ else # Tiered != "Yes" }} -Ensure that the `.Web` project is the startup project. Run the application which will open the **login** page in your browser: +Ensure that the {{if UI=="MVC"}}`.Web`{{else}}`.Blazor`{{end}} project is the startup project. Run the application which will open the **login** page in your browser: > Use Ctrl+F5 in Visual Studio (instead of F5) to run the application without debugging. If you don't have a debug purpose, this will be faster. @@ -127,7 +127,7 @@ Ensure that the `.Web` project is the startup project. Run the application which {{ end # Tiered }} -{{ else # UI != "MVC" }} +{{ else # UI != MVC || BlazorServer }} ### Running the HTTP API Host (Server Side) diff --git a/docs/en/Getting-Started-Setup-Environment.md b/docs/en/Getting-Started-Setup-Environment.md index 39a82076eb..386cc67cf3 100644 --- a/docs/en/Getting-Started-Setup-Environment.md +++ b/docs/en/Getting-Started-Setup-Environment.md @@ -3,7 +3,7 @@ ````json //[doc-params] { - "UI": ["MVC", "Blazor", "NG"], + "UI": ["MVC", "Blazor", "BlazorServer", "NG"], "DB": ["EF", "Mongo"], "Tiered": ["Yes", "No"] } diff --git a/docs/en/Getting-Started.md b/docs/en/Getting-Started.md index ddafff38e4..b3fd215e35 100644 --- a/docs/en/Getting-Started.md +++ b/docs/en/Getting-Started.md @@ -3,7 +3,7 @@ ````json //[doc-params] { - "UI": ["MVC", "Blazor", "NG"], + "UI": ["MVC", "Blazor", "BlazorServer", "NG"], "DB": ["EF", "Mongo"], "Tiered": ["Yes", "No"] } diff --git a/docs/en/docs-params.json b/docs/en/docs-params.json index f28a3b49ef..46e496f248 100644 --- a/docs/en/docs-params.json +++ b/docs/en/docs-params.json @@ -5,7 +5,8 @@ "displayName": "UI", "values": { "MVC": "MVC / Razor Pages", - "Blazor": "Blazor", + "Blazor": "Blazor WebAssembly", + "BlazorServer": "Blazor Server", "NG": "Angular" } }, From c5aad05e031cfe74e3bb731814f27d7a018083f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 2 Apr 2021 20:31:46 +0300 Subject: [PATCH 3/4] Update Getting-Started-Create-Solution.md --- docs/en/Getting-Started-Create-Solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Getting-Started-Create-Solution.md b/docs/en/Getting-Started-Create-Solution.md index a4be6a2658..83f8d29c46 100644 --- a/docs/en/Getting-Started-Create-Solution.md +++ b/docs/en/Getting-Started-Create-Solution.md @@ -3,7 +3,7 @@ ````json //[doc-params] { - "UI": ["MVC", "Blazor", "NG"], + "UI": ["MVC", "Blazor", "BlazorServer", "NG"], "DB": ["EF", "Mongo"], "Tiered": ["Yes", "No"] } From 4c2e3d3e289b60039296f4fb8137445cc78cd5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 2 Apr 2021 20:35:44 +0300 Subject: [PATCH 4/4] Update Getting-Started-Create-Solution.md --- docs/en/Getting-Started-Create-Solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Getting-Started-Create-Solution.md b/docs/en/Getting-Started-Create-Solution.md index 83f8d29c46..aa3391adc5 100644 --- a/docs/en/Getting-Started-Create-Solution.md +++ b/docs/en/Getting-Started-Create-Solution.md @@ -20,7 +20,7 @@ We will use the ABP CLI to create a new ABP project. Use the `new` command of the ABP CLI to create a new project: ````shell -abp new Acme.BookStore{{if UI == "NG"}} -u angular{{else if UI == "Blazor"}} -u blazor{{end}}{{if UI == "BlazorServer"}} -u blazor-server{{if DB == "Mongo"}} -d mongodb{{end}}{{if Tiered == "Yes"}}{{if UI == "MVC"}} --tiered{{else}} --separate-identity-server{{end}}{{end}} +abp new Acme.BookStore{{if UI == "NG"}} -u angular{{else if UI == "Blazor"}} -u blazor{{else if UI == "BlazorServer"}} -u blazor-server{{end}}{{if DB == "Mongo"}} -d mongodb{{end}}{{if Tiered == "Yes"}}{{if UI == "MVC"}} --tiered{{else}} --separate-identity-server{{end}}{{end}} ```` *You can use different level of namespaces; e.g. BookStore, Acme.BookStore or Acme.Retail.BookStore.*