From dd6a97f994f43902f3c86a0d128061aaf6ea4e97 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 22 Apr 2022 22:28:25 +0300 Subject: [PATCH 1/9] Update Abp-5_0.md --- docs/en/Migration-Guides/Abp-5_0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Migration-Guides/Abp-5_0.md b/docs/en/Migration-Guides/Abp-5_0.md index 35780786af..758f2b91ff 100644 --- a/docs/en/Migration-Guides/Abp-5_0.md +++ b/docs/en/Migration-Guides/Abp-5_0.md @@ -117,5 +117,5 @@ db.AbpUsers.updateMany({},{$set:{ IsActive : true }}) ## See Also * [Angular UI 4.x to 5.0 Migration Guide](Abp-5_0-Angular.md) -* [ASP.NET Core MVC / Razor Pages UI 4.x to 5.0 Migration Guide]() +* [ASP.NET Core MVC / Razor Pages UI 4.x to 5.0 Migration Guide](Abp-5-0-MVC.md) * [Blazor UI 4.x to 5.0 Migration Guide](Abp-5-0-Blazor.md) From c9fb2f6061fd471a79b8e0b1149c2d44ddb516e4 Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Tue, 26 Apr 2022 11:35:55 +0300 Subject: [PATCH 2/9] support url param in abp generate-proxy command --- docs/en/CLI.md | 8 +++++--- .../Angular/AngularServiceProxyGenerator.cs | 7 ++++++- .../schematics/src/commands/proxy-add/schema.json | 9 +++++++++ .../schematics/src/commands/proxy-refresh/schema.json | 9 +++++++++ .../schematics/src/commands/proxy-remove/schema.json | 9 +++++++++ .../schematics/src/models/generate-proxy-schema.ts | 5 +++++ npm/ng-packs/packages/schematics/src/utils/source.ts | 5 ++++- 7 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index d381290508..491ebee401 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -298,7 +298,7 @@ abp generate-proxy -t [options] Examples: ````bash -abp generate-proxy -t ng +abp generate-proxy -t ng -url https://localhost:44302/ abp generate-proxy -t js -url https://localhost:44302/ abp generate-proxy -t csharp -url https://localhost:44302/ ```` @@ -312,12 +312,13 @@ abp generate-proxy -t csharp -url https://localhost:44302/ * `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. + * `--url`: Specifies api definition url. Default value is API Name's url in environment file. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). * `js`: JavaScript. work in the `*.Web` project directory. There are some additional options for this client: * `--output` or `-o`: JavaScript file path or folder to place generated code in. * `--module` or `-m`: Specifies the name of the backend module you wish to generate proxies for. Default value: `app`. * `--working-directory` or `-wd`: Execution directory. For `csharp` and `js` client types. -* `--url` or `-u`: API definition URL from. For `csharp` and `js` client types. +* `--url` or `-u`: API definition URL from. > See the [Angular Service Proxies document](UI/Angular/Service-Proxies.md) for more. @@ -350,12 +351,13 @@ abp remove-proxy -t csharp --folder MyProxies/InnerFolder * `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. + * `--url`: Specifies api definition url. Default value is API Name's url in environment file. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). * `js`: JavaScript. work in the `*.Web` project directory. There are some additional options for this client: * `--output` or `-o`: JavaScript file path or folder to place generated code in. * `--module` or `-m`: Specifies the name of the backend module you wish to generate proxies for. Default value: `app`. * `--working-directory` or `-wd`: Execution directory. For `csharp` and `js` client types. -* `--url` or `-u`: API definition URL from. For `csharp` and `js` client types. +* `--url` or `-u`: API definition URL from. > See the [Angular Service Proxies document](UI/Angular/Service-Proxies.md) for more. diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs index e6069981da..8c8a6cdbd0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs @@ -48,7 +48,7 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase { const source = await resolveProject(host, params.source!); - const sourceUrl = getSourceUrl(host, source, apiName); + if (!sourceUrl) { + sourceUrl = getSourceUrl(host, source, apiName); + } return await getApiDefinition(sourceUrl); }; } From eae77364e91a421abb174500fdf116046720803c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 26 Apr 2022 12:42:40 +0300 Subject: [PATCH 3/9] Add info to Migration Guides document --- docs/en/Migration-Guides/Index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/Migration-Guides/Index.md b/docs/en/Migration-Guides/Index.md index e2647d8b0e..17e4d70dd8 100644 --- a/docs/en/Migration-Guides/Index.md +++ b/docs/en/Migration-Guides/Index.md @@ -1,5 +1,7 @@ # ABP Framework Migration Guides +The following documents explain how to migrate your existing ABP applications. We write migration documents only if you need to take an action while upgrading your solution. Otherwise, you can easily upgrade your solution using the [abp update command](../Upgrading.md). + - [5.1 to 5.2](Abp-5_2.md) - [4.x to 5.0](Abp-5_0.md) - [4.2 to 4.3](Abp-4_3.md) From a1d6c4d5e05fb5199c37d4fd66e1d67a533dd701 Mon Sep 17 00:00:00 2001 From: Mahmut Gundogdu Date: Tue, 26 Apr 2022 13:07:36 +0300 Subject: [PATCH 4/9] Update framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs Co-authored-by: Enis Necipoglu --- .../Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs index 8c8a6cdbd0..7e30a9a6bf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs @@ -48,7 +48,7 @@ public class AngularServiceProxyGenerator : ServiceProxyGeneratorBase Date: Tue, 26 Apr 2022 14:19:33 +0300 Subject: [PATCH 5/9] Cli: Improve CreateAppSettingsSecretsStep --- .../Steps/CreateAppSettingsSecretsStep.cs | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs index 7a5f792b15..aea368ac47 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs @@ -30,7 +30,9 @@ public class CreateAppSettingsSecretsStep : ProjectBuildPipelineStep ); } - var projectFiles = context.Files.Where(x => x.Content.Contains(AppSettingsPlaceholder)).ToList(); + var projectFiles = context.Files.Where(x => + x.Name.EndsWith(CliConsts.AppSettingsJsonFileName) && + x.Content.Contains(AppSettingsPlaceholder)).ToList(); foreach (var projectFile in projectFiles) { @@ -66,11 +68,30 @@ public class CreateAppSettingsSecretsStep : ProjectBuildPipelineStep private static string ReplaceAppSettingsSecretsPlaceholder(string content) { - var replaceContent = $"{Environment.NewLine}" + - $" {Environment.NewLine}" + + var path = string.Empty; + + var appSettingsRemoveLine = content.SplitToLines().FirstOrDefault(l=> + l.Contains("None") && + l.Contains("Remove") && + l.Contains(CliConsts.AppSettingsJsonFileName)); + + if (appSettingsRemoveLine != null) + { + var prefix = appSettingsRemoveLine.Split("\"") + .Select(s => s.Trim()) + .First(s => s.Contains(CliConsts.AppSettingsJsonFileName)) + .Replace(CliConsts.AppSettingsJsonFileName, ""); + + path = string.IsNullOrWhiteSpace(prefix) ? string.Empty : prefix; + } + + + var replaceContent = $"{Environment.NewLine}" + + $" {Environment.NewLine}" + $" PreserveNewest{Environment.NewLine}" + $" Always{Environment.NewLine}" + " "; + return content.Replace(AppSettingsPlaceholder, replaceContent); } } \ No newline at end of file From 9e4ecede687da8a192bc4181a4211415d031240b Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 26 Apr 2022 14:27:41 +0300 Subject: [PATCH 6/9] Update CreateAppSettingsSecretsStep.cs --- .../Building/Steps/CreateAppSettingsSecretsStep.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs index aea368ac47..20e4f8fca6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs @@ -31,7 +31,7 @@ public class CreateAppSettingsSecretsStep : ProjectBuildPipelineStep } var projectFiles = context.Files.Where(x => - x.Name.EndsWith(CliConsts.AppSettingsJsonFileName) && + x.Name.EndsWith(".csproj") && x.Content.Contains(AppSettingsPlaceholder)).ToList(); foreach (var projectFile in projectFiles) From b0e035a3a1a95684457e48884600f1b3efcffddc Mon Sep 17 00:00:00 2001 From: enisn Date: Tue, 26 Apr 2022 16:18:00 +0300 Subject: [PATCH 7/9] Fix localization key in SettingManagementFeatureDefinitionProvider.cs --- .../SettingManagementFeatureDefinitionProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingManagementFeatureDefinitionProvider.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingManagementFeatureDefinitionProvider.cs index 14124803c8..23f0c071fd 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingManagementFeatureDefinitionProvider.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingManagementFeatureDefinitionProvider.cs @@ -23,7 +23,7 @@ public class SettingManagementFeatureDefinitionProvider : FeatureDefinitionProvi SettingManagementFeatures.AllowTenantsToChangeEmailSettings, "false", L("Feature:AllowTenantsToChangeEmailSettings"), - L("AllowTenantsToChangeEmailSettingsDescription"), + L("Feature:AllowTenantsToChangeEmailSettingsDescription"), new ToggleStringValueType(), isAvailableToHost: false); } From 626ae01a475d3b77b989e9db8fd2e3f047db8da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 26 Apr 2022 16:40:21 +0300 Subject: [PATCH 8/9] Documented: "Using the Autofac Registration API" --- docs/en/Autofac-Integration.md | 37 +++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/en/Autofac-Integration.md b/docs/en/Autofac-Integration.md index 1313d2c482..fcd6389681 100644 --- a/docs/en/Autofac-Integration.md +++ b/docs/en/Autofac-Integration.md @@ -1,12 +1,12 @@ # Autofac Integration -Autofac is one of the most used dependency injection frameworks for .Net. It provides some advanced features compared to .Net Core standard DI library, like dynamic proxying and property injection. +[Autofac](https://autofac.org/) is one of the most used dependency injection frameworks for .NET. It provides advanced features compared to .Net Core's standard DI library, like dynamic proxying and property injection. ## Install Autofac Integration -> All startup templates and samples are Autofac integrated. So, most of the time you don't need to manually install this package. +> All the [startup templates](Startup-Templates/Index.md) and samples are Autofac integrated. So, most of the time you don't need to manually install this package. -Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) nuget package to your project (for a multi-projects application, it's suggested to add to the executable/web project.) +Install [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) nuget package to your project (for a multi-projects application, it's suggested to add to the executable/web project). ```` Install-Package Volo.Abp.Autofac @@ -52,6 +52,23 @@ public class Program } ```` +If you are using the static `WebApplication` class, you can call the `UseAutofac()` extension method as shown below: + +````csharp +public class Program +{ + public async static Task Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + builder.Host.UseAutofac(); // Integrate Autofac! + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); + } +} +```` + ### Console Application Call `UseAutofac()` method in the `AbpApplicationFactory.Create` options as shown below: @@ -79,3 +96,17 @@ namespace AbpConsoleDemo } ```` +## Using the Autofac Registration API + +If you want to use Autofac's advanced [registration API](https://autofac.readthedocs.io/en/latest/register/registration.html), you need to access the `ContainerBuilder` object. [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) nuget package defines the `IServiceCollection.GetContainerBuilder()` extension method to obtain the `ContainerBuilder` object. + +**Example: Get the `ContainerBuilder` object in the `ConfigureServices` method of your [module class](Module-Development-Basics.md)** + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + var containerBuilder = context.Services.GetContainerBuilder(); + containerBuilder.RegisterType(); // Using Autofac's registration API +} +```` + From b1bae437226efd0a63cdd5f798c20d4373086ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 26 Apr 2022 16:43:47 +0300 Subject: [PATCH 9/9] Update Autofac-Integration.md --- docs/en/Autofac-Integration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/Autofac-Integration.md b/docs/en/Autofac-Integration.md index fcd6389681..d05412c94b 100644 --- a/docs/en/Autofac-Integration.md +++ b/docs/en/Autofac-Integration.md @@ -110,3 +110,4 @@ public override void ConfigureServices(ServiceConfigurationContext context) } ```` +> You should install the [Volo.Abp.Autofac](https://www.nuget.org/packages/Volo.Abp.Autofac) nuget package to the project that you want to use the Autofac API.