" +
+ var mb = TagHelper.AddMarginBottomClass ? (isCheckbox ? "mb-2" : "mb-3") : string.Empty;
+ return "
" +
Environment.NewLine + innerHtml + Environment.NewLine +
"
";
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
index 7d11f69636..dbcf84437f 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
@@ -37,7 +37,7 @@ public class AbpSelectTagHelper : AbpTagHelper
{
output.Attributes.AddClass("form-floating");
}
- output.Attributes.AddClass("mb-3");
+
+ if (TagHelper.AddMarginBottomClass)
+ {
+ output.Attributes.AddClass("mb-3");
+ }
output.TagMode = TagMode.StartTagAndEndTag;
output.Content.SetHtmlContent(innerHtml);
}
@@ -79,7 +83,8 @@ public class AbpSelectTagHelperService : AbpTagHelperService
protected virtual string SurroundInnerHtmlAndGet(TagHelperContext context, TagHelperOutput output, string innerHtml)
{
- return "" + Environment.NewLine + innerHtml + Environment.NewLine + "
";
+ var mb3 = TagHelper.AddMarginBottomClass ? "mb-3" : string.Empty;
+ return $"" + Environment.NewLine + innerHtml + Environment.NewLine + "
";
}
protected virtual async Task GetSelectTagAsync(TagHelperContext context, TagHelperOutput output, TagHelperContent childContent)
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs
index fed2981613..079431c9c6 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelper.cs
@@ -21,20 +21,20 @@ public abstract class
public bool LabelTooltipHtml { get; set; } = false;
- [HtmlAttributeName("info")]
+ [HtmlAttributeName("info")]
public string? InfoText { get; set; }
- [HtmlAttributeName("disabled")]
+ [HtmlAttributeName("disabled")]
public bool IsDisabled { get; set; } = false;
- [HtmlAttributeName("readonly")]
+ [HtmlAttributeName("readonly")]
public bool? IsReadonly { get; set; } = false;
public bool AutoFocus { get; set; }
public AbpFormControlSize Size { get; set; } = AbpFormControlSize.Default;
- [HtmlAttributeName("required-symbol")]
+ [HtmlAttributeName("required-symbol")]
public bool DisplayRequiredSymbol { get; set; } = true;
public string? Name { get; set; }
@@ -43,11 +43,13 @@ public abstract class
public bool SuppressLabel { get; set; }
+ public bool AddMarginBottomClass { get; set; } = true;
+
protected AbpDatePickerBaseTagHelper(AbpDatePickerBaseTagHelperService service) : base(service)
{
_abpDatePickerOptionsImplementation = new AbpDatePickerOptions();
}
-
+
public void SetDatePickerOptions(IAbpDatePickerOptions options)
{
_abpDatePickerOptionsImplementation = options;
@@ -217,4 +219,4 @@ public abstract class
get => _abpDatePickerOptionsImplementation.Options;
set => _abpDatePickerOptionsImplementation.Options = value;
}
-}
\ No newline at end of file
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs
index 024fd4dd45..54e8720b17 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/DatePicker/AbpDatePickerBaseTagHelperService.cs
@@ -22,7 +22,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form.DatePicker;
public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelperService
where TTagHelper : AbpDatePickerBaseTagHelper
{
- protected readonly Dictionary> SupportedInputTypes = new()
+ protected readonly Dictionary> SupportedInputTypes = new()
{
{
typeof(string), o =>
@@ -42,7 +42,7 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp
{
return dt.ToString("O");
}
-
+
return string.Empty;
}
},
@@ -54,7 +54,7 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp
{
return dto.ToString("O");
}
-
+
return string.Empty;
}
},
@@ -161,7 +161,10 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp
output.TagMode = TagMode.StartTagAndEndTag;
output.TagName = "div";
LeaveOnlyGroupAttributes(context, output);
- output.Attributes.AddClass("mb-3");
+ if (TagHelper.AddMarginBottomClass)
+ {
+ output.Attributes.AddClass("mb-3");
+ }
output.Content.AppendHtml(innerHtml);
}
@@ -224,7 +227,8 @@ public abstract class AbpDatePickerBaseTagHelperService : AbpTagHelp
protected virtual string SurroundInnerHtmlAndGet(TagHelperContext context, TagHelperOutput output, string innerHtml)
{
- return "" +
+ var mb = TagHelper.AddMarginBottomClass ? "mb-3" : string.Empty;
+ return $"
" +
Environment.NewLine + innerHtml + Environment.NewLine +
"
";
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
index 1480dc0de1..86405042b1 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj
index 466589a027..60409e9c78 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
index 6e5cf50d57..fefd0dfaa6 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
index c2fad00e3c..a1c1dc8a82 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
index 40bed2322c..4679eff65c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Zxcvbn/ZxcvbnScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Zxcvbn/ZxcvbnScriptContributor.cs
new file mode 100644
index 0000000000..8c02fc2be2
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Zxcvbn/ZxcvbnScriptContributor.cs
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
+
+namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Zxcvbn;
+
+public class ZxcvbnScriptContributor : BundleContributor
+{
+ public override void ConfigureBundle(BundleConfigurationContext context)
+ {
+ context.Files.AddIfNotContains("/libs/zxcvbn/zxcvbn.js");
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj
index 56da56c227..fb63da0a26 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Demo.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
@@ -28,7 +28,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
index 4bac31ac83..d2c64435c5 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js
index e524881176..03ba2706d0 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js
@@ -134,10 +134,18 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f
_args = args || {};
+ var argsWithoutFunc = {};
+ for (var a in _args) {
+ if (_args.hasOwnProperty(a) && typeof _args[a] !== 'function') {
+ argsWithoutFunc[a] = _args[a];
+ }
+ }
+
_createContainer(_modalId)
- .load(options.viewUrl, $.param(_args), function (response, status, xhr) {
+ .load(options.viewUrl, $.param(argsWithoutFunc), function (response, status, xhr) {
if (status === "error") {
- //TODO: Handle!
+ var responseJSON = xhr.responseJSON ? xhr.responseJSON : JSON.parse(xhr.responseText);
+ abp.ajax.showError(responseJSON.error ? responseJSON.error : abp.ajax.defaultError);
return;
};
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
index 25106fee56..f1fad26806 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
index 1d1234a147..8393744971 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
index 69cc963ca2..14c7111a5c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
true
@@ -30,8 +30,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
index 9e3b0bfba2..0a10835e3c 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
@@ -145,7 +145,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
ActionApiDescriptionModel.Create(
uniqueMethodName,
method,
- apiDescription.RelativePath,
+ apiDescription.RelativePath!,
apiDescription.HttpMethod,
GetSupportedVersions(controllerType, method, setting),
allowAnonymous,
@@ -214,6 +214,8 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
type == typeof(void) ||
type == typeof(Enum) ||
type == typeof(ValueType) ||
+ type == typeof(DateOnly) ||
+ type == typeof(TimeOnly) ||
TypeHelper.IsPrimitiveExtended(type))
{
return;
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
index 1b8e7fcb1b..a8a2c2db54 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
@@ -20,6 +20,8 @@ public class AbpConventionalControllerOptions
///
public bool UseV3UrlStyle { get; set; }
+ public string[] IgnoredUrlSuffixesInControllerNames { get; set; } = new[] { "Integration" };
+
public AbpConventionalControllerOptions()
{
ConventionalControllerSettings = new ConventionalControllerSettingList();
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs
index 7e5b364b3e..58dda9fb92 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs
@@ -109,7 +109,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
{
if (configuration?.UrlControllerNameNormalizer == null)
{
- return controllerName;
+ return controllerName.RemovePostFix(Options.IgnoredUrlSuffixesInControllerNames);
}
return configuration.UrlControllerNameNormalizer(
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
index 8d5f2d4c4a..1301a5e823 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/Metadata/AbpModelMetadataProvider.cs
@@ -40,11 +40,11 @@ public class AbpModelMetadataProvider : DefaultModelMetadataProvider
{
foreach (var validationAttribute in detail.ModelAttributes.Attributes.OfType())
{
- NormalizeValidationAttrbute(validationAttribute);
+ NormalizeValidationAttribute(validationAttribute);
}
}
- protected virtual void NormalizeValidationAttrbute(ValidationAttribute validationAttribute)
+ protected virtual void NormalizeValidationAttribute(ValidationAttribute validationAttribute)
{
if (validationAttribute.ErrorMessage == null)
{
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
index b912d3905a..d4fd27d889 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
@@ -32,7 +32,7 @@ public class ServiceProxyGenerationModel
public ProxyScriptingModel CreateOptions()
{
- var options = new ProxyScriptingModel(Type, UseCache);
+ var options = new ProxyScriptingModel(Type!, UseCache);
if (!Modules.IsNullOrEmpty())
{
diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
index 505c07a3e1..cd87c55ea4 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
@@ -1,14 +1,15 @@
-using System.ComponentModel.DataAnnotations;
+using System;
+using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace Volo.Abp.AspNetCore.Mvc.Validation;
public static class ValidationAttributeHelper
{
- private static readonly PropertyInfo ValidationAttributeErrorMessageStringProperty = typeof(ValidationAttribute)
+ private readonly static PropertyInfo ValidationAttributeErrorMessageStringProperty = typeof(ValidationAttribute)
.GetProperty("ErrorMessageString", BindingFlags.Instance | BindingFlags.NonPublic)!;
- private static readonly PropertyInfo ValidationAttributeCustomErrorMessageSetProperty = typeof(ValidationAttribute)
+ private readonly static PropertyInfo ValidationAttributeCustomErrorMessageSetProperty = typeof(ValidationAttribute)
.GetProperty("CustomErrorMessageSet", BindingFlags.Instance | BindingFlags.NonPublic)!;
public static void SetDefaultErrorMessage(ValidationAttribute validationAttribute)
@@ -24,7 +25,14 @@ public static class ValidationAttributeHelper
}
}
- validationAttribute.ErrorMessage =
- ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string;
+ try
+ {
+ var errorMessageString = ValidationAttributeErrorMessageStringProperty.GetValue(validationAttribute) as string;
+ validationAttribute.ErrorMessage = errorMessageString;
+ }
+ catch (Exception e)
+ {
+ // ignored
+ }
}
}
diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj
index 6874bf6b9a..609b8c06f3 100644
--- a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.AspNetCore.Serilog
@@ -25,7 +25,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj
index 24796d8e35..19b2b748af 100644
--- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.AspNetCore.SignalR
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
index a6f6a55f39..d919581455 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.AspNetCore.TestBase
@@ -27,7 +27,8 @@
-
+
+
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
index 8892623364..e6c49d475c 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs
@@ -13,6 +13,7 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.TestBase;
+[Obsolete("Use AbpWebApplicationFactoryIntegratedTest instead.")]
public class AbpAspNetCoreAsyncIntegratedTestBase
where TModule : IAbpModule
{
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
index c362d5074c..a42cbae457 100644
--- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
@@ -14,6 +14,7 @@ namespace Volo.Abp.AspNetCore.TestBase;
///
/// Can be a module type or old-style ASP.NET Core Startup class.
///
+[Obsolete("Use AbpWebApplicationFactoryIntegratedTest instead.")]
public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestBaseWithServiceProvider, IDisposable
where TStartupModule : class
{
@@ -41,6 +42,7 @@ public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestB
protected virtual IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder()
+ .AddAppSettingsSecretsJson()
.ConfigureWebHostDefaults(webBuilder =>
{
if (typeof(TStartupModule).IsAssignableTo())
@@ -51,7 +53,7 @@ public abstract class AbpAspNetCoreIntegratedTestBase : AbpTestB
{
webBuilder.UseStartup();
}
-
+
webBuilder.UseAbpTestServer();
})
.UseAutofac()
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs
new file mode 100644
index 0000000000..9a6422ca97
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpWebApplicationFactoryIntegratedTest.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+
+namespace Volo.Abp.AspNetCore.TestBase;
+
+public abstract class AbpWebApplicationFactoryIntegratedTest : WebApplicationFactory
+ where TProgram : class
+{
+ protected HttpClient Client { get; set; }
+
+ protected IServiceProvider ServiceProvider => Services;
+
+ protected AbpWebApplicationFactoryIntegratedTest()
+ {
+ Client = CreateClient(new WebApplicationFactoryClientOptions
+ {
+ AllowAutoRedirect = false
+ });
+ ServiceProvider.GetRequiredService().Server = Server;
+ }
+
+ protected override IHost CreateHost(IHostBuilder builder)
+ {
+ builder
+ .AddAppSettingsSecretsJson()
+ .ConfigureServices(ConfigureServices);
+ return base.CreateHost(builder);
+ }
+
+ protected virtual T? GetService()
+ {
+ return Services.GetService();
+ }
+
+ protected virtual T GetRequiredService() where T : notnull
+ {
+ return Services.GetRequiredService();
+ }
+
+ protected virtual void ConfigureServices(IServiceCollection services)
+ {
+
+ }
+
+ #region GetUrl
+
+ ///
+ /// Gets default URL for given controller type.
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl()
+ {
+ return "/" + typeof(TController).Name.RemovePostFix("Controller", "AppService", "ApplicationService", "IntService", "IntegrationService", "Service");
+ }
+
+ ///
+ /// Gets default URL for given controller type's given action.
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl(string actionName)
+ {
+ return GetUrl() + "/" + actionName;
+ }
+
+ ///
+ /// Gets default URL for given controller type's given action with query string parameters (as anonymous object).
+ ///
+ /// The type of the controller.
+ protected virtual string GetUrl(string actionName, object queryStringParamsAsAnonymousObject)
+ {
+ var url = GetUrl(actionName);
+
+ var dictionary = new RouteValueDictionary(queryStringParamsAsAnonymousObject);
+ if (dictionary.Any())
+ {
+ url += "?" + dictionary.Select(d => $"{d.Key}={d.Value}").JoinAsString("&");
+ }
+
+ return url;
+ }
+
+ #endregion
+}
diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs
new file mode 100644
index 0000000000..403bbac7b1
--- /dev/null
+++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/WebApplicationBuilderExtensions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.AspNetCore.TestBase;
+
+public static class WebApplicationBuilderExtensions
+{
+ public async static Task RunAbpModuleAsync(this WebApplicationBuilder builder, Action? optionsAction = null)
+ where TModule : IAbpModule
+ {
+ var assemblyName = typeof(TModule).Assembly.GetName()?.Name;
+ if (!assemblyName.IsNullOrWhiteSpace())
+ {
+ // Set the application name as the assembly name of the module will automatically add assembly to the ApplicationParts of MVC application.
+ builder.Environment.ApplicationName = assemblyName!;
+ }
+ builder.Host.UseAutofac();
+ await builder.AddApplicationAsync(optionsAction);
+ var app = builder.Build();
+ await app.InitializeApplicationAsync();
+ await app.RunAsync();
+ }
+}
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs
index 7a492371b9..1389365715 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Internal/ResponseContentTypeHelper.cs
@@ -7,7 +7,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Internal;
///
-/// https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Shared/ResponseContentTypeHelper.cs
+/// https://github.com/dotnet/aspnetcore/blob/release/8.0-rc1/src/Shared/ResponseContentTypeHelper.cs
///
public static class ResponseContentTypeHelper
{
@@ -15,7 +15,7 @@ public static class ResponseContentTypeHelper
/// Gets the content type and encoding that need to be used for the response.
/// The priority for selecting the content type is:
/// 1. ContentType property set on the action result
- /// 2. property set on
+ /// 2. property set on
/// 3. Default content type set on the action result
///
///
@@ -75,4 +75,4 @@ public static class ResponseContentTypeHelper
return default;
}
-}
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs
index 0e33ce87fc..28537f5179 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/CookieAuthenticationOptionsExtensions.cs
@@ -48,7 +48,7 @@ public static class CookieAuthenticationOptionsExtensions
var response = await openIdConnectOptions.Backchannel.IntrospectTokenAsync(new TokenIntrospectionRequest
{
Address = openIdConnectOptions.Configuration?.IntrospectionEndpoint ?? openIdConnectOptions.Authority!.EnsureEndsWith('/') + "connect/introspect",
- ClientId = openIdConnectOptions.ClientId,
+ ClientId = openIdConnectOptions.ClientId!,
ClientSecret = openIdConnectOptions.ClientSecret,
Token = accessToken
});
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
index 20ee51e01f..88b4506dc5 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
+++ b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.AspNetCore
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs
index 83deaef26a..0c797a8dc2 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs
@@ -98,13 +98,13 @@ public class AbpAuditingMiddleware : IMiddleware, ITransientDependency
{
return false;
}
-
- if (!AuditingOptions.IsEnabledForIntegrationServices &&
+
+ if (!AuditingOptions.IsEnabledForIntegrationServices &&
context.Request.Path.Value.StartsWith($"/{AbpAspNetCoreConsts.DefaultIntegrationServiceApiPrefix}/"))
{
return true;
}
-
+
if (AspNetCoreAuditingOptions.IgnoredUrls.Any(x => context.Request.Path.Value.StartsWith(x)))
{
return true;
@@ -134,7 +134,8 @@ public class AbpAuditingMiddleware : IMiddleware, ITransientDependency
}
if (!AuditingOptions.IsEnabledForGetRequests &&
- string.Equals(httpContext.Request.Method, HttpMethods.Get, StringComparison.OrdinalIgnoreCase))
+ (string.Equals(httpContext.Request.Method, HttpMethods.Get, StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(httpContext.Request.Method, HttpMethods.Head, StringComparison.OrdinalIgnoreCase)))
{
return false;
}
diff --git a/framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj b/framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj
index 15e5befcaa..b99c502a61 100644
--- a/framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj
+++ b/framework/src/Volo.Abp.Auditing.Contracts/Volo.Abp.Auditing.Contracts.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Auditing.Contracts
diff --git a/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj b/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj
index 00abec3b37..fc2a565b19 100644
--- a/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj
+++ b/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Auditing
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogScope.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogScope.cs
index 8e9f14e976..e3e8f22d0a 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogScope.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditLogScope.cs
@@ -1,9 +1,6 @@
-using JetBrains.Annotations;
-
-namespace Volo.Abp.Auditing;
+namespace Volo.Abp.Auditing;
public interface IAuditLogScope
{
- [NotNull]
AuditLogInfo Log { get; }
}
diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs
index a1091b8600..c496a22340 100644
--- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs
+++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/IAuditingManager.cs
@@ -1,6 +1,4 @@
-using JetBrains.Annotations;
-
-namespace Volo.Abp.Auditing;
+namespace Volo.Abp.Auditing;
public interface IAuditingManager
{
diff --git a/framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj b/framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj
index 51e05677d4..14d337d15a 100644
--- a/framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj
+++ b/framework/src/Volo.Abp.Authorization.Abstractions/Volo.Abp.Authorization.Abstractions.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Authorization.Abstractions
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs
index 39ba335cb2..5b9936448c 100644
--- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs
+++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AuthorizationOptionsExtensions.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
+using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Authorization;
@@ -20,6 +21,6 @@ public static class AuthorizationOptionsExtensions
///
public static List GetPoliciesNames(this AuthorizationOptions options)
{
- return ((IDictionary)PolicyMapProperty.GetValue(options)!).Keys.ToList();
+ return ((IDictionary>)PolicyMapProperty.GetValue(options)!).Keys.ToList();
}
}
diff --git a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
index d16885cbd0..492d1bc4ef 100644
--- a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
+++ b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Authorization
diff --git a/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs b/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleObjectExtensions.cs
similarity index 96%
rename from framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs
rename to framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleObjectExtensions.cs
index 58047f575d..ea746500d6 100644
--- a/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs
+++ b/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleObjectExtensions.cs
@@ -1,12 +1,11 @@
using System.Collections.Generic;
-using Volo.Abp;
using Volo.Abp.AutoMapper;
using Volo.Abp.Data;
using Volo.Abp.ObjectExtending;
namespace AutoMapper;
-public static class AbpAutoMapperExtensibleDtoExtensions
+public static class AbpAutoMapperExtensibleObjectExtensions
{
public static IMappingExpression MapExtraProperties(
this IMappingExpression mappingExpression,
diff --git a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
index e5c78948ba..fdf3fef362 100644
--- a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
+++ b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Autofac.WebAssembly/Volo.Abp.Autofac.WebAssembly.csproj b/framework/src/Volo.Abp.Autofac.WebAssembly/Volo.Abp.Autofac.WebAssembly.csproj
index 1ce2a8154d..1f00652a55 100644
--- a/framework/src/Volo.Abp.Autofac.WebAssembly/Volo.Abp.Autofac.WebAssembly.csproj
+++ b/framework/src/Volo.Abp.Autofac.WebAssembly/Volo.Abp.Autofac.WebAssembly.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
diff --git a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
index cf1c18994a..60a7418bb5 100644
--- a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
+++ b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Autofac
@@ -17,11 +17,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj b/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj
index aef38c1e10..151b54c7d6 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo.Abp.AzureServiceBus.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.AzureServiceBus
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/AzureServiceBusMessageConsumerFactory.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/AzureServiceBusMessageConsumerFactory.cs
index 04c7b48c6a..cf92ed7b73 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/AzureServiceBusMessageConsumerFactory.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/AzureServiceBusMessageConsumerFactory.cs
@@ -14,7 +14,7 @@ public class AzureServiceBusMessageConsumerFactory : IAzureServiceBusMessageCons
ServiceScope = serviceScopeFactory.CreateScope();
}
- public IAzureServiceBusMessageConsumer CreateMessageConsumer(string topicName, string subscriptionName, string connectionName)
+ public IAzureServiceBusMessageConsumer CreateMessageConsumer(string topicName, string subscriptionName, string? connectionName)
{
var processor = ServiceScope.ServiceProvider.GetRequiredService();
processor.Initialize(topicName, subscriptionName, connectionName);
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
index d616e1264f..df830cde7a 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/ConnectionPool.cs
@@ -28,7 +28,7 @@ public class ConnectionPool : IConnectionPool, ISingletonDependency
Logger = new NullLogger();
}
- public ServiceBusClient GetClient(string connectionName)
+ public ServiceBusClient GetClient(string? connectionName)
{
connectionName ??= AzureServiceBusConnections.DefaultConnectionName;
return _clients.GetOrAdd(
@@ -40,7 +40,7 @@ public class ConnectionPool : IConnectionPool, ISingletonDependency
).Value;
}
- public ServiceBusAdministrationClient GetAdministrationClient(string connectionName)
+ public ServiceBusAdministrationClient GetAdministrationClient(string? connectionName)
{
connectionName ??= AzureServiceBusConnections.DefaultConnectionName;
return _adminClients.GetOrAdd(
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IAzureServiceBusMessageConsumerFactory.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IAzureServiceBusMessageConsumerFactory.cs
index bd770e2204..4d93bcf5c3 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IAzureServiceBusMessageConsumerFactory.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IAzureServiceBusMessageConsumerFactory.cs
@@ -16,5 +16,5 @@ public interface IAzureServiceBusMessageConsumerFactory
IAzureServiceBusMessageConsumer CreateMessageConsumer(
string topicName,
string subscriptionName,
- string connectionName);
+ string? connectionName);
}
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IConnectionPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IConnectionPool.cs
index a4cdfbc122..825c981a00 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IConnectionPool.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IConnectionPool.cs
@@ -6,7 +6,7 @@ namespace Volo.Abp.AzureServiceBus;
public interface IConnectionPool : IAsyncDisposable
{
- ServiceBusClient GetClient(string connectionName);
+ ServiceBusClient GetClient(string? connectionName);
- ServiceBusAdministrationClient GetAdministrationClient(string connectionName);
+ ServiceBusAdministrationClient GetAdministrationClient(string? connectionName);
}
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IPublisherPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IPublisherPool.cs
index 4940d250dd..bb0bf8e827 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IPublisherPool.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/IPublisherPool.cs
@@ -6,5 +6,5 @@ namespace Volo.Abp.AzureServiceBus;
public interface IPublisherPool : IAsyncDisposable
{
- Task GetAsync(string topicName, string connectionName);
+ Task GetAsync(string topicName, string? connectionName);
}
diff --git a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/PublisherPool.cs b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/PublisherPool.cs
index 45b025cc59..a10c63868d 100644
--- a/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/PublisherPool.cs
+++ b/framework/src/Volo.Abp.AzureServiceBus/Volo/Abp/AzureServiceBus/PublisherPool.cs
@@ -24,7 +24,7 @@ public class PublisherPool : IPublisherPool, ISingletonDependency
Logger = new NullLogger();
}
- public async Task GetAsync(string topicName, string connectionName)
+ public async Task GetAsync(string topicName, string? connectionName)
{
var admin = _connectionPool.GetAdministrationClient(connectionName);
await admin.SetupTopicAsync(topicName);
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj
index e12574e992..328023311c 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundJobs.Abstractions
diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj
index 8e79738248..2ef1330823 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundJobs.HangFire
diff --git a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj
index 47847d00c8..4860ca398b 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs.Quartz/Volo.Abp.BackgroundJobs.Quartz.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundJobs.Quartz
diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj
index c4675f6039..ac0473470a 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundJobs.RabbitMQ
diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
index 29a4ed2edc..b6a0ba00d1 100644
--- a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundJobs
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj
index bec3d235e6..752a3b35d3 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Hangfire/Volo.Abp.BackgroundWorkers.Hangfire.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundWorkers.Hangfire
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj
index 0f4d807456..a066795c3e 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj
+++ b/framework/src/Volo.Abp.BackgroundWorkers.Quartz/Volo.Abp.BackgroundWorkers.Quartz.csproj
@@ -5,7 +5,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundWorkers.Quartz
diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj b/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj
index 48e4b5fdf7..6c3078ccf7 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj
+++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BackgroundWorkers
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj
index c643a48feb..b391a5c7ef 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj
+++ b/framework/src/Volo.Abp.BlazoriseUI/Volo.Abp.BlazoriseUI.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
@@ -16,10 +16,10 @@
-
-
-
-
+
+
+
+
diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj
index db18335321..63490ca237 100644
--- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo.Abp.BlobStoring.Aliyun.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BlobStoring.Aliyun
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.BlobStoring.Aws/Volo.Abp.BlobStoring.Aws.csproj b/framework/src/Volo.Abp.BlobStoring.Aws/Volo.Abp.BlobStoring.Aws.csproj
index c89685a016..fb260147e1 100644
--- a/framework/src/Volo.Abp.BlobStoring.Aws/Volo.Abp.BlobStoring.Aws.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.Aws/Volo.Abp.BlobStoring.Aws.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
false
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo.Abp.BlobStoring.Azure.csproj b/framework/src/Volo.Abp.BlobStoring.Azure/Volo.Abp.BlobStoring.Azure.csproj
index 4f37df6d90..56bc02e89f 100644
--- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo.Abp.BlobStoring.Azure.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo.Abp.BlobStoring.Azure.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BlobStoring.Azure
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo.Abp.BlobStoring.FileSystem.csproj b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo.Abp.BlobStoring.FileSystem.csproj
index 33d860b325..0b73a6b802 100644
--- a/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo.Abp.BlobStoring.FileSystem.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.FileSystem/Volo.Abp.BlobStoring.FileSystem.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BlobStoring.FileSystem
@@ -18,7 +18,7 @@
-
+
diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
index ab6e32fe12..07d86e4a89 100644
--- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
+++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj
@@ -3,7 +3,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.BlobStoring.Minio
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs
index 627de6e5cf..5fa1ceb0ce 100644
--- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs
+++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs
@@ -3,6 +3,7 @@ using Minio.Exceptions;
using System;
using System.IO;
using System.Threading.Tasks;
+using Minio.DataModel.Args;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BlobStoring.Minio;
@@ -20,7 +21,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
BlobNormalizeNamingService = blobNormalizeNamingService;
}
- public override async Task SaveAsync(BlobProviderSaveArgs args)
+ public async override Task SaveAsync(BlobProviderSaveArgs args)
{
var blobName = MinioBlobNameCalculator.Calculate(args);
var configuration = args.Configuration.GetMinioConfiguration();
@@ -44,7 +45,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
.WithObjectSize(args.BlobStream.Length));
}
- public override async Task DeleteAsync(BlobProviderDeleteArgs args)
+ public async override Task DeleteAsync(BlobProviderDeleteArgs args)
{
var blobName = MinioBlobNameCalculator.Calculate(args);
var client = GetMinioClient(args);
@@ -60,7 +61,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
}
- public override async Task ExistsAsync(BlobProviderExistsArgs args)
+ public async override Task ExistsAsync(BlobProviderExistsArgs args)
{
var blobName = MinioBlobNameCalculator.Calculate(args);
var client = GetMinioClient(args);
@@ -69,7 +70,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
return await BlobExistsAsync(client, containerName, blobName);
}
- public override async Task GetOrNullAsync(BlobProviderGetArgs args)
+ public async override Task GetOrNullAsync(BlobProviderGetArgs args)
{
var blobName = MinioBlobNameCalculator.Calculate(args);
var client = GetMinioClient(args);
@@ -97,7 +98,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
return memoryStream;
}
- protected virtual MinioClient GetMinioClient(BlobProviderArgs args)
+ protected virtual IMinioClient GetMinioClient(BlobProviderArgs args)
{
var configuration = args.Configuration.GetMinioConfiguration();
@@ -113,7 +114,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
return client.Build();
}
- protected virtual async Task CreateBucketIfNotExists(MinioClient client, string containerName)
+ protected virtual async Task CreateBucketIfNotExists(IMinioClient client, string containerName)
{
if (!await client.BucketExistsAsync(new BucketExistsArgs().WithBucket(containerName)))
{
@@ -121,7 +122,7 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency
}
}
- protected virtual async Task BlobExistsAsync(MinioClient client, string containerName, string blobName)
+ protected virtual async Task BlobExistsAsync(IMinioClient client, string containerName, string blobName)
{
// Make sure Blob Container exists.
if (await client.BucketExistsAsync(new BucketExistsArgs().WithBucket(containerName)))
diff --git a/framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj b/framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj
index dc29c32a63..e2450b56b7 100644
--- a/framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj
+++ b/framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.BlobStoring
diff --git a/framework/src/Volo.Abp.Caching.StackExchangeRedis/Volo.Abp.Caching.StackExchangeRedis.csproj b/framework/src/Volo.Abp.Caching.StackExchangeRedis/Volo.Abp.Caching.StackExchangeRedis.csproj
index 4a7fa146a7..2e7683cee9 100644
--- a/framework/src/Volo.Abp.Caching.StackExchangeRedis/Volo.Abp.Caching.StackExchangeRedis.csproj
+++ b/framework/src/Volo.Abp.Caching.StackExchangeRedis/Volo.Abp.Caching.StackExchangeRedis.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Caching.StackExchangeRedis
@@ -21,8 +21,7 @@
-
-
+
diff --git a/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj b/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj
index adc2ef921d..d2eb13d6aa 100644
--- a/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj
+++ b/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Volo.Abp.Caching
Volo.Abp.Caching
@@ -16,7 +16,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
index d840a3bf69..7724e0b00e 100644
--- a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
+++ b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Castle.Core
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
index a6bb742585..15f7406f76 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
+++ b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
false
false
@@ -13,16 +13,17 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -30,6 +31,6 @@
-
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs
index da2bebbf94..1b6b56adab 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs
@@ -3,25 +3,25 @@ using System.Linq;
namespace Volo.Abp.Cli.Bundling;
-internal static class PathHelper
+static internal class PathHelper
{
- internal static string GetWebAssemblyFrameworkFolderPath(string projectDirectory, string frameworkVersion)
+ static internal string GetWebAssemblyFrameworkFolderPath(string projectDirectory, string frameworkVersion)
{
- return Path.Combine(projectDirectory, "bin", "Debug", frameworkVersion, "wwwroot", "_framework"); ;
+ return Path.Combine(projectDirectory, "bin", "Debug", frameworkVersion, "wwwroot", "_framework");
}
- internal static string GetWebAssemblyFilePath(string directory, string frameworkVersion, string projectFileName)
+ static internal string GetWebAssemblyFilePath(string directory, string frameworkVersion, string projectFileName)
{
- var outputDirectory = GetWebAssemblyFrameworkFolderPath(directory, frameworkVersion);
+ var outputDirectory = Path.Combine(directory, "bin", "Debug", frameworkVersion);
return Path.Combine(outputDirectory, projectFileName + ".dll");
}
- internal static string GetMauiBlazorAssemblyFilePath(string directory, string projectFileName)
+ static internal string GetMauiBlazorAssemblyFilePath(string directory, string projectFileName)
{
return Directory.GetFiles(directory, "*.dll", SearchOption.AllDirectories).First(f => !f.Contains("android") && f.EndsWith(projectFileName + ".dll"));
}
- internal static string GetWwwRootPath(string directory)
+ static internal string GetWwwRootPath(string directory)
{
return Path.Combine(directory, "wwwroot");
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
index 3ab75da1c0..c95e1854a7 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs
@@ -313,7 +313,7 @@ public class CliService : ITransientDependency
{
var toolPathArg = IsGlobalTool(toolPath) ? "-g" : $"--tool-path {toolPath}";
- Logger.LogWarning($"ABP CLI has a newer {updateChannel.ToString().ToLowerInvariant()} version {latestVersion}, please update to get the latest features and fixes.");
+ Logger.LogWarning($"A newer {updateChannel.ToString().ToLowerInvariant()} version of the ABP CLI is available: {latestVersion}.");
if (!string.IsNullOrWhiteSpace(message))
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
index 676b42081f..3c6e891d84 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
@@ -8,12 +8,15 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
+using StackExchange.Redis;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Bundling;
using Volo.Abp.Cli.Commands.Services;
using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Building;
+using Volo.Abp.Cli.ProjectBuilding.Events;
+using Volo.Abp.Cli.ProjectBuilding.Templates.App;
using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
@@ -89,6 +92,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
var projectArgs = await GetProjectBuildArgsAsync(commandLineArgs, template, projectName);
+ await CheckCreatingRequirements(projectArgs);
+
var result = await TemplateProjectBuilder.BuildAsync(
projectArgs
);
@@ -97,7 +102,10 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
Logger.LogInformation($"'{projectName}' has been successfully created to '{projectArgs.OutputFolder}'");
+ await CheckCreatedRequirements(projectArgs);
+
ConfigureNpmPackagesForTheme(projectArgs);
+ await CreateOpenIddictPfxFilesAsync(projectArgs);
await RunGraphBuildForMicroserviceServiceTemplate(projectArgs);
await CreateInitialMigrationsAsync(projectArgs);
@@ -119,6 +127,52 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
OpenRelatedWebPage(projectArgs, template, isTiered, commandLineArgs);
}
+ private Task CheckCreatingRequirements(ProjectBuildArgs projectArgs)
+ {
+ return Task.CompletedTask;
+ }
+
+ private async Task CheckCreatedRequirements(ProjectBuildArgs projectArgs)
+ {
+ var requirementWarningMessages = new List();
+
+ if (projectArgs.ExtraProperties.ContainsKey("PreRequirements:Redis"))
+ {
+ var isConnected = false;
+ try
+ {
+ var redis = await ConnectionMultiplexer.ConnectAsync("127.0.0.1", options => options.ConnectTimeout = 3000);
+ isConnected = redis.IsConnected;
+ }
+ catch (Exception e)
+ {
+ // ignored
+ }
+ finally
+ {
+ if (!isConnected)
+ {
+ requirementWarningMessages.Add("\t* Redis is not installed or not running on your computer.");
+ }
+ }
+ }
+
+ if (requirementWarningMessages.Any())
+ {
+ requirementWarningMessages.AddFirst("NOTICE: The following tools are required to run your solution:");
+
+ await EventBus.PublishAsync(new ProjectPostRequirementsCheckedEvent
+ {
+ Message = requirementWarningMessages.JoinAsString(Environment.NewLine)
+ }, false);
+
+ foreach (var error in requirementWarningMessages)
+ {
+ Logger.LogWarning(error);
+ }
+ }
+ }
+
public string GetUsageInfo()
{
var sb = new StringBuilder();
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
index 3e83cd818d..2ee023445c 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
@@ -16,6 +16,7 @@ using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Events;
+using Volo.Abp.Cli.ProjectBuilding.Templates;
using Volo.Abp.Cli.ProjectBuilding.Templates.App;
using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice;
using Volo.Abp.Cli.ProjectBuilding.Templates.Module;
@@ -449,7 +450,7 @@ public abstract class ProjectCreationCommandBase
var efCoreProjectPath = string.Empty;
bool isLayeredTemplate;
-
+ var isModuleTemplate = false;
switch (projectArgs.TemplateName)
{
case AppTemplate.TemplateName:
@@ -463,11 +464,16 @@ public abstract class ProjectCreationCommandBase
?? Directory.GetFiles(projectArgs.OutputFolder, "*.csproj", SearchOption.AllDirectories).FirstOrDefault();
isLayeredTemplate = false;
break;
+ case ModuleTemplate.TemplateName:
+ case ModuleProTemplate.TemplateName:
+ isModuleTemplate = true;
+ isLayeredTemplate = false;
+ break;
default:
return;
}
- if (string.IsNullOrWhiteSpace(efCoreProjectPath))
+ if (string.IsNullOrWhiteSpace(efCoreProjectPath) && !isModuleTemplate)
{
Logger.LogWarning("Couldn't find the project to create initial migrations!");
return;
@@ -478,7 +484,55 @@ public abstract class ProjectCreationCommandBase
Message = "Creating the initial DB migration"
}, false);
- await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(efCoreProjectPath), isLayeredTemplate);
+ if (!isModuleTemplate)
+ {
+ await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(efCoreProjectPath), isLayeredTemplate);
+ }
+ else
+ {
+ var hostProjectsWithEfCore = Directory.GetFiles(projectArgs.OutputFolder, "*.csproj", SearchOption.AllDirectories)
+ .Where(x => File.ReadAllText(x).Contains("Microsoft.EntityFrameworkCore.Tools"))
+ .ToList();
+ foreach (var project in hostProjectsWithEfCore)
+ {
+ await InitialMigrationCreator.CreateAsync(Path.GetDirectoryName(project));
+ }
+ }
+ }
+
+ protected Task CreateOpenIddictPfxFilesAsync(ProjectBuildArgs projectArgs)
+ {
+ if (!projectArgs.ExtraProperties.ContainsKey(nameof(RandomizeAuthServerPassPhraseStep)))
+ {
+ return Task.CompletedTask;
+ }
+
+ var module = projectArgs.ExtraProperties[nameof(RandomizeAuthServerPassPhraseStep)];
+ if (string.IsNullOrWhiteSpace(module))
+ {
+ return Task.CompletedTask;
+ }
+
+ var moduleDirectory = projectArgs.OutputFolder + module;
+ if (projectArgs.UiFramework != UiFramework.Angular)
+ {
+ moduleDirectory = moduleDirectory.Replace("/aspnet-core/", "/");
+ }
+
+ moduleDirectory = Path.GetDirectoryName(projectArgs.SolutionName.CompanyName == null
+ ? moduleDirectory.Replace("MyCompanyName.MyProjectName", projectArgs.SolutionName.ProjectName)
+ : moduleDirectory.Replace("MyCompanyName", projectArgs.SolutionName.CompanyName).Replace("MyProjectName", projectArgs.SolutionName.ProjectName));
+
+ if (Directory.Exists(moduleDirectory))
+ {
+ Logger.LogInformation($"Creating openiddict.pfx file on {moduleDirectory}");
+ CmdHelper.RunCmd($"dotnet dev-certs https -ep openiddict.pfx -p {RandomizeAuthServerPassPhraseStep.RandomOpenIddictPassword}", moduleDirectory);
+ }
+ else
+ {
+ Logger.LogWarning($"Couldn't find the module directory to create openiddict.pfx file: {moduleDirectory}");
+ }
+ return Task.CompletedTask;
}
protected async Task ConfigurePwaSupportForAngular(ProjectBuildArgs projectArgs)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SuiteAppSettingsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SuiteAppSettingsService.cs
index 7d2a61858a..54c81d977b 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SuiteAppSettingsService.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SuiteAppSettingsService.cs
@@ -92,7 +92,7 @@ public class SuiteAppSettingsService : ITransientDependency
"volo.abp.suite",
version,
"tools",
- "net7.0",
+ "net8.0",
"any",
"appsettings.json"
);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/AppModuleDatabaseManagementSystemChangeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/AppModuleDatabaseManagementSystemChangeStep.cs
new file mode 100644
index 0000000000..362fc14713
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/AppModuleDatabaseManagementSystemChangeStep.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Files;
+using Volo.Abp.Cli.ProjectBuilding.Templates.App;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps;
+
+public class AppModuleDatabaseManagementSystemChangeStep : ProjectBuildPipelineStep
+{
+ public override void Execute(ProjectBuildContext context)
+ {
+ switch (context.BuildArgs.DatabaseManagementSystem)
+ {
+ case DatabaseManagementSystem.MySQL:
+ ChangeEntityFrameworkCoreDependency(context, "Volo.Abp.EntityFrameworkCore.MySQL",
+ "Volo.Abp.EntityFrameworkCore.MySQL",
+ "AbpEntityFrameworkCoreMySQLModule");
+ AddMySqlServerVersion(context);
+ ChangeUseSqlServer(context, "UseMySQL", "UseMySql");
+ break;
+
+ case DatabaseManagementSystem.PostgreSQL:
+ ChangeEntityFrameworkCoreDependency(context, "Volo.Abp.EntityFrameworkCore.PostgreSql",
+ "Volo.Abp.EntityFrameworkCore.PostgreSql",
+ "AbpEntityFrameworkCorePostgreSqlModule");
+ ChangeUseSqlServer(context, "UseNpgsql");
+ break;
+
+ case DatabaseManagementSystem.Oracle:
+ ChangeEntityFrameworkCoreDependency(context, "Volo.Abp.EntityFrameworkCore.Oracle",
+ "Volo.Abp.EntityFrameworkCore.Oracle",
+ "AbpEntityFrameworkCoreOracleModule");
+ AdjustOracleDbContextOptionsBuilder(context);
+ ChangeUseSqlServer(context, "UseOracle");
+ break;
+
+ case DatabaseManagementSystem.OracleDevart:
+ ChangeEntityFrameworkCoreDependency(context, "Volo.Abp.EntityFrameworkCore.Oracle.Devart",
+ "Volo.Abp.EntityFrameworkCore.Oracle.Devart",
+ "AbpEntityFrameworkCoreOracleDevartModule");
+ AdjustOracleDbContextOptionsBuilder(context);
+ ChangeUseSqlServer(context, "UseOracle");
+ break;
+
+ case DatabaseManagementSystem.SQLite:
+ ChangeEntityFrameworkCoreDependency(context, "Volo.Abp.EntityFrameworkCore.Sqlite",
+ "Volo.Abp.EntityFrameworkCore.Sqlite",
+ "AbpEntityFrameworkCoreSqliteModule");
+ ChangeUseSqlServer(context, "UseSqlite");
+ break;
+
+ default:
+ return;
+ }
+ }
+
+ private void AdjustOracleDbContextOptionsBuilder(ProjectBuildContext context)
+ {
+ var dbContextFactoryFiles = context.Files.Where(f => f.Name.EndsWith("DbContextFactory.cs", StringComparison.OrdinalIgnoreCase));
+ foreach (var dbContextFactoryFile in dbContextFactoryFiles)
+ {
+ dbContextFactoryFile?.ReplaceText("new DbContextOptionsBuilder",
+ $"(DbContextOptionsBuilder<{context.BuildArgs.SolutionName.ProjectName}{(false ? "Migrations" : string.Empty)}DbContext>) new DbContextOptionsBuilder");
+ }
+ }
+
+ private void AddMySqlServerVersion(ProjectBuildContext context)
+ {
+ var dbContextFactoryFiles = context.Files.Where(f => f.Name.EndsWith("DbContextFactory.cs", StringComparison.OrdinalIgnoreCase));
+ foreach (var dbContextFactoryFile in dbContextFactoryFiles)
+ {
+ dbContextFactoryFile?.ReplaceText("configuration.GetConnectionString(\"Default\")", "configuration.GetConnectionString(\"Default\"), MySqlServerVersion.LatestSupportedServerVersion");
+ }
+ }
+
+ private void ChangeEntityFrameworkCoreDependency(ProjectBuildContext context, string newPackageName, string newModuleNamespace, string newModuleClass)
+ {
+ var efCoreProjectFiles = context.Files.Where(f => f.Name.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase));
+ foreach (var efCoreProjectFile in efCoreProjectFiles)
+ {
+ efCoreProjectFile?.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newPackageName);
+ }
+
+ var efCoreModuleClasses = context.Files.Where(f => f.Name.EndsWith("Module.cs", StringComparison.OrdinalIgnoreCase));
+ foreach (var efCoreModuleClass in efCoreModuleClasses)
+ {
+ efCoreModuleClass?.ReplaceText("Volo.Abp.EntityFrameworkCore.SqlServer", newModuleNamespace);
+ efCoreModuleClass?.ReplaceText("AbpEntityFrameworkCoreSqlServerModule", newModuleClass);
+ }
+ }
+
+ private void ChangeUseSqlServer(ProjectBuildContext context, string newUseMethodForEfModule, string newUseMethodForDbContext = null)
+ {
+ if (newUseMethodForDbContext == null)
+ {
+ newUseMethodForDbContext = newUseMethodForEfModule;
+ }
+
+ const string oldUseMethod = "UseSqlServer";
+
+ var efCoreModuleClasses = context.Files.Where(f => f.Name.EndsWith("Module.cs", StringComparison.OrdinalIgnoreCase));
+ foreach (var efCoreModuleClass in efCoreModuleClasses)
+ {
+ efCoreModuleClass.ReplaceText(oldUseMethod, newUseMethodForEfModule);
+ }
+
+ var dbContextFactoryFiles = context.Files.Where(f => f.Name.EndsWith("DbContextFactory.cs", StringComparison.OrdinalIgnoreCase));
+ foreach (var dbContextFactoryFile in dbContextFactoryFiles)
+ {
+ dbContextFactoryFile?.ReplaceText(oldUseMethod, newUseMethodForDbContext);
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
index 3cf039f5ae..8a59d2d8b1 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Templates.App;
+using Volo.Abp.Cli.ProjectBuilding.Templates;
namespace Volo.Abp.Cli.ProjectBuilding.Building;
@@ -29,7 +30,14 @@ public abstract class TemplateInfo
public virtual IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- return Array.Empty();
+ var steps = new List();
+ ConfigureCheckPreRequirements(context, steps);
+ return steps;
+ }
+
+ protected void ConfigureCheckPreRequirements(ProjectBuildContext context, List steps)
+ {
+ steps.Add(new CheckRedisPreRequirements());
}
public bool IsPro()
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
index d991c7101e..a453173095 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
@@ -43,6 +43,12 @@ public static class TemplateProjectBuildPipelineBuilder
pipeline.Steps.Add(new AppNoLayersDatabaseManagementSystemChangeStep()); // todo: move to custom steps?
}
+ if (context.Template.Name == ModuleTemplate.TemplateName ||
+ context.Template.Name == ModuleProTemplate.TemplateName)
+ {
+ pipeline.Steps.Add(new AppModuleDatabaseManagementSystemChangeStep()); // todo: move to custom steps?
+ }
+
if ((context.BuildArgs.UiFramework == UiFramework.Mvc || context.BuildArgs.UiFramework == UiFramework.Blazor || context.BuildArgs.UiFramework == UiFramework.BlazorServer)
&& context.BuildArgs.MobileApp == MobileApp.None && context.Template.Name != MicroserviceProTemplate.TemplateName
&& context.Template.Name != MicroserviceServiceProTemplate.TemplateName)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Events/ProjectPostRequirementsCheckedEvent.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Events/ProjectPostRequirementsCheckedEvent.cs
new file mode 100644
index 0000000000..1e20e9a3c9
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Events/ProjectPostRequirementsCheckedEvent.cs
@@ -0,0 +1,5 @@
+namespace Volo.Abp.Cli.ProjectBuilding.Events;
+public class ProjectPostRequirementsCheckedEvent
+{
+ public string Message { get; set; }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
index 5f65b87933..9417c46e12 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -20,7 +21,7 @@ public abstract class AppNoLayersTemplateBase : AppTemplateBase
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
switch (context.BuildArgs.DatabaseProvider)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
index e4b69c3810..0fecd09eb4 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
@@ -28,7 +28,7 @@ public abstract class AppTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
ConfigureTenantSchema(context, steps);
SwitchDatabaseProvider(context, steps);
@@ -166,7 +166,11 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveFolderStep("/angular"));
}
- if (context.BuildArgs.MobileApp != MobileApp.ReactNative)
+ if(context.BuildArgs.MobileApp == MobileApp.ReactNative)
+ {
+ context.Symbols.Add("mobile:react-native");
+ }
+ else
{
steps.Add(new RemoveFolderStep(MobileApp.ReactNative.GetFolderName().EnsureStartsWith('/')));
}
@@ -175,6 +179,7 @@ public abstract class AppTemplateBase : TemplateInfo
{
steps.Add(new MauiChangeApplicationIdGuidStep());
steps.Add(new MauiChangePortStep());
+ context.Symbols.Add("mobile:maui");
}
else
{
@@ -193,10 +198,12 @@ public abstract class AppTemplateBase : TemplateInfo
context.BuildArgs.ExtraProperties.ContainsKey("separate-auth-server"))
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public"));
+ context.Symbols.Add("ui:mvc-public-host");
}
else
{
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.Web.Public.Host"));
+ context.Symbols.Add("ui:mvc-public");
}
}
}
@@ -430,6 +437,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.HttpApi.Host"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
+ context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
}
@@ -455,6 +463,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
+ context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
@@ -548,6 +557,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
+ context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
@@ -585,6 +595,7 @@ public abstract class AppTemplateBase : TemplateInfo
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.IdentityServer"));
steps.Add(new RemoveProjectFromSolutionStep("MyCompanyName.MyProjectName.AuthServer"));
steps.Add(new TemplateProjectRenameStep("MyCompanyName.MyProjectName.HttpApi.HostWithIds", "MyCompanyName.MyProjectName.HttpApi.Host"));
+ context.Symbols.Add("HostWithIds");
steps.Add(new AppTemplateChangeConsoleTestClientPortSettingsStep("44305"));
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs
new file mode 100644
index 0000000000..aee6da8f99
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Building;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Templates;
+
+public class CheckRedisPreRequirements : ProjectBuildPipelineStep
+{
+ public override void Execute(ProjectBuildContext context)
+ {
+ var modules = context.Files.Where(f => f.Name.EndsWith("Module.cs", StringComparison.OrdinalIgnoreCase));
+ if (modules.Any(module => module.Content.Contains("Redis:Configuration")))
+ {
+ context.BuildArgs.ExtraProperties["PreRequirements:Redis"] = "true";
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
index 13674458ee..e5ce4a0f84 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -33,14 +34,14 @@ public abstract class MicroserviceServiceTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedUiProject(context, steps);
SetRandomPortForHostProject(context, steps);
RandomizeStringEncryption(context, steps);
RandomizeAuthServerPassPhrase(context, steps);
ChangeConnectionString(context, steps);
-
+
return steps;
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
index b8d320fb45..cb7722da10 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -19,7 +20,7 @@ public abstract class MicroserviceTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedProjects(context, steps);
RandomizeStringEncryption(context, steps);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
index 5229bb167f..60cf5e7442 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -21,11 +22,12 @@ public abstract class ModuleTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedProjects(context, steps);
RandomizeSslPorts(context, steps);
UpdateNuGetConfig(context, steps);
+ RemoveMigrations(context, steps);
ChangeConnectionString(context, steps);
CleanupFolderHierarchy(context, steps);
@@ -102,6 +104,17 @@ public abstract class ModuleTemplateBase : TemplateInfo
steps.Add(new UpdateNuGetConfigStep("/NuGet.Config"));
}
+ protected void RemoveMigrations(ProjectBuildContext context, List steps)
+ {
+ steps.Add(new RemoveFolderStep("/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/Migrations"));
+ steps.Add(new RemoveFolderStep("/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations"));
+ steps.Add(new RemoveFolderStep("/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations"));
+ if (context.BuildArgs.TemplateName == ModuleProTemplate.TemplateName)
+ {
+ steps.Add(new RemoveFolderStep("/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Migrations"));
+ }
+ }
+
private void ChangeConnectionString(ProjectBuildContext context, List steps)
{
if (context.BuildArgs.ConnectionString != null)
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RandomizeAuthServerPassPhraseStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RandomizeAuthServerPassPhraseStep.cs
index 7d42977c97..a41c870f41 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RandomizeAuthServerPassPhraseStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RandomizeAuthServerPassPhraseStep.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Cli.ProjectBuilding.Building;
@@ -6,16 +7,30 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates;
public class RandomizeAuthServerPassPhraseStep : ProjectBuildPipelineStep
{
- protected const string DefaultPassPhrase = "00000000-0000-0000-0000-000000000000";
+ private const string DefaultPassword = "00000000-0000-0000-0000-000000000000";
+ private const string KestrelCertificatesDefaultPassword = "Kestrel__Certificates__Default__Password=00000000-0000-0000-0000-000000000000";
+ private const string LocalhostPfx = "localhost.pfx -p 00000000-0000-0000-0000-000000000000";
+ private const string DotnetDevCerts = "openiddict.pfx -p 00000000-0000-0000-0000-000000000000";
+ private const string ProductionEncryptionAndSigningCertificate = "AddProductionEncryptionAndSigningCertificate(\"openiddict.pfx\", \"00000000-0000-0000-0000-000000000000\");";
+ private readonly static string RandomPassword = Guid.NewGuid().ToString("D");
+ public readonly static string RandomOpenIddictPassword = Guid.NewGuid().ToString("D");
public override void Execute(ProjectBuildContext context)
{
var files = context.Files
.Where(x => !x.IsDirectory)
- .Where(x => x.Content.IndexOf(DefaultPassPhrase, StringComparison.InvariantCultureIgnoreCase) >= 0)
+ .Where(x => x.Name.EndsWith(".cs") ||
+ x.Name.EndsWith(".json") ||
+ x.Name.EndsWith(".yml") ||
+ x.Name.EndsWith(".yaml") ||
+ x.Name.EndsWith(".md") ||
+ x.Name.EndsWith(".ps1") ||
+ x.Name.EndsWith(".sh") ||
+ x.Name.Contains("Dockerfile"))
+ .Where(x => x.Content.IndexOf(DefaultPassword, StringComparison.InvariantCultureIgnoreCase) >= 0)
.ToList();
- var randomPassPhrase = Guid.NewGuid().ToString("D");
+ string module = null;
foreach (var file in files)
{
file.NormalizeLineEndings();
@@ -23,13 +38,43 @@ public class RandomizeAuthServerPassPhraseStep : ProjectBuildPipelineStep
var lines = file.GetLines();
for (var i = 0; i < lines.Length; i++)
{
- if (lines[i].Contains(DefaultPassPhrase))
+ if (lines[i].Contains(KestrelCertificatesDefaultPassword))
{
- lines[i] = lines[i].Replace(DefaultPassPhrase, randomPassPhrase);
+ lines[i] = lines[i].Replace(KestrelCertificatesDefaultPassword,
+ KestrelCertificatesDefaultPassword.Replace(DefaultPassword,
+ RandomPassword));
+ }
+
+ if (lines[i].Contains(LocalhostPfx))
+ {
+ lines[i] = lines[i].Replace(LocalhostPfx,
+ LocalhostPfx.Replace(DefaultPassword,
+ RandomPassword));
+ }
+
+ if (lines[i].Contains(DotnetDevCerts))
+ {
+ lines[i] = lines[i].Replace(DotnetDevCerts,
+ DotnetDevCerts.Replace(DefaultPassword,
+ RandomOpenIddictPassword));
+ }
+
+ if (lines[i].Contains(ProductionEncryptionAndSigningCertificate))
+ {
+ lines[i] = lines[i].Replace(ProductionEncryptionAndSigningCertificate,
+ ProductionEncryptionAndSigningCertificate.Replace(DefaultPassword,
+ RandomOpenIddictPassword));
+
+ module = file.Name;
}
}
file.SetLines(lines);
}
+
+ if (!module.IsNullOrWhiteSpace())
+ {
+ context.BuildArgs.ExtraProperties[nameof(RandomizeAuthServerPassPhraseStep)] = module;
+ }
}
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
index 535b68ef59..ba85c48aeb 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
@@ -22,6 +22,7 @@ using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Json;
+using System.Text.RegularExpressions;
namespace Volo.Abp.Cli.ProjectModification;
@@ -114,12 +115,11 @@ public class SolutionModuleAdder : ITransientDependency
var projectFiles = ProjectFinder.GetProjectFiles(solutionFile);
await AddNugetAndNpmReferences(module, projectFiles, !(newTemplate || newProTemplate));
-
+
var modulesFolderInSolution = Path.Combine(Path.GetDirectoryName(solutionFile), "modules");
if (withSourceCode || newTemplate || newProTemplate)
{
-
await PublishEventAsync(5, $"Downloading source code of {moduleName}");
await DownloadSourceCodesToSolutionFolder(module, modulesFolderInSolution, version, newTemplate, newProTemplate);
@@ -147,6 +147,8 @@ public class SolutionModuleAdder : ITransientDependency
else
{
await AddAngularPackages(solutionFile, module);
+
+ await TryConfigureModuleConfigurationsForAngular(solutionFile, module);
}
await RunBundleForBlazorAsync(projectFiles, module);
@@ -167,10 +169,83 @@ public class SolutionModuleAdder : ITransientDependency
return module;
}
+ private async Task TryConfigureModuleConfigurationsForAngular(string solutionFilePath, ModuleWithMastersInfo module)
+ {
+ var angularPath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(solutionFilePath)), "angular");
+
+ if (!Directory.Exists(angularPath))
+ {
+ return;
+ }
+
+ var angularPackages = module.NpmPackages?
+ .Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Angular))
+ .ToList();
+
+ if (!angularPackages.Any())
+ {
+ return;
+ }
+
+ await PublishEventAsync(6, "Configuring angular projects...");
+
+ var moduleName = module.Name.Split('.').Last();
+
+ ConfigureAngularPackagesForAppModuleFile(angularPath, angularPackages, moduleName);
+
+ ConfigureAngularPackagesForAppRoutingModuleFile(angularPath, angularPackages, moduleName);
+ }
+
+ private void ConfigureAngularPackagesForAppModuleFile(string angularPath, List angularPackages, string moduleName)
+ {
+ var appModulePath = Path.Combine(angularPath, "src", "app", "app.module.ts");
+ if (!File.Exists(appModulePath))
+ {
+ return;
+ }
+
+ var appModuleFileContent = File.ReadAllText(appModulePath);
+
+ foreach (var angularPackage in angularPackages)
+ {
+ var moduleNameAsConfigPath = angularPackage.Name.EnsureStartsWith('@').EnsureEndsWith('/') + "config";
+
+ appModuleFileContent = "import { " + moduleName + "ConfigModule } from '" + moduleNameAsConfigPath + "';" + Environment.NewLine + appModuleFileContent;
+ appModuleFileContent = Regex.Replace(appModuleFileContent, "imports\\s*:\\s*\\[",
+ "imports: [" + Environment.NewLine +
+ " " + moduleName + "ConfigModule.forRoot(),");
+ }
+
+ File.WriteAllText(appModulePath, appModuleFileContent);
+ }
+
+ private void ConfigureAngularPackagesForAppRoutingModuleFile(string angularPath, List angularPackages, string moduleName)
+ {
+ var appRoutingModulePath = Path.Combine(angularPath, "src", "app", "app-routing.module.ts");
+ if (!File.Exists(appRoutingModulePath))
+ {
+ return;
+ }
+
+ var appRoutingModuleFileContent = File.ReadAllText(appRoutingModulePath);
+
+ foreach (var angularPackage in angularPackages)
+ {
+ appRoutingModuleFileContent = Regex.Replace(appRoutingModuleFileContent, "Routes\\s*=\\s*\\[",
+ "Routes = [" + Environment.NewLine +
+ " " + "{" + Environment.NewLine +
+ " " + "path: '" + moduleName.ToLower() + "'," + Environment.NewLine +
+ " " + "loadChildren: () => " + $"import('{angularPackage.Name.EnsureStartsWith('@')}').then(m => m.{moduleName}Module.forLazy())," + Environment.NewLine +
+ " " + "},");
+ }
+
+ File.WriteAllText(appRoutingModulePath, appRoutingModuleFileContent);
+ }
+
private async Task SetLeptonXAbpVersionsAsync(string solutionFile, string combine)
{
var abpVersion = SolutionPackageVersionFinder.FindByCsprojVersion(solutionFile);
-
+
var projects = Directory.GetFiles(Path.GetDirectoryName(solutionFile)!, "*.csproj", SearchOption.AllDirectories);
foreach (var project in projects)
@@ -183,7 +258,8 @@ public class SolutionModuleAdder : ITransientDependency
private async Task PublishEventAsync(int currentStep, string message)
{
- await LocalEventBus.PublishAsync(new ModuleInstallingProgressEvent {
+ await LocalEventBus.PublishAsync(new ModuleInstallingProgressEvent
+ {
CurrentStep = currentStep,
Message = message
}, false);
@@ -562,7 +638,7 @@ public class SolutionModuleAdder : ITransientDependency
if (webPackagesWillBeAddedToBlazorServerProject)
{
- if ( nugetTarget == NuGetPackageTarget.Web)
+ if (nugetTarget == NuGetPackageTarget.Web)
{
nugetTarget = NuGetPackageTarget.BlazorServer;
}
@@ -636,7 +712,7 @@ public class SolutionModuleAdder : ITransientDependency
}
var dbMigrationsProject = projectFiles.FirstOrDefault(p => p.EndsWith(".DbMigrations.csproj"))
- ?? projectFiles.FirstOrDefault(p => p.EndsWith(".EntityFrameworkCore.csproj")) ;
+ ?? projectFiles.FirstOrDefault(p => p.EndsWith(".EntityFrameworkCore.csproj"));
if (dbMigrationsProject == null)
{
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 ddc2928447..71b28f9084 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
@@ -232,7 +232,14 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency
string latestVersion;
if(isLeptonXPackage)
{
- latestVersion = (await _packageVersionCheckerService.GetLatestVersionOrNullAsync(packageId, includeNightlyPreviews, includeReleaseCandidates))?.Version?.ToString();
+ var leptonXPackageName = packageId;
+ if(includeNightlyPreviews)
+ {
+ //use LeptonX Lite package as the package name to be able to get the package version from the 'abp-nightly' feed.
+ leptonXPackageName = "Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite";
+ }
+
+ latestVersion = (await _packageVersionCheckerService.GetLatestVersionOrNullAsync(leptonXPackageName, includeNightlyPreviews, includeReleaseCandidates))?.Version?.ToString();
}
else
{
diff --git a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
index d7a181025a..2bc7af750a 100644
--- a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
+++ b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
@@ -7,7 +7,7 @@
Exe
enable
Nullable
- net7.0
+ net8.0
true
abp
@@ -15,13 +15,12 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationExtensions.cs
new file mode 100644
index 0000000000..6e0a14fd94
--- /dev/null
+++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/AbpConfigurationExtensions.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.Extensions.Hosting;
+
+namespace Microsoft.Extensions.Configuration;
+
+public static class AbpConfigurationExtensions
+{
+ public static IConfigurationBuilder AddAppSettingsSecretsJson(
+ this IConfigurationBuilder builder,
+ bool optional = true,
+ bool reloadOnChange = true,
+ string path = AbpHostingHostBuilderExtensions.AppSettingsSecretJsonPath)
+ {
+ return builder.AddJsonFile(path: path, optional: optional, reloadOnChange: reloadOnChange);
+ }
+}
diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs
index f31feff873..88bf37982e 100644
--- a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs
+++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs
@@ -18,11 +18,12 @@ public static class ConfigurationHelper
var builder = new ConfigurationBuilder()
.SetBasePath(options.BasePath!)
- .AddJsonFile(options.FileName + ".json", optional: options.Optional, reloadOnChange: options.ReloadOnChange);
+ .AddJsonFile(options.FileName + ".json", optional: options.Optional, reloadOnChange: options.ReloadOnChange)
+ .AddJsonFile(options.FileName + ".secrets.json", optional: true, reloadOnChange: options.ReloadOnChange);
if (!options.EnvironmentName.IsNullOrEmpty())
{
- builder = builder.AddJsonFile($"{options.FileName}.{options.EnvironmentName}.json", optional: options.Optional, reloadOnChange: options.ReloadOnChange);
+ builder = builder.AddJsonFile($"{options.FileName}.{options.EnvironmentName}.json", optional: true, reloadOnChange: options.ReloadOnChange);
}
if (options.EnvironmentName == "Development")
diff --git a/framework/src/Volo.Abp.Core/Microsoft/Extensions/Hosting/AbpHostExtensions.cs b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Hosting/AbpHostExtensions.cs
new file mode 100644
index 0000000000..12c03e14f5
--- /dev/null
+++ b/framework/src/Volo.Abp.Core/Microsoft/Extensions/Hosting/AbpHostExtensions.cs
@@ -0,0 +1,20 @@
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp;
+using Volo.Abp.Threading;
+
+namespace Microsoft.Extensions.Hosting;
+
+public static class AbpHostExtensions
+{
+ public static async Task InitializeAsync(this IHost host)
+ {
+ var application = host.Services.GetRequiredService();
+ var applicationLifetime = host.Services.GetRequiredService();
+
+ applicationLifetime.ApplicationStopping.Register(() => AsyncHelper.RunSync(() => application.ShutdownAsync()));
+ applicationLifetime.ApplicationStopped.Register(() => application.Dispose());
+
+ await application.InitializeAsync(host.Services);
+ }
+}
diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
index c7153264ae..3d44fa988a 100644
--- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
+++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs
@@ -47,7 +47,7 @@ public static class AbpStringExtensions
/// Indicates whether this string is null or an System.String.Empty string.
///
[ContractAnnotation("str:null => true")]
- public static bool IsNullOrEmpty(this string? str)
+ public static bool IsNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullWhen(false)]this string? str)
{
return string.IsNullOrEmpty(str);
}
@@ -56,7 +56,7 @@ public static class AbpStringExtensions
/// indicates whether this string is null, empty, or consists only of white-space characters.
///
[ContractAnnotation("str:null => true")]
- public static bool IsNullOrWhiteSpace(this string? str)
+ public static bool IsNullOrWhiteSpace([System.Diagnostics.CodeAnalysis.NotNullWhen(false)]this string? str)
{
return string.IsNullOrWhiteSpace(str);
}
diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
index c250d07eee..042cbd270c 100644
--- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
+++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Core
@@ -16,25 +16,31 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs
index c4daaed745..f4adefd9c3 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs
@@ -69,7 +69,7 @@ public static class FileHelper
/// A string containing all lines of the file.
public static async Task ReadAllBytesAsync(string path)
{
- using (var stream = File.Open(path, FileMode.Open))
+ using (var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var result = new byte[stream.Length];
await stream.ReadAsync(result, 0, (int)stream.Length);
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpOptionsFactory.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpOptionsFactory.cs
index 1f86e73eb3..0be4b54956 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpOptionsFactory.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Options/AbpOptionsFactory.cs
@@ -1,20 +1,21 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using Microsoft.Extensions.Options;
namespace Volo.Abp.Options;
//TODO: Derive from OptionsFactory when this is released: https://github.com/aspnet/Options/pull/258 (or completely remove this!)
-// https://github.com/dotnet/runtime/blob/master/src/libraries/Microsoft.Extensions.Options/src/OptionsFactory.cs
+// https://github.com/dotnet/runtime/blob/release/8.0-rc1/src/libraries/Microsoft.Extensions.Options/src/OptionsFactory.cs#L9
public class AbpOptionsFactory : IOptionsFactory where TOptions : class, new()
{
- private readonly IEnumerable> _setups;
- private readonly IEnumerable> _postConfigures;
- private readonly IEnumerable>? _validations;
+ private readonly IConfigureOptions[] _setups;
+ private readonly IPostConfigureOptions[] _postConfigures;
+ private readonly IValidateOptions[] _validations;
public AbpOptionsFactory(
IEnumerable> setups,
IEnumerable> postConfigures)
- : this(setups, postConfigures, validations: null)
+ : this(setups, postConfigures, validations: Array.Empty>())
{
}
@@ -22,16 +23,16 @@ public class AbpOptionsFactory : IOptionsFactory where TOpti
public AbpOptionsFactory(
IEnumerable> setups,
IEnumerable> postConfigures,
- IEnumerable>? validations)
+ IEnumerable> validations)
{
- _setups = setups;
- _postConfigures = postConfigures;
- _validations = validations;
+ _setups = setups as IConfigureOptions[] ?? new List>(setups).ToArray();
+ _postConfigures = postConfigures as IPostConfigureOptions[] ?? new List>(postConfigures).ToArray();
+ _validations = validations as IValidateOptions[] ?? new List>(validations).ToArray();
}
public virtual TOptions Create(string name)
{
- var options = new TOptions();
+ var options = CreateInstance(name);
ConfigureOptions(name, options);
PostConfigureOptions(name, options);
@@ -65,21 +66,28 @@ public class AbpOptionsFactory : IOptionsFactory where TOpti
protected virtual void ValidateOptions(string name, TOptions options)
{
- if (_validations != null)
+ if (_validations.Length <= 0)
{
- var failures = new List();
- foreach (var validate in _validations)
- {
- var result = validate.Validate(name, options);
- if (result.Failed)
- {
- failures.AddRange(result.Failures);
- }
- }
- if (failures.Count > 0)
+ return;
+ }
+
+ var failures = new List();
+ foreach (var validate in _validations)
+ {
+ var result = validate.Validate(name, options);
+ if (result.Failed)
{
- throw new OptionsValidationException(name, typeof(TOptions), failures);
+ failures.AddRange(result.Failures);
}
}
+ if (failures.Count > 0)
+ {
+ throw new OptionsValidationException(name, typeof(TOptions), failures);
+ }
+ }
+
+ protected virtual TOptions CreateInstance(string name)
+ {
+ return Activator.CreateInstance();
}
}
diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
index b439a5a07b..1efa6c4f29 100644
--- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
+++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
@@ -257,6 +257,14 @@ public static class TypeHelper
{
return "string";
}
+ else if (type.FullName == "System.DateOnly")
+ {
+ return "string";
+ }
+ else if (type.FullName == "System.TimeOnly")
+ {
+ return "string";
+ }
else if (type == typeof(TimeSpan))
{
return "string";
diff --git a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj
index e42eca0d2b..bb40ed79ce 100644
--- a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj
+++ b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
Volo.Abp.Dapper
@@ -21,7 +21,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj b/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj
index 1b952e34cc..92377ef51a 100644
--- a/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj
+++ b/framework/src/Volo.Abp.Dapr/Volo.Abp.Dapr.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
@@ -15,7 +15,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj
index 751042e62c..015bf1abdc 100644
--- a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj
+++ b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Data
diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
index 891a4b8a33..97a227d304 100644
--- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
+++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Ddd.Application.Contracts
diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj
index 03351adb7f..c60291db76 100644
--- a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj
+++ b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Ddd.Application
diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
index 8602792701..3791c4202f 100644
--- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
+++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
@@ -132,7 +132,7 @@ public abstract class AbstractKeyReadOnlyAppService ((IHasCreationTime)e).CreationTime);
}
- throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");
+ throw new AbpException("No sorting specified but this query requires sorting. Override the ApplySorting or the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");
}
///
diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs
index ba82e5bdc2..4eb285df04 100644
--- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs
+++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs
@@ -1,4 +1,3 @@
-using JetBrains.Annotations;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
@@ -41,7 +40,7 @@ public abstract class ApplicationService :
[Obsolete("Use LazyServiceProvider instead.")]
public IServiceProvider ServiceProvider { get; set; } = default!;
- public static string[] CommonPostfixes { get; set; } = { "AppService", "ApplicationService", "IntService", "IntegrationService", "Service" };
+ public static string[] CommonPostfixes { get; set; } = { "AppService", "ApplicationService", "Service" };
public List AppliedCrossCuttingConcerns { get; } = new();
diff --git a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj
index efc808fdc7..d4097ad172 100644
--- a/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj
+++ b/framework/src/Volo.Abp.Ddd.Domain.Shared/Volo.Abp.Ddd.Domain.Shared.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Ddd.Domain.Shared
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
index c63a5442c7..a877c673f1 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Microsoft/Extensions/DependencyInjection/ServiceCollectionRepositoryExtensions.cs
@@ -1,5 +1,6 @@
using System;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
@@ -17,13 +18,13 @@ public static class ServiceCollectionRepositoryExtensions
var readOnlyBasicRepositoryInterface = typeof(IReadOnlyBasicRepository<>).MakeGenericType(entityType);
if (readOnlyBasicRepositoryInterface.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyBasicRepositoryInterface, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyBasicRepositoryInterface, repositoryImplementationType, replaceExisting, true);
//IReadOnlyRepository
var readOnlyRepositoryInterface = typeof(IReadOnlyRepository<>).MakeGenericType(entityType);
if (readOnlyRepositoryInterface.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyRepositoryInterface, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyRepositoryInterface, repositoryImplementationType, replaceExisting, true);
}
//IBasicRepository
@@ -48,13 +49,13 @@ public static class ServiceCollectionRepositoryExtensions
var readOnlyBasicRepositoryInterfaceWithPk = typeof(IReadOnlyBasicRepository<,>).MakeGenericType(entityType, primaryKeyType);
if (readOnlyBasicRepositoryInterfaceWithPk.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyBasicRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyBasicRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting, true);
//IReadOnlyRepository
var readOnlyRepositoryInterfaceWithPk = typeof(IReadOnlyRepository<,>).MakeGenericType(entityType, primaryKeyType);
if (readOnlyRepositoryInterfaceWithPk.IsAssignableFrom(repositoryImplementationType))
{
- RegisterService(services, readOnlyRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting);
+ RegisterService(services, readOnlyRepositoryInterfaceWithPk, repositoryImplementationType, replaceExisting, true);
}
//IBasicRepository
@@ -80,15 +81,33 @@ public static class ServiceCollectionRepositoryExtensions
IServiceCollection services,
Type serviceType,
Type implementationType,
- bool replaceExisting)
+ bool replaceExisting,
+ bool isReadOnlyRepository = false)
{
+ ServiceDescriptor descriptor;
+
+ if (isReadOnlyRepository)
+ {
+ services.TryAddTransient(implementationType);
+ descriptor = ServiceDescriptor.Transient(serviceType, provider =>
+ {
+ var repository = provider.GetRequiredService(implementationType);
+ ObjectHelper.TrySetProperty(repository.As(), x => x.IsChangeTrackingEnabled, _ => false);
+ return repository;
+ });
+ }
+ else
+ {
+ descriptor = ServiceDescriptor.Transient(serviceType, implementationType);
+ }
+
if (replaceExisting)
{
- services.Replace(ServiceDescriptor.Transient(serviceType, implementationType));
+ services.Replace(descriptor);
}
else
{
- services.TryAddTransient(serviceType, implementationType);
+ services.TryAdd(descriptor);
}
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
index 5130c57f12..692a6e10b2 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Ddd.Domain
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
index 536e31e51f..de6632704d 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
@@ -2,6 +2,7 @@
using Volo.Abp.Auditing;
using Volo.Abp.Caching;
using Volo.Abp.Data;
+using Volo.Abp.Domain.ChangeTracking;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus;
using Volo.Abp.ExceptionHandling;
@@ -30,5 +31,6 @@ public class AbpDddDomainModule : AbpModule
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddConventionalRegistrar(new AbpRepositoryConventionalRegistrar());
+ context.Services.OnRegistered(ChangeTrackingInterceptorRegistrar.RegisterIfNeeded);
}
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingHelper.cs
new file mode 100644
index 0000000000..d2235afd22
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingHelper.cs
@@ -0,0 +1,53 @@
+using System.Linq;
+using System.Reflection;
+using JetBrains.Annotations;
+using Volo.Abp.Domain.Repositories;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+public static class ChangeTrackingHelper
+{
+ public static bool IsEntityChangeTrackingType(TypeInfo implementationType)
+ {
+ return HasEntityChangeTrackingAttribute(implementationType) || AnyMethodHasEntityChangeTrackingAttribute(implementationType);
+ }
+
+ public static bool IsEntityChangeTrackingMethod([NotNull] MethodInfo methodInfo, out EntityChangeTrackingAttribute? entityChangeTrackingAttribute)
+ {
+ Check.NotNull(methodInfo, nameof(methodInfo));
+
+ //Method declaration
+ var attrs = methodInfo.GetCustomAttributes(true).OfType().ToArray();
+ if (attrs.Any())
+ {
+ entityChangeTrackingAttribute = attrs.First();
+ return true;
+ }
+
+ if (methodInfo.DeclaringType != null)
+ {
+ //Class declaration
+ attrs = methodInfo.DeclaringType.GetTypeInfo().GetCustomAttributes(true).OfType().ToArray();
+ if (attrs.Any())
+ {
+ entityChangeTrackingAttribute = attrs.First();
+ return true;
+ }
+ }
+
+ entityChangeTrackingAttribute = null;
+ return false;
+ }
+
+ private static bool AnyMethodHasEntityChangeTrackingAttribute(TypeInfo implementationType)
+ {
+ return implementationType
+ .GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
+ .Any(HasEntityChangeTrackingAttribute);
+ }
+
+ private static bool HasEntityChangeTrackingAttribute(MemberInfo memberInfo)
+ {
+ return memberInfo.IsDefined(typeof(EntityChangeTrackingAttribute), true);
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptor.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptor.cs
new file mode 100644
index 0000000000..307e2dee6a
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptor.cs
@@ -0,0 +1,30 @@
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+public class ChangeTrackingInterceptor : AbpInterceptor, ITransientDependency
+{
+ private readonly IEntityChangeTrackingProvider _entityChangeTrackingProvider;
+
+ public ChangeTrackingInterceptor(IEntityChangeTrackingProvider entityChangeTrackingProvider)
+ {
+ _entityChangeTrackingProvider = entityChangeTrackingProvider;
+ }
+
+ public async override Task InterceptAsync(IAbpMethodInvocation invocation)
+ {
+ if (!ChangeTrackingHelper.IsEntityChangeTrackingMethod(invocation.Method, out var changeTrackingAttribute))
+ {
+ await invocation.ProceedAsync();
+ return;
+ }
+
+ using (_entityChangeTrackingProvider.Change(changeTrackingAttribute?.IsEnabled))
+ {
+ await invocation.ProceedAsync();
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptorRegistrar.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptorRegistrar.cs
new file mode 100644
index 0000000000..0249c570dd
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/ChangeTrackingInterceptorRegistrar.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Reflection;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.DynamicProxy;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+public class ChangeTrackingInterceptorRegistrar
+{
+ public static void RegisterIfNeeded(IOnServiceRegistredContext context)
+ {
+ if (ShouldIntercept(context.ImplementationType))
+ {
+ context.Interceptors.TryAdd();
+ }
+ }
+
+ private static bool ShouldIntercept(Type type)
+ {
+ return !DynamicProxyIgnoreTypes.Contains(type) && ChangeTrackingHelper.IsEntityChangeTrackingType(type.GetTypeInfo());
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/DisableEntityChangeTrackingAttribute.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/DisableEntityChangeTrackingAttribute.cs
new file mode 100644
index 0000000000..98011bda5f
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/DisableEntityChangeTrackingAttribute.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+///
+/// Ensures that the change tracking in enabled for the given method or class.
+///
+[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
+public class DisableEntityChangeTrackingAttribute : EntityChangeTrackingAttribute
+{
+ public DisableEntityChangeTrackingAttribute()
+ : base(false)
+ {
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EnableEntityChangeTrackingAttribute.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EnableEntityChangeTrackingAttribute.cs
new file mode 100644
index 0000000000..542b60cd74
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EnableEntityChangeTrackingAttribute.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+///
+/// Ensures that the change tracking in enabled for the given method or class.
+///
+[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
+public class EnableEntityChangeTrackingAttribute : EntityChangeTrackingAttribute
+{
+ public EnableEntityChangeTrackingAttribute()
+ : base(true)
+ {
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EntityChangeTrackingAttribute.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EntityChangeTrackingAttribute.cs
new file mode 100644
index 0000000000..3446a49354
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/ChangeTracking/EntityChangeTrackingAttribute.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace Volo.Abp.Domain.ChangeTracking;
+
+[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
+public abstract class EntityChangeTrackingAttribute : Attribute
+{
+ public virtual bool IsEnabled { get; set; }
+
+ public EntityChangeTrackingAttribute(bool isEnabled)
+ {
+ IsEnabled = isEnabled;
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
index 0d86045eea..cd85acce50 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs
@@ -4,6 +4,8 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
@@ -34,6 +36,14 @@ public abstract class BasicRepositoryBase :
public ICancellationTokenProvider CancellationTokenProvider => LazyServiceProvider.LazyGetService(NullCancellationTokenProvider.Instance);
+ public ILoggerFactory? LoggerFactory => LazyServiceProvider.LazyGetService();
+
+ public ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance);
+
+ public IEntityChangeTrackingProvider EntityChangeTrackingProvider => LazyServiceProvider.LazyGetRequiredService();
+
+ public bool? IsChangeTrackingEnabled { get; protected set; }
+
protected BasicRepositoryBase()
{
@@ -106,6 +116,24 @@ public abstract class BasicRepositoryBase :
{
return CancellationTokenProvider.FallbackToProvider(preferredValue);
}
+
+ protected virtual bool ShouldTrackingEntityChange()
+ {
+ // If IsChangeTrackingEnabled is set, it has the highest priority. This generally means the repository is read-only.
+ if (IsChangeTrackingEnabled.HasValue)
+ {
+ return IsChangeTrackingEnabled.Value;
+ }
+
+ // If Interface/Class/Method has Enable/DisableEntityChangeTrackingAttribute, it has the second highest priority.
+ if (EntityChangeTrackingProvider.Enabled.HasValue)
+ {
+ return EntityChangeTrackingProvider.Enabled.Value;
+ }
+
+ // Default behavior is tracking entity change.
+ return true;
+ }
}
public abstract class BasicRepositoryBase : BasicRepositoryBase, IBasicRepository
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/EntityChangeTrackingProvider.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/EntityChangeTrackingProvider.cs
new file mode 100644
index 0000000000..19c10e9a3f
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/EntityChangeTrackingProvider.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Threading;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.Domain.Repositories;
+
+public class EntityChangeTrackingProvider : IEntityChangeTrackingProvider, ISingletonDependency
+{
+ public bool? Enabled => _current.Value;
+
+ private readonly AsyncLocal _current = new AsyncLocal();
+
+ public IDisposable Change(bool? enabled)
+ {
+ var previousValue = Enabled;
+ _current.Value = enabled;
+ return new DisposeAction(() => _current.Value = previousValue);
+ }
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IEntityChangeTrackingProvider.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IEntityChangeTrackingProvider.cs
new file mode 100644
index 0000000000..f1db1584fa
--- /dev/null
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IEntityChangeTrackingProvider.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Volo.Abp.Domain.Repositories;
+
+public interface IEntityChangeTrackingProvider
+{
+ bool? Enabled { get; }
+
+ IDisposable Change(bool? enabled);
+}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
index 3c7ae81875..dc39255b25 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/IRepository.cs
@@ -12,7 +12,7 @@ namespace Volo.Abp.Domain.Repositories;
///
public interface IRepository
{
-
+ bool? IsChangeTrackingEnabled { get; }
}
public interface IRepository : IReadOnlyRepository, IBasicRepository
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs
index 1c51954f57..08c1f2556f 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs
@@ -7,8 +7,8 @@ using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories;
-public interface ISupportsExplicitLoading
- where TEntity : class, IEntity
+public interface ISupportsExplicitLoading
+ where TEntity : class, IEntity
{
Task EnsureCollectionLoadedAsync(
TEntity entity,
@@ -18,7 +18,7 @@ public interface ISupportsExplicitLoading
Task EnsurePropertyLoadedAsync(
TEntity entity,
- Expression> propertyExpression,
+ Expression> propertyExpression,
CancellationToken cancellationToken)
where TProperty : class;
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs
index cbebf62196..3c43798c38 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs
@@ -15,16 +15,16 @@ namespace Volo.Abp.Domain.Repositories;
public static class RepositoryExtensions
{
- public async static Task EnsureCollectionLoadedAsync(
- this IBasicRepository repository,
+ public async static Task EnsureCollectionLoadedAsync(
+ this IBasicRepository repository,
TEntity entity,
Expression>> propertyExpression,
CancellationToken cancellationToken = default
)
- where TEntity : class, IEntity
+ where TEntity : class, IEntity
where TProperty : class
{
- var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading;
+ var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading;
if (repo != null)
{
await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken);
@@ -34,13 +34,13 @@ public static class RepositoryExtensions
public async static Task EnsurePropertyLoadedAsync(
this IBasicRepository repository,
TEntity entity,
- Expression> propertyExpression,
+ Expression> propertyExpression,
CancellationToken cancellationToken = default
)
where TEntity : class, IEntity
where TProperty : class
{
- var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading;
+ var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading;
if (repo != null)
{
await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken);
@@ -60,12 +60,12 @@ public static class RepositoryExtensions
}
}
- public async static Task EnsureExistsAsync(
- this IRepository repository,
+ public async static Task EnsureExistsAsync(
+ this IRepository repository,
Expression> expression,
CancellationToken cancellationToken = default
)
- where TEntity : class, IEntity
+ where TEntity : class, IEntity
{
if (!await repository.AnyAsync(expression, cancellationToken))
{
@@ -145,6 +145,40 @@ public static class RepositoryExtensions
}
}
+ ///
+ /// Disables change tracking mechanism for the given repository.
+ ///
+ /// A repository object
+ ///
+ /// A disposable object. Dispose it to restore change tracking mechanism back to its previous state.
+ ///
+ public static IDisposable DisableTracking(this IRepository repository)
+ {
+ return Tracking(repository, false);
+ }
+
+ ///
+ /// Enables change tracking mechanism for the given repository.
+ ///
+ /// A repository object
+ ///
+ /// A disposable object. Dispose it to restore change tracking mechanism back to its previous state.
+ ///
+ public static IDisposable EnableTracking(this IRepository repository)
+ {
+ return Tracking(repository, true);
+ }
+
+ private static IDisposable Tracking(this IRepository repository, bool enabled)
+ {
+ var previous = repository.IsChangeTrackingEnabled;
+ ObjectHelper.TrySetProperty(ProxyHelper.UnProxy(repository).As(), x => x.IsChangeTrackingEnabled, _ => enabled);
+ return new DisposeAction(_ =>
+ {
+ ObjectHelper.TrySetProperty(ProxyHelper.UnProxy(repository).As(), x => x.IsChangeTrackingEnabled, _ => previous);
+ }, repository);
+ }
+
private static IUnitOfWorkManager GetUnitOfWorkManager(
this IBasicRepository repository,
[CallerMemberName] string callingMethodName = nameof(GetUnitOfWorkManager)
diff --git a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj
index e53f5b718c..39ed10cf0f 100644
--- a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj
+++ b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo.Abp.DistributedLocking.Abstractions.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.DistributedLocking.Abstractions
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj
index a0ddaac22e..43effe5ad8 100644
--- a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj
@@ -4,7 +4,7 @@
- net7.0
+ net8.0
enable
Nullable
diff --git a/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj b/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj
index 8abd0873bd..545d6556f0 100644
--- a/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj
+++ b/framework/src/Volo.Abp.DistributedLocking/Volo.Abp.DistributedLocking.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.DistributedLocking
@@ -22,7 +22,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
index 92d670d114..31bdec53e8 100644
--- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
+++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj
@@ -4,7 +4,7 @@
- netstandard2.0;netstandard2.1;net7.0
+ netstandard2.0;netstandard2.1;net8.0
enable
Nullable
Volo.Abp.Emailing
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AdditionalEmailSendingArgs.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AdditionalEmailSendingArgs.cs
new file mode 100644
index 0000000000..4de1eb6105
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/AdditionalEmailSendingArgs.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using Volo.Abp.Data;
+
+namespace Volo.Abp.Emailing;
+
+[Serializable]
+public class AdditionalEmailSendingArgs
+{
+ public List? CC { get; set; }
+
+ public List? Attachments { get; set; }
+
+ public ExtraPropertyDictionary? ExtraProperties { get; set; }
+}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
index 07b4ca9bcd..ac12ddcead 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/BackgroundEmailSendingJob.cs
@@ -15,15 +15,15 @@ public class BackgroundEmailSendingJob : AsyncBackgroundJob
public bool IsBodyHtml { get; set; } = true;
- //TODO: Add other properties and attachments
+ public AdditionalEmailSendingArgs? AdditionalEmailSendingArgs { get; set; }
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs
new file mode 100644
index 0000000000..e2fe3a3a6b
--- /dev/null
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailAttachment.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Volo.Abp.Emailing;
+
+[Serializable]
+public class EmailAttachment
+{
+ public string? Name { get; set; }
+
+ public byte[]? File { get; set; }
+}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
index d8a46ca4b9..55d4b50a58 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs
@@ -1,7 +1,11 @@
using System;
+using System.IO;
+using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.BackgroundJobs;
namespace Volo.Abp.Emailing;
@@ -11,6 +15,8 @@ namespace Volo.Abp.Emailing;
///
public abstract class EmailSenderBase : IEmailSender
{
+ public ILogger Logger { get; set; }
+
protected IEmailSenderConfiguration Configuration { get; }
protected IBackgroundJobManager BackgroundJobManager { get; }
@@ -20,24 +26,50 @@ public abstract class EmailSenderBase : IEmailSender
///
protected EmailSenderBase(IEmailSenderConfiguration configuration, IBackgroundJobManager backgroundJobManager)
{
+ Logger = NullLogger.Instance;
+
Configuration = configuration;
BackgroundJobManager = backgroundJobManager;
}
- public virtual async Task SendAsync(string to, string? subject, string? body, bool isBodyHtml = true)
+ public virtual async Task SendAsync(string to, string? subject, string? body, bool isBodyHtml = true, AdditionalEmailSendingArgs? additionalEmailSendingArgs = null)
{
- await SendAsync(new MailMessage
- {
- To = { to },
- Subject = subject,
- Body = body,
- IsBodyHtml = isBodyHtml
- });
+ await SendAsync(BuildMailMessage(null, to, subject, body, isBodyHtml, additionalEmailSendingArgs));
+ }
+
+ public virtual async Task SendAsync(string from, string to, string? subject, string? body, bool isBodyHtml = true, AdditionalEmailSendingArgs? additionalEmailSendingArgs = null)
+ {
+ await SendAsync(BuildMailMessage(from, to, subject, body, isBodyHtml, additionalEmailSendingArgs));
}
- public virtual async Task SendAsync(string from, string to, string? subject, string? body, bool isBodyHtml = true)
+ protected virtual MailMessage BuildMailMessage(string? from, string to, string? subject, string? body, bool isBodyHtml = true, AdditionalEmailSendingArgs? additionalEmailSendingArgs = null)
{
- await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml });
+ var message = from == null
+ ? new MailMessage { To = { to }, Subject = subject, Body = body, IsBodyHtml = isBodyHtml }
+ : new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml };
+
+ if (additionalEmailSendingArgs != null)
+ {
+ if (additionalEmailSendingArgs.Attachments != null)
+ {
+ foreach (var attachment in additionalEmailSendingArgs.Attachments.Where(x => x.File != null))
+ {
+ var fileStream = new MemoryStream(attachment.File!);
+ fileStream.Seek(0, SeekOrigin.Begin);
+ message.Attachments.Add(new Attachment(fileStream, attachment.Name));
+ }
+ }
+
+ if (additionalEmailSendingArgs.CC != null)
+ {
+ foreach (var cc in additionalEmailSendingArgs.CC)
+ {
+ message.CC.Add(cc);
+ }
+ }
+ }
+
+ return message;
}
public virtual async Task SendAsync(MailMessage mail, bool normalize = true)
@@ -50,11 +82,11 @@ public abstract class EmailSenderBase : IEmailSender
await SendEmailAsync(mail);
}
- public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true)
+ public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true, AdditionalEmailSendingArgs? additionalEmailSendingArgs = null)
{
if (!BackgroundJobManager.IsAvailable())
{
- await SendAsync(to, subject, body, isBodyHtml);
+ await SendAsync(to, subject, body, isBodyHtml, additionalEmailSendingArgs);
return;
}
@@ -64,16 +96,17 @@ public abstract class EmailSenderBase : IEmailSender
To = to,
Subject = subject,
Body = body,
- IsBodyHtml = isBodyHtml
+ IsBodyHtml = isBodyHtml,
+ AdditionalEmailSendingArgs = additionalEmailSendingArgs
}
);
}
- public virtual async Task QueueAsync(string from, string to, string subject, string body, bool isBodyHtml = true)
+ public virtual async Task QueueAsync(string from, string to, string subject, string body, bool isBodyHtml = true, AdditionalEmailSendingArgs? additionalEmailSendingArgs = null)
{
if (!BackgroundJobManager.IsAvailable())
{
- await SendAsync(from, to, subject, body, isBodyHtml);
+ await SendAsync(from, to, subject, body, isBodyHtml, additionalEmailSendingArgs);
return;
}
@@ -84,7 +117,8 @@ public abstract class EmailSenderBase : IEmailSender
To = to,
Subject = subject,
Body = body,
- IsBodyHtml = isBodyHtml
+ IsBodyHtml = isBodyHtml,
+ AdditionalEmailSendingArgs = additionalEmailSendingArgs
}
);
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
index 55456783c4..64658b0519 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/IEmailSender.cs
@@ -15,7 +15,8 @@ public interface IEmailSender
string to,
string? subject,
string? body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ AdditionalEmailSendingArgs? additionalEmailSendingArgs = null
);
///
@@ -26,7 +27,8 @@ public interface IEmailSender
string to,
string? subject,
string? body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ AdditionalEmailSendingArgs? additionalEmailSendingArgs = null
);
///
@@ -49,7 +51,8 @@ public interface IEmailSender
string to,
string subject,
string body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ AdditionalEmailSendingArgs? additionalEmailSendingArgs = null
);
///
@@ -60,8 +63,7 @@ public interface IEmailSender
string to,
string subject,
string body,
- bool isBodyHtml = true
+ bool isBodyHtml = true,
+ AdditionalEmailSendingArgs? additionalEmailSendingArgs = null
);
-
- //TODO: Add other Queue methods too. Problem: MailMessage is not serializable so can not be used in background jobs.
}
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/NullEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/NullEmailSender.cs
index 5d1f6b0a05..48fa8004ef 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/NullEmailSender.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/NullEmailSender.cs
@@ -12,15 +12,13 @@ namespace Volo.Abp.Emailing;
///
public class NullEmailSender : EmailSenderBase
{
- public ILogger Logger { get; set; }
-
///
/// Creates a new object.
///
public NullEmailSender(IEmailSenderConfiguration configuration, IBackgroundJobManager backgroundJobManager)
: base(configuration, backgroundJobManager)
{
- Logger = NullLogger.Instance;
+
}
protected override Task SendEmailAsync(MailMessage mail)
diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
index 99a8f2e1e7..62550c41f7 100644
--- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
+++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs
@@ -2,6 +2,7 @@ using System;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.DependencyInjection;
@@ -67,10 +68,14 @@ public class SmtpEmailSender : EmailSenderBase, ISmtpEmailSender, ITransientDepe
}
}
- protected override async Task SendEmailAsync(MailMessage mail)
+ protected async override Task SendEmailAsync(MailMessage mail)
{
using (var smtpClient = await BuildClientAsync())
{
+ Logger.LogWarning("We don't recommend that you use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. " +
+ "Use MailKit(https://docs.abp.io/en/abp/latest/MailKit) or other libraries instead." +
+ "For more information, see https://github.com/dotnet/platform-compat/blob/master/docs/DE0005.md");
+
await smtpClient.SendMailAsync(mail);
}
}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
index b19feda6c3..b3d594ba6a 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.MySQL
Volo.Abp.EntityFrameworkCore.MySQL
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -19,8 +21,7 @@
-
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextMySQLExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextMySQLExtensions.cs
index 596062d533..07381983ca 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextMySQLExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextMySQLExtensions.cs
@@ -10,7 +10,7 @@ public static class AbpDbContextConfigurationContextMySQLExtensions
{
public static DbContextOptionsBuilder UseMySQL(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action mySQLOptionsAction = null)
+ Action? mySQLOptionsAction = null)
{
if (context.ExistingConnection != null)
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsMySQLExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsMySQLExtensions.cs
index 247e96cee7..baf8c53a14 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsMySQLExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsMySQLExtensions.cs
@@ -8,7 +8,7 @@ public static class AbpDbContextOptionsMySQLExtensions
{
public static void UseMySQL(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action mySQLOptionsAction = null)
+ Action? mySQLOptionsAction = null)
{
options.Configure(context =>
{
@@ -18,7 +18,7 @@ public static class AbpDbContextOptionsMySQLExtensions
public static void UseMySQL(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action mySQLOptionsAction = null)
+ Action? mySQLOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
index 2ead0da1f3..bb46006ac9 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo.Abp.EntityFrameworkCore.Oracle.Devart.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.Oracle.Devart
Volo.Abp.EntityFrameworkCore.Oracle.Devart
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -19,7 +21,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleDevartExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleDevartExtensions.cs
index a672a280ee..e2138dd7d1 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleDevartExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleDevartExtensions.cs
@@ -10,7 +10,7 @@ public static class AbpDbContextConfigurationContextOracleDevartExtensions
{
public static DbContextOptionsBuilder UseOracle(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action oracleOptionsAction = null,
+ Action? oracleOptionsAction = null,
bool useExistingConnectionIfAvailable = false)
{
if (useExistingConnectionIfAvailable && context.ExistingConnection != null)
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleDevartExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleDevartExtensions.cs
index 12f5bc0437..650d222663 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleDevartExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle.Devart/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleDevartExtensions.cs
@@ -8,7 +8,7 @@ public static class AbpDbContextOptionsOracleDevartExtensions
{
public static void UseOracle(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action oracleOptionsAction = null,
+ Action? oracleOptionsAction = null,
bool useExistingConnectionIfAvailable = false)
{
options.Configure(context =>
@@ -19,7 +19,7 @@ public static class AbpDbContextOptionsOracleDevartExtensions
public static void UseOracle(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action oracleOptionsAction = null,
+ Action? oracleOptionsAction = null,
bool useExistingConnectionIfAvailable = false)
where TDbContext : AbpDbContext
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj
index 187c6a1d9f..93753e8586 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo.Abp.EntityFrameworkCore.Oracle.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.Oracle
Volo.Abp.EntityFrameworkCore.Oracle
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -19,8 +21,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleExtensions.cs
index 9b9d3b2916..39f3a5b86f 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextOracleExtensions.cs
@@ -10,7 +10,7 @@ public static class AbpDbContextConfigurationContextOracleExtensions
{
public static DbContextOptionsBuilder UseOracle(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action oracleOptionsAction = null)
+ Action? oracleOptionsAction = null)
{
if (context.ExistingConnection != null)
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleExtensions.cs
index cc0dc28699..8458dd6d4e 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Oracle/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsOracleExtensions.cs
@@ -8,7 +8,7 @@ public static class AbpDbContextOptionsOracleExtensions
{
public static void UseOracle(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action oracleOptionsAction = null)
+ Action? oracleOptionsAction = null)
{
options.Configure(context =>
{
@@ -18,7 +18,7 @@ public static class AbpDbContextOptionsOracleExtensions
public static void UseOracle(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action oracleOptionsAction = null)
+ Action? oracleOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
index 67f55beeb4..4ddc65c713 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.PostgreSql
Volo.Abp.EntityFrameworkCore.PostgreSql
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -19,7 +21,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs
index 7e13fb01a2..918c0629c1 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextPostgreSqlExtensions.cs
@@ -11,14 +11,14 @@ public static class AbpDbContextConfigurationContextPostgreSqlExtensions
[Obsolete("Use 'UseNpgsql(...)' method instead. This will be removed in future versions.")]
public static DbContextOptionsBuilder UsePostgreSql(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
{
return context.UseNpgsql(postgreSqlOptionsAction);
}
public static DbContextOptionsBuilder UseNpgsql(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
{
if (context.ExistingConnection != null)
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs
index bdea54efab..2a52c5de56 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsPostgreSqlExtensions.cs
@@ -9,7 +9,7 @@ public static class AbpDbContextOptionsPostgreSqlExtensions
[Obsolete("Use 'UseNpgsql(...)' method instead. This will be removed in future versions.")]
public static void UsePostgreSql(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
{
options.Configure(context =>
{
@@ -20,7 +20,7 @@ public static class AbpDbContextOptionsPostgreSqlExtensions
[Obsolete("Use 'UseNpgsql(...)' method instead. This will be removed in future versions.")]
public static void UsePostgreSql(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
@@ -31,7 +31,7 @@ public static class AbpDbContextOptionsPostgreSqlExtensions
public static void UseNpgsql(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
{
options.Configure(context =>
{
@@ -41,7 +41,7 @@ public static class AbpDbContextOptionsPostgreSqlExtensions
public static void UseNpgsql(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action postgreSqlOptionsAction = null)
+ Action? postgreSqlOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/ConnectionStrings/NpgsqlConnectionStringChecker.cs b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/ConnectionStrings/NpgsqlConnectionStringChecker.cs
index f3ab83eb55..56e47aa2d4 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/ConnectionStrings/NpgsqlConnectionStringChecker.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo/Abp/EntityFrameworkCore/ConnectionStrings/NpgsqlConnectionStringChecker.cs
@@ -25,7 +25,7 @@ public class NpgsqlConnectionStringChecker : IConnectionStringChecker, ITransien
await using var conn = new NpgsqlConnection(connString.ConnectionString);
await conn.OpenAsync();
result.Connected = true;
- await conn.ChangeDatabaseAsync(oldDatabaseName);
+ await conn.ChangeDatabaseAsync(oldDatabaseName!);
result.DatabaseExists = true;
await conn.CloseAsync();
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
index f655b66814..cdd1836b67 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.SqlServer
Volo.Abp.EntityFrameworkCore.SqlServer
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -19,7 +21,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqlServerExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqlServerExtensions.cs
index 76476423bb..95ea2ebd8b 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqlServerExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqlServerExtensions.cs
@@ -10,7 +10,7 @@ public static class AbpDbContextConfigurationContextSqlServerExtensions
{
public static DbContextOptionsBuilder UseSqlServer(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action sqlServerOptionsAction = null)
+ Action? sqlServerOptionsAction = null)
{
if (context.ExistingConnection != null)
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs
index 30bf419d5e..8981d8f0c4 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqlServerExtensions.cs
@@ -8,7 +8,7 @@ public static class AbpDbContextOptionsSqlServerExtensions
{
public static void UseSqlServer(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action sqlServerOptionsAction = null)
+ Action? sqlServerOptionsAction = null)
{
options.Configure(context =>
{
@@ -18,7 +18,7 @@ public static class AbpDbContextOptionsSqlServerExtensions
public static void UseSqlServer(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action sqlServerOptionsAction = null)
+ Action? sqlServerOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
index 002b876343..ad933fc388 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore.Sqlite
Volo.Abp.EntityFrameworkCore.Sqlite
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -15,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqliteExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqliteExtensions.cs
index 6dea2a336b..a4e3b60ec9 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqliteExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextConfigurationContextSqliteExtensions.cs
@@ -11,7 +11,7 @@ public static class AbpDbContextConfigurationContextSqliteExtensions
{
public static DbContextOptionsBuilder UseSqlite(
[NotNull] this AbpDbContextConfigurationContext context,
- [CanBeNull] Action sqliteOptionsAction = null)
+ Action? sqliteOptionsAction = null)
{
if (context.ExistingConnection != null)
{
@@ -34,7 +34,7 @@ public static class AbpDbContextConfigurationContextSqliteExtensions
public static DbContextOptionsBuilder UseSqlite(
[NotNull] this AbpDbContextConfigurationContext context,
DbConnection connection,
- [CanBeNull] Action sqliteOptionsAction = null)
+ Action? sqliteOptionsAction = null)
{
if (context.ExistingConnection != null)
{
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqliteExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqliteExtensions.cs
index aaf39cbde5..c3f24a318c 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqliteExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo/Abp/EntityFrameworkCore/AbpDbContextOptionsSqliteExtensions.cs
@@ -8,7 +8,7 @@ public static class AbpDbContextOptionsSqliteExtensions
{
public static void UseSqlite(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action sqliteOptionsAction = null)
+ Action? sqliteOptionsAction = null)
{
options.Configure(context =>
{
@@ -18,7 +18,7 @@ public static class AbpDbContextOptionsSqliteExtensions
public static void UseSqlite(
[NotNull] this AbpDbContextOptions options,
- [CanBeNull] Action sqliteOptionsAction = null)
+ Action? sqliteOptionsAction = null)
where TDbContext : AbpDbContext
{
options.Configure(context =>
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
index f51df050ef..55e88b72e7 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
@@ -13,7 +13,7 @@ public static class AbpEfCoreServiceCollectionExtensions
{
public static IServiceCollection AddAbpDbContext(
this IServiceCollection services,
- Action optionsBuilder = null)
+ Action? optionsBuilder = null)
where TDbContext : AbpDbContext
{
services.AddMemoryCache();
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
index c547299bae..e1d9e41fa2 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
@@ -4,7 +4,9 @@
- net7.0
+ net8.0
+ enable
+ Nullable
Volo.Abp.EntityFrameworkCore
Volo.Abp.EntityFrameworkCore
$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
@@ -20,8 +22,8 @@
-
-
+
+
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
index 94dba628d7..614ba135ff 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EfCoreRepositoryExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Entities;
@@ -44,4 +45,10 @@ public static class EfCoreRepositoryExtensions
throw new ArgumentException("Given repository does not implement " + typeof(IEfCoreRepository).AssemblyQualifiedName, nameof(repository));
}
+
+ public static IQueryable AsNoTrackingIf(this IQueryable queryable, bool condition)
+ where TEntity : class, IEntity
+ {
+ return condition ? queryable.AsNoTracking() : queryable;
+ }
}
diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
index 03af8d1fb4..3274360ba2 100644
--- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
+++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
@@ -1,4 +1,3 @@
-using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
@@ -6,16 +5,16 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
-using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.Extensions.Logging;
+using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.DependencyInjection;
using Volo.Abp.Guids;
-using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore;
@@ -27,11 +26,11 @@ public class EfCoreRepository : RepositoryBase, IE
protected virtual TDbContext DbContext => GetDbContext();
[Obsolete("Use GetDbContextAsync() method.")]
- DbContext IEfCoreRepository.DbContext => GetDbContext() as DbContext;
+ DbContext IEfCoreRepository.DbContext => (GetDbContext() as DbContext)!;
async Task IEfCoreRepository.GetDbContextAsync()
{
- return await GetDbContextAsync() as DbContext;
+ return (await GetDbContextAsync() as DbContext)!;
}
[Obsolete("Use GetDbContextAsync() method.")]
@@ -75,13 +74,13 @@ public class EfCoreRepository : RepositoryBase, IE
{
return (await GetDbContextAsync()).Set();
}
-
+
protected async Task GetDbConnectionAsync()
{
return (await GetDbContextAsync()).Database.GetDbConnection();
}
- protected async Task GetDbTransactionAsync()
+ protected async Task GetDbTransactionAsync()
{
return (await GetDbContextAsync()).Database.CurrentTransaction?.GetDbTransaction();
}
@@ -93,7 +92,7 @@ public class EfCoreRepository : RepositoryBase, IE
public virtual IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance);
- public IEfCoreBulkOperationProvider BulkOperationProvider => LazyServiceProvider.LazyGetService();
+ public IEfCoreBulkOperationProvider? BulkOperationProvider => LazyServiceProvider.LazyGetService();
public EfCoreRepository(IDbContextProvider dbContextProvider)
{
@@ -254,19 +253,19 @@ public class EfCoreRepository : RepositoryBase, IE
{
return includeDetails
? await (await WithDetailsAsync()).ToListAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync()).ToListAsync(GetCancellationToken(cancellationToken));
+ : await (await GetQueryableAsync()).ToListAsync(GetCancellationToken(cancellationToken));
}
public async override Task> GetListAsync(Expression> predicate, bool includeDetails = false, CancellationToken cancellationToken = default)
{
return includeDetails
? await (await WithDetailsAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken));
+ : await (await GetQueryableAsync()).Where(predicate).ToListAsync(GetCancellationToken(cancellationToken));
}
public async override Task GetCountAsync(CancellationToken cancellationToken = default)
{
- return await (await GetDbSetAsync()).LongCountAsync(GetCancellationToken(cancellationToken));
+ return await (await GetQueryableAsync()).LongCountAsync(GetCancellationToken(cancellationToken));
}
public async override Task> GetPagedListAsync(
@@ -278,7 +277,7 @@ public class EfCoreRepository : RepositoryBase, IE
{
var queryable = includeDetails
? await WithDetailsAsync()
- : await GetDbSetAsync();
+ : await GetQueryableAsync();
return await queryable
.OrderByIf>(!sorting.IsNullOrWhiteSpace(), sorting)
@@ -289,12 +288,12 @@ public class EfCoreRepository : RepositoryBase, IE
[Obsolete("Use GetQueryableAsync method.")]
protected override IQueryable GetQueryable()
{
- return DbSet.AsQueryable();
+ return DbSet.AsQueryable().AsNoTrackingIf(!ShouldTrackingEntityChange());
}
public async override Task> GetQueryableAsync()
{
- return (await GetDbSetAsync()).AsQueryable();
+ return (await GetDbSetAsync()).AsQueryable().AsNoTrackingIf(!ShouldTrackingEntityChange());
}
protected async override Task SaveChangesAsync(CancellationToken cancellationToken)
@@ -302,7 +301,7 @@ public class EfCoreRepository : RepositoryBase, IE
await (await GetDbContextAsync()).SaveChangesAsync(cancellationToken);
}
- public async override Task FindAsync(
+ public async override Task FindAsync(
Expression> predicate,
bool includeDetails = true,
CancellationToken cancellationToken = default)
@@ -311,7 +310,7 @@ public class EfCoreRepository : RepositoryBase, IE
? await (await WithDetailsAsync())
.Where(predicate)
.SingleOrDefaultAsync(GetCancellationToken(cancellationToken))
- : await (await GetDbSetAsync())
+ : await (await GetQueryableAsync())
.Where(predicate)
.SingleOrDefaultAsync(GetCancellationToken(cancellationToken));
}
@@ -333,7 +332,7 @@ public class EfCoreRepository