From 91b2f844e086118cc903004df96d2863a2a06116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 14:41:23 +0300 Subject: [PATCH 01/14] AuditLog Module const converted to static --- .../Abp/AuditLogging/AuditLogActionConsts.cs | 6 ++--- .../Volo/Abp/AuditLogging/AuditLogConsts.cs | 24 +++++++++---------- .../Abp/AuditLogging/EntityChangeConsts.cs | 4 ++-- .../EntityPropertyChangeConsts.cs | 8 +++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs index 86652aacec..d40ad03c94 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs @@ -2,10 +2,10 @@ { public class AuditLogActionConsts { - public const int MaxServiceNameLength = 256; + public static int MaxServiceNameLength { get; set; } = 256; - public const int MaxMethodNameLength = 128; + public static int MaxMethodNameLength { get; set; } = 128; - public const int MaxParametersLength = 2000; + public static int MaxParametersLength { get; set; } = 2000; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs index 504e7451e0..3a5e220301 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs @@ -2,31 +2,31 @@ { public static class AuditLogConsts { - public const int MaxApplicationNameLength = 96; + public static int MaxApplicationNameLength { get; set; } = 96; - public const int MaxClientIpAddressLength = 64; + public static int MaxClientIpAddressLength { get; set; } = 64; - public const int MaxClientNameLength = 128; + public static int MaxClientNameLength { get; set; } = 128; - public const int MaxClientIdLength = 64; + public static int MaxClientIdLength { get; set; } = 64; - public const int MaxCorrelationIdLength = 64; + public static int MaxCorrelationIdLength { get; set; } = 64; - public const int MaxBrowserInfoLength = 512; + public static int MaxBrowserInfoLength { get; set; } = 512; - public const int MaxExceptionsLength = 4000; + public static int MaxExceptionsLength { get; set; } = 4000; //TODO: Replace with MaxExceptionsLength in v3.0 public static int MaxExceptionsLengthValue { get; set; } = MaxExceptionsLength; - public const int MaxCommentsLength = 256; + public static int MaxCommentsLength { get; set; } = 256; - public const int MaxUrlLength = 256; + public static int MaxUrlLength { get; set; } = 256; - public const int MaxHttpMethodLength = 16; + public static int MaxHttpMethodLength { get; set; } = 16; - public const int MaxUserNameLength = 256; + public static int MaxUserNameLength { get; set; } = 256; - public const int MaxTenantNameLength = 64; + public static int MaxTenantNameLength { get; set; } = 64; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs index d19407cfa4..22236ac437 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs @@ -2,8 +2,8 @@ { public class EntityChangeConsts { - public const int MaxEntityTypeFullNameLength = 128; + public static int MaxEntityTypeFullNameLength { get; set; } = 128; - public const int MaxEntityIdLength = 128; + public static int MaxEntityIdLength { get; set; } = 128; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs index 2ac9204395..73fce2bd1f 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs @@ -2,12 +2,12 @@ { public class EntityPropertyChangeConsts { - public const int MaxNewValueLength = 512; + public static int MaxNewValueLength { get; set; } = 512; - public const int MaxOriginalValueLength = 512; + public static int MaxOriginalValueLength { get; set; } = 512; - public const int MaxPropertyNameLength = 128; + public static int MaxPropertyNameLength { get; set; } = 128; - public const int MaxPropertyTypeFullNameLength = 64; + public static int MaxPropertyTypeFullNameLength { get; set; } = 64; } } From a18482bb489521733e4ae15691439302e7fcebb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 14:47:39 +0300 Subject: [PATCH 02/14] BackgroundJobs module const converted to static --- .../Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs index f4418bc423..ac4b98230a 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs @@ -2,8 +2,8 @@ { public static class BackgroundJobRecordConsts { - public const int MaxJobNameLength = 128; + public static int MaxJobNameLength { get; set; } = 128; - public const int MaxJobArgsLength = 1024 * 1024; + public static int MaxJobArgsLength { get; set; } = 1024 * 1024; } } From 59054a16c4b6b7f2fa14f20dbff0ff7899b173ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 14:50:32 +0300 Subject: [PATCH 03/14] BlobStoringDatabase module consts converted to static --- .../Volo/Abp/BlobStoring/Database/DatabaseContainerConsts.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/DatabaseContainerConsts.cs b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/DatabaseContainerConsts.cs index 0a71451f9f..22d127a1f1 100644 --- a/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/DatabaseContainerConsts.cs +++ b/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain.Shared/Volo/Abp/BlobStoring/Database/DatabaseContainerConsts.cs @@ -2,6 +2,9 @@ { public static class DatabaseContainerConsts { - public const int MaxNameLength = 128; + /// + /// Default value: 128. + /// + public static int MaxNameLength { get; set; } = 128; } } \ No newline at end of file From f7d8a96c438fd00385549200dd146d74b5046022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:03:20 +0300 Subject: [PATCH 04/14] Blog module consts converted to static --- .../Blogging/Admin/Blogs/Create.cshtml.cs | 7 +++-- .../Pages/Blogging/Admin/Blogs/Edit.cshtml.cs | 7 +++-- .../Volo/Blogging/Files/BloggingWebConsts.cs | 5 +++- .../Volo/Blogging/Posts/CreatePostDto.cs | 9 +++--- .../Volo/Blogging/Blogs/BlogConsts.cs | 15 ++++++++-- .../Volo/Blogging/Comments/CommentConsts.cs | 5 +++- .../Volo/Blogging/Posts/PostConsts.cs | 30 +++++++++++++++---- .../Volo/Blogging/Tagging/TagConsts.cs | 10 +++++-- .../Pages/Blogs/Posts/Edit.cshtml.cs | 9 +++--- .../Pages/Blogs/Posts/New.cshtml.cs | 9 +++--- 10 files changed, 75 insertions(+), 31 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Create.cshtml.cs b/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Create.cshtml.cs index b2d89fbd55..6f4bae5e63 100644 --- a/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Create.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Create.cshtml.cs @@ -2,6 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; using Volo.Blogging.Admin.Blogs; using Volo.Blogging.Blogs; @@ -44,14 +45,14 @@ namespace Volo.Blogging.Admin.Pages.Blogging.Admin.Blogs public class BlogCreateModalView { [Required] - [StringLength(BlogConsts.MaxNameLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxNameLength))] public string Name { get; set; } [Required] - [StringLength(BlogConsts.MaxShortNameLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxShortNameLength))] public string ShortName { get; set; } - [StringLength(BlogConsts.MaxDescriptionLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxDescriptionLength))] public string Description { get; set; } } diff --git a/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Edit.cshtml.cs index 536810e015..8d0b2ba978 100644 --- a/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Edit.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Admin.Web/Pages/Blogging/Admin/Blogs/Edit.cshtml.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; using Volo.Blogging.Admin.Blogs; using Volo.Blogging.Blogs; @@ -58,14 +59,14 @@ namespace Volo.Blogging.Admin.Pages.Blogging.Admin.Blogs public Guid Id { get; set; } [Required] - [StringLength(BlogConsts.MaxNameLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxNameLength))] public string Name { get; set; } [Required] - [StringLength(BlogConsts.MaxShortNameLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxShortNameLength))] public string ShortName { get; set; } - [StringLength(BlogConsts.MaxDescriptionLength)] + [DynamicStringLength(typeof(BlogConsts), nameof(BlogConsts.MaxDescriptionLength))] public string Description { get; set; } } } diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Files/BloggingWebConsts.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Files/BloggingWebConsts.cs index ae4eb32dff..d9eb284ac6 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Files/BloggingWebConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Files/BloggingWebConsts.cs @@ -6,7 +6,10 @@ namespace Volo.Blogging { public class FileUploading { - public const int MaxFileSize = 5242880; //5MB + /// + /// Default value: 5242880 + /// + public static int MaxFileSize { get; set; } = 5242880; //5MB public static int MaxFileSizeAsMegabytes => Convert.ToInt32((MaxFileSize / 1024f) / 1024f); } diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs index 164e4f691f..96cfbd6859 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; namespace Volo.Blogging.Posts { @@ -8,22 +9,22 @@ namespace Volo.Blogging.Posts public Guid BlogId { get; set; } [Required] - [StringLength(PostConsts.MaxTitleLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxTitleLength))] public string Title { get; set; } [Required] public string CoverImage { get; set; } [Required] - [StringLength(PostConsts.MaxUrlLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxUrlLength))] public string Url { get; set; } - [StringLength(PostConsts.MaxContentLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxContentLength))] public string Content { get; set; } public string Tags { get; set; } - [StringLength(PostConsts.MaxDescriptionLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxDescriptionLength))] public string Description { get; set; } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs index 502a4364e7..b4b428207c 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Blogs/BlogConsts.cs @@ -2,10 +2,19 @@ { public static class BlogConsts { - public const int MaxNameLength = 256; + /// + /// Default value: 256 + /// + public static int MaxNameLength { get; set; } = 256; - public const int MaxShortNameLength = 32; + /// + /// Default value: 32 + /// + public static int MaxShortNameLength { get; set; } = 32; - public const int MaxDescriptionLength = 1024; + /// + /// Default value: 1024 + /// + public static int MaxDescriptionLength { get; set; } = 1024; } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentConsts.cs index 34cc655fb3..359b322cbf 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Comments/CommentConsts.cs @@ -2,6 +2,9 @@ { public class CommentConsts { - public const int MaxTextLength = 1024; + /// + /// Default value: 1024 + /// + public static int MaxTextLength { get; set; } = 1024; } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs index 665984dfbb..de91caa2d3 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Posts/PostConsts.cs @@ -2,16 +2,34 @@ { public static class PostConsts { - public const int MaxTitleLength = 512; + /// + /// Default value: 512 + /// + public static int MaxTitleLength { get; set; } = 512; - public const int MaxUrlLength = 64; + /// + /// Default value: 64 + /// + public static int MaxUrlLength { get; set; } = 64; - public const int MaxContentLength = 1024 * 1024; //1MB + /// + /// Default value: 1024 * 1024 + /// + public static int MaxContentLength { get; set; } = 1024 * 1024; //1MB - public const int MaxDescriptionLength = 1000; + /// + /// Default value: 1000 + /// + public static int MaxDescriptionLength { get; set; } = 1000; - public const int MaxTitleLengthToBeSeoFriendly = 60; + /// + /// Default value: 60 + /// + public static int MaxTitleLengthToBeSeoFriendly { get; set; } = 60; - public const int MaxSeoFriendlyDescriptionLength = 200; + /// + /// Default value: 200 + /// + public static int MaxSeoFriendlyDescriptionLength { get; set; } = 200; } } diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagConsts.cs b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagConsts.cs index c75ccd4184..ad2be87ca8 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagConsts.cs +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Tagging/TagConsts.cs @@ -2,8 +2,14 @@ { public class TagConsts { - public const int MaxNameLength = 64; + /// + /// Default value: 64 + /// + public static int MaxNameLength { get; set; } = 64; - public const int MaxDescriptionLength = 512; + /// + /// Default value: 512 + /// + public static int MaxDescriptionLength { get; set; } = 512; } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs index c2ebcc441b..6d998a7172 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Validation; using Volo.Blogging.Blogs; using Volo.Blogging.Pages.Blogs.Shared.Helpers; using Volo.Blogging.Posts; @@ -85,7 +86,7 @@ namespace Volo.Blogging.Pages.Blog.Posts public Guid BlogId { get; set; } [Required] - [StringLength(PostConsts.MaxTitleLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxTitleLength))] public string Title { get; set; } [Required] @@ -93,14 +94,14 @@ namespace Volo.Blogging.Pages.Blog.Posts public string CoverImage { get; set; } [Required] - [StringLength(PostConsts.MaxUrlLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxUrlLength))] public string Url { get; set; } [HiddenInput] - [StringLength(PostConsts.MaxContentLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxContentLength))] public string Content { get; set; } - [StringLength(PostConsts.MaxDescriptionLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxDescriptionLength))] public string Description { get; set; } public string Tags { get; set; } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs index 41c8f43ddd..3930a79900 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Validation; using Volo.Blogging.Blogs; using Volo.Blogging.Blogs.Dtos; using Volo.Blogging.Pages.Blogs.Shared.Helpers; @@ -79,7 +80,7 @@ namespace Volo.Blogging.Pages.Blog.Posts public Guid BlogId { get; set; } [Required] - [StringLength(PostConsts.MaxTitleLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxTitleLength))] public string Title { get; set; } [Required] @@ -87,16 +88,16 @@ namespace Volo.Blogging.Pages.Blog.Posts public string CoverImage { get; set; } [Required] - [StringLength(PostConsts.MaxUrlLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxUrlLength))] public string Url { get; set; } [HiddenInput] - [StringLength(PostConsts.MaxContentLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxContentLength))] public string Content { get; set; } public string Tags { get; set; } - [StringLength(PostConsts.MaxDescriptionLength)] + [DynamicStringLength(typeof(PostConsts), nameof(PostConsts.MaxDescriptionLength))] public string Description { get; set; } } From 90958e56ec0670f72bab4c6f364cb90c117fba4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:04:28 +0300 Subject: [PATCH 05/14] Update BackgroundJobRecordConsts.cs --- .../Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs index ac4b98230a..01f935b30e 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo/Abp/BackgroundJobs/BackgroundJobRecordConsts.cs @@ -2,8 +2,14 @@ { public static class BackgroundJobRecordConsts { + /// + /// Default value: 128 + /// public static int MaxJobNameLength { get; set; } = 128; + /// + /// Default value: 1024 * 1024 + /// public static int MaxJobArgsLength { get; set; } = 1024 * 1024; } } From 238b3930093532c772fb92d630b1b7ba1cb4e0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:07:13 +0300 Subject: [PATCH 06/14] Added summaries to audit logging consts --- .../Abp/AuditLogging/AuditLogActionConsts.cs | 9 +++++ .../Volo/Abp/AuditLogging/AuditLogConsts.cs | 36 +++++++++++++++++++ .../Abp/AuditLogging/EntityChangeConsts.cs | 6 ++++ .../EntityPropertyChangeConsts.cs | 12 +++++++ 4 files changed, 63 insertions(+) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs index d40ad03c94..5f1967804e 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogActionConsts.cs @@ -2,10 +2,19 @@ { public class AuditLogActionConsts { + /// + /// Default value: 256 + /// public static int MaxServiceNameLength { get; set; } = 256; + /// + /// Default value: 128 + /// public static int MaxMethodNameLength { get; set; } = 128; + /// + /// Default value: 2000 + /// public static int MaxParametersLength { get; set; } = 2000; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs index 3a5e220301..4a8c723b76 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs @@ -2,31 +2,67 @@ { public static class AuditLogConsts { + /// + /// Default value: 96 + /// public static int MaxApplicationNameLength { get; set; } = 96; + /// + /// Default value: 64 + /// public static int MaxClientIpAddressLength { get; set; } = 64; + /// + /// Default value: 128 + /// public static int MaxClientNameLength { get; set; } = 128; + /// + /// Default value: 64 + /// public static int MaxClientIdLength { get; set; } = 64; + /// + /// Default value: 64 + /// public static int MaxCorrelationIdLength { get; set; } = 64; + /// + /// Default value: 512 + /// public static int MaxBrowserInfoLength { get; set; } = 512; + /// + /// Default value: 4000 + /// public static int MaxExceptionsLength { get; set; } = 4000; //TODO: Replace with MaxExceptionsLength in v3.0 public static int MaxExceptionsLengthValue { get; set; } = MaxExceptionsLength; + /// + /// Default value: 256 + /// public static int MaxCommentsLength { get; set; } = 256; + /// + /// Default value: 256 + /// public static int MaxUrlLength { get; set; } = 256; + /// + /// Default value: 16 + /// public static int MaxHttpMethodLength { get; set; } = 16; + /// + /// Default value: 256 + /// public static int MaxUserNameLength { get; set; } = 256; + /// + /// Default value: 64 + /// public static int MaxTenantNameLength { get; set; } = 64; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs index 22236ac437..b7f88db3e2 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityChangeConsts.cs @@ -2,8 +2,14 @@ { public class EntityChangeConsts { + /// + /// Default value: 128 + /// public static int MaxEntityTypeFullNameLength { get; set; } = 128; + /// + /// Default value: 128 + /// public static int MaxEntityIdLength { get; set; } = 128; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs index 73fce2bd1f..8d592e06aa 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/EntityPropertyChangeConsts.cs @@ -2,12 +2,24 @@ { public class EntityPropertyChangeConsts { + /// + /// Default value: 512 + /// public static int MaxNewValueLength { get; set; } = 512; + /// + /// Default value: 512 + /// public static int MaxOriginalValueLength { get; set; } = 512; + /// + /// Default value: 128 + /// public static int MaxPropertyNameLength { get; set; } = 128; + /// + /// Default value: 64 + /// public static int MaxPropertyTypeFullNameLength { get; set; } = 64; } } From 1502f14496e272f845cc2816268e24e9a55adf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:24:12 +0300 Subject: [PATCH 07/14] Blog module consts converted to static --- .../Volo/Docs/Admin/Documents/GetAllInput.cs | 11 ++-- .../Admin/Documents/PullAllDocumentInput.cs | 5 +- .../Docs/Admin/Documents/PullDocumentInput.cs | 7 +-- .../Docs/Admin/Projects/Create.cshtml.cs | 15 +++--- .../Pages/Docs/Admin/Projects/Edit.cshtml.cs | 13 ++--- .../Pages/Docs/Admin/Projects/Pull.cshtml.cs | 7 +-- .../Docs/Documents/GetDefaultDocumentInput.cs | 6 ++- .../Volo/Docs/Documents/GetDocumentInput.cs | 7 +-- .../Documents/GetDocumentResourceInput.cs | 7 +-- .../Documents/GetNavigationDocumentInput.cs | 5 +- .../Documents/GetParametersDocumentInput.cs | 5 +- .../Volo/Docs/Documents/DocumentConsts.cs | 53 +++++++++++++++---- .../Volo/Docs/Language/LanguageConsts.cs | 5 +- .../Volo/Docs/Projects/ProjectConsts.cs | 41 +++++++++++--- 14 files changed, 132 insertions(+), 55 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/GetAllInput.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/GetAllInput.cs index e375f6ba0b..1512c13da9 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/GetAllInput.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/GetAllInput.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; +using Volo.Abp.Validation; using Volo.Docs.Documents; namespace Volo.Docs.Admin.Documents @@ -9,19 +10,19 @@ namespace Volo.Docs.Admin.Documents { public Guid? ProjectId { get; set; } - [StringLength(DocumentConsts.MaxNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxNameLength))] public string Name { get; set; } - [StringLength(DocumentConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxVersionNameLength))] public string Version { get; set; } - [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxLanguageCodeNameLength))] public string LanguageCode { get; set; } - [StringLength(DocumentConsts.MaxFileNameNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxFileNameNameLength))] public string FileName { get; set; } - [StringLength(DocumentConsts.MaxFormatNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxFormatNameLength))] public string Format { get; set; } public DateTime? CreationTimeMin { get; set; } diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs index d796c00e64..c375de8b67 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Documents; namespace Volo.Docs.Admin.Documents @@ -8,10 +9,10 @@ namespace Volo.Docs.Admin.Documents { public Guid ProjectId { get; set; } - [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxLanguageCodeNameLength))] public string LanguageCode { get; set; } - [StringLength(DocumentConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxVersionNameLength))] public string Version { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs index fcc9816b02..dce5de0420 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Documents; namespace Volo.Docs.Admin.Documents @@ -8,13 +9,13 @@ namespace Volo.Docs.Admin.Documents { public Guid ProjectId { get; set; } - [StringLength(DocumentConsts.MaxNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxNameLength))] public string Name { get; set; } - [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxLanguageCodeNameLength))] public string LanguageCode { get; set; } - [StringLength(DocumentConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxVersionNameLength))] public string Version { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs index e6de68a3b1..506b674ba5 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Validation; using Volo.Docs.Admin.Projects; using Volo.Docs.Projects; @@ -70,11 +71,11 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects public abstract class CreateProjectViewModelBase { [Required] - [StringLength(ProjectConsts.MaxNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxNameLength))] public string Name { get; set; } [Required] - [StringLength(ProjectConsts.MaxShortNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxShortNameLength))] [InputInfoText("ShortNameInfoText")] public string ShortName { get; set; } @@ -82,21 +83,21 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects [SelectItems(nameof(FormatTypes))] public string Format { get; set; } - [StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxDefaultDocumentNameLength))] public string DefaultDocumentName { get; set; } = "Index"; - [StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxNavigationDocumentNameLength))] public string NavigationDocumentName { get; set; } = "docs-nav.json"; - [StringLength(ProjectConsts.MaxParametersDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxParametersDocumentNameLength))] public string ParametersDocumentName { get; set; } = "docs-params.json"; - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string MinimumVersion { get; set; } public string MainWebsiteUrl { get; set; } - [StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxLatestVersionBranchNameLength))] public string LatestVersionBranchName { get; set; } [HiddenInput] diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs index 3b9aba5303..ef1762c460 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Abp.Validation; using Volo.Docs.Admin.Projects; using Volo.Docs.Projects; @@ -83,28 +84,28 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects public Guid Id { get; set; } [Required] - [StringLength(ProjectConsts.MaxNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxNameLength))] public string Name { get; set; } [Required] [SelectItems(nameof(FormatTypes))] public string Format { get; set; } - [StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxDefaultDocumentNameLength))] public string DefaultDocumentName { get; set; } - [StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxNavigationDocumentNameLength))] public string NavigationDocumentName { get; set; } - [StringLength(ProjectConsts.MaxParametersDocumentNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxParametersDocumentNameLength))] public string ParametersDocumentName { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string MinimumVersion { get; set; } public string MainWebsiteUrl { get; set; } - [StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxLatestVersionBranchNameLength))] public string LatestVersionBranchName { get; set; } } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs index 195337a22e..5cbd094834 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; using Volo.Docs.Admin.Documents; using Volo.Docs.Admin.Projects; using Volo.Docs.Documents; @@ -60,15 +61,15 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects public bool All { get; set; } [Required] - [StringLength(DocumentConsts.MaxNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxNameLength))] public string Name { get; set; } [Required] - [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + [DynamicStringLength(typeof(DocumentConsts),nameof(DocumentConsts.MaxLanguageCodeNameLength))] public string LanguageCode { get; set; } [Required] - [StringLength(DocumentConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxVersionNameLength))] public string Version { get; set; } } } diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs index 3deeb83967..1cef038512 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDefaultDocumentInput.cs @@ -1,5 +1,7 @@ using System; using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; +using Volo.Abp.Validation; using Volo.Docs.Language; using Volo.Docs.Projects; @@ -9,11 +11,11 @@ namespace Volo.Docs.Documents { public Guid ProjectId { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string Version { get; set; } [Required] - [StringLength(LanguageConsts.MaxLanguageCodeLength)] + [DynamicStringLength(typeof(LanguageConsts), nameof(LanguageConsts.MaxLanguageCodeLength))] public string LanguageCode { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs index 412f41b82e..3646f2ade0 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Language; using Volo.Docs.Projects; @@ -10,14 +11,14 @@ namespace Volo.Docs.Documents public Guid ProjectId { get; set; } [Required] - [StringLength(DocumentConsts.MaxNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxNameLength))] public string Name { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string Version { get; set; } [Required] - [StringLength(LanguageConsts.MaxLanguageCodeLength)] + [DynamicStringLength(typeof(LanguageConsts), nameof(LanguageConsts.MaxLanguageCodeLength))] public string LanguageCode { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs index 6f759c47d8..52c1cf78af 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetDocumentResourceInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Language; using Volo.Docs.Projects; @@ -10,14 +11,14 @@ namespace Volo.Docs.Documents public Guid ProjectId { get; set; } [Required] - [StringLength(DocumentConsts.MaxNameLength)] + [DynamicStringLength(typeof(DocumentConsts), nameof(DocumentConsts.MaxNameLength))] public string Name { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string Version { get; set; } [Required] - [StringLength(LanguageConsts.MaxLanguageCodeLength)] + [DynamicStringLength(typeof(LanguageConsts), nameof(LanguageConsts.MaxLanguageCodeLength))] public string LanguageCode { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs index 6866c8c633..ee4e3380ee 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetNavigationDocumentInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Language; using Volo.Docs.Projects; @@ -9,11 +10,11 @@ namespace Volo.Docs.Documents { public Guid ProjectId { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string Version { get; set; } [Required] - [StringLength(LanguageConsts.MaxLanguageCodeLength)] + [DynamicStringLength(typeof(LanguageConsts), nameof(LanguageConsts.MaxLanguageCodeLength))] public string LanguageCode { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetParametersDocumentInput.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetParametersDocumentInput.cs index 33bd25b394..1e277f36a3 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetParametersDocumentInput.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/GetParametersDocumentInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Validation; using Volo.Docs.Language; using Volo.Docs.Projects; @@ -9,11 +10,11 @@ namespace Volo.Docs.Documents { public Guid ProjectId { get; set; } - [StringLength(ProjectConsts.MaxVersionNameLength)] + [DynamicStringLength(typeof(ProjectConsts), nameof(ProjectConsts.MaxVersionNameLength))] public string Version { get; set; } [Required] - [StringLength(LanguageConsts.MaxLanguageCodeLength)] + [DynamicStringLength(typeof(LanguageConsts), nameof(LanguageConsts.MaxLanguageCodeLength))] public string LanguageCode { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs index f629abd0a4..04e3de3fd5 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs @@ -2,14 +2,49 @@ { public static class DocumentConsts { - public const int MaxNameLength = 255; - public const int MaxVersionNameLength = 128; - public const int MaxLanguageCodeNameLength = 128; - public const int MaxFileNameNameLength = 128; - public const int MaxFormatNameLength = 128; - public const int MaxEditLinkLength = 2048; - public const int MaxRootUrlLength = 2048; - public const int MaxRawRootUrlLength = 2048; - public const int MaxLocalDirectoryLength = 512; + /// + /// Default value: 255 + /// + public static int MaxNameLength { get; set; } = 255; + + /// + /// Default value: 128 + /// + public static int MaxVersionNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxLanguageCodeNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxFileNameNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxFormatNameLength { get; set; } = 128; + + /// + /// Default value: 2048 + /// + public static int MaxEditLinkLength { get; set; } = 2048; + + /// + /// Default value: 2048 + /// + public static int MaxRootUrlLength { get; set; } = 2048; + + /// + /// Default value: 2048 + /// + public static int MaxRawRootUrlLength { get; set; } = 2048; + + /// + /// Default value: 512 + /// + public static int MaxLocalDirectoryLength { get; set; } = 512; } } diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Language/LanguageConsts.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Language/LanguageConsts.cs index 867cc2dd4e..cd449a37fd 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Language/LanguageConsts.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Language/LanguageConsts.cs @@ -3,6 +3,9 @@ namespace Volo.Docs.Language { public static class LanguageConsts { - public const int MaxLanguageCodeLength = 10; + /// + /// Default value: 10 + /// + public static int MaxLanguageCodeLength { get; set; } = 10; } } diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectConsts.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectConsts.cs index 927a1a4c59..3322fb7732 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectConsts.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Projects/ProjectConsts.cs @@ -2,12 +2,39 @@ { public static class ProjectConsts { - public const int MaxNameLength = 128; - public const int MaxShortNameLength = 32; - public const int MaxDefaultDocumentNameLength = 128; - public const int MaxNavigationDocumentNameLength = 128; - public const int MaxParametersDocumentNameLength = 128; - public const int MaxLatestVersionBranchNameLength = 128; - public const int MaxVersionNameLength = 128; + /// + /// Default value: 128 + /// + public static int MaxNameLength { get; set; } = 128; + + /// + /// Default value: 32 + /// + public static int MaxShortNameLength { get; set; } = 32; + + /// + /// Default value: 128 + /// + public static int MaxDefaultDocumentNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxNavigationDocumentNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxParametersDocumentNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxLatestVersionBranchNameLength { get; set; } = 128; + + /// + /// Default value: 128 + /// + public static int MaxVersionNameLength { get; set; } = 128; } } From 89f1125a628117a036a12fe78ffea43d9b97dd82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:26:49 +0300 Subject: [PATCH 08/14] Update FeatureValueConsts.cs --- .../FeatureManagement/FeatureValueConsts.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueConsts.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueConsts.cs index 0fd1a644fa..f44deca44a 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueConsts.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueConsts.cs @@ -2,12 +2,24 @@ { public static class FeatureValueConsts { - public const int MaxNameLength = 128; + /// + /// Default value: 128 + /// + public static int MaxNameLength { get; set;} = 128; - public const int MaxProviderNameLength = 64; + /// + /// Default value: 64 + /// + public static int MaxProviderNameLength { get; set;} = 64; - public const int MaxProviderKeyLength = 64; + /// + /// Default value: 64 + /// + public static int MaxProviderKeyLength { get; set;} = 64; - public const int MaxValueLength = 128; + /// + /// Default value: 128 + /// + public static int MaxValueLength { get; set;} = 128; } } From 72e58df483caf7a78be1b80178bb1d131ac7a7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:30:50 +0300 Subject: [PATCH 09/14] Added summaries to identity module --- .../Abp/Identity/IdentityClaimTypeConsts.cs | 19 +++++++++++++++++++ .../Volo/Abp/Identity/IdentityRoleConsts.cs | 11 +++++++++++ .../Abp/Identity/IdentityUserClaimConsts.cs | 6 ++++++ .../Volo/Abp/Identity/IdentityUserConsts.cs | 14 +++++++++++++- .../Abp/Identity/IdentityUserLoginConsts.cs | 11 +++++++++++ .../Abp/Identity/IdentityUserTokenConsts.cs | 6 ++++++ 6 files changed, 66 insertions(+), 1 deletion(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs index 6e15cb0cfc..d13d3fba0e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeConsts.cs @@ -2,10 +2,29 @@ { public class IdentityClaimTypeConsts { + /// + /// Default value: 256 + /// public static int MaxNameLength { get; set; } = 256; + + /// + /// Default value: 512 + /// public static int MaxRegexLength { get; set; } = 512; + + /// + /// Default value: 128 + /// public static int MaxRegexDescriptionLength { get; set; } = 128; + + /// + /// Default value: 256 + /// public static int MaxDescriptionLength { get; set; } = 256; + + /// + /// Default value: 256 + /// public static int MaxConcurrencyStampLength { get; set; } = 256; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs index 33e8e74977..dfed056854 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleConsts.cs @@ -2,8 +2,19 @@ { public static class IdentityRoleConsts { + /// + /// Default value: 256 + /// public static int MaxNameLength { get; set; } = 256; + + /// + /// Default value: 256 + /// public static int MaxNormalizedNameLength { get; set; } = 256; + + /// + /// Default value: 256 + /// public static int MaxConcurrencyStampLength { get; set; } = 256; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs index a850d6cff2..84ba493853 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserClaimConsts.cs @@ -2,8 +2,14 @@ { public static class IdentityUserClaimConsts { + /// + /// Default value: 256 + /// public static int MaxClaimTypeLength { get; set; } = 256; + /// + /// Default value: 1024 + /// public static int MaxClaimValueLength { get; set; } = 1024; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs index 7b1a90dacc..378f545dff 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs @@ -18,12 +18,24 @@ namespace Volo.Abp.Identity public static int MaxPhoneNumberLength { get; set; } = AbpUserConsts.MaxPhoneNumberLength; + /// + /// Default value: 128 + /// public static int MaxPasswordLength { get; set; } = 128; + /// + /// Default value: 256 + /// public static int MaxPasswordHashLength { get; set; } = 256; + /// + /// Default value: 256 + /// public static int MaxSecurityStampLength { get; set; } = 256; - + + /// + /// Default value: 256 + /// public static int MaxConcurrencyStampLength { get; set; } = 256; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs index 3f95dfd634..8435221fd3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserLoginConsts.cs @@ -2,8 +2,19 @@ { public static class IdentityUserLoginConsts { + /// + /// Default value: 64 + /// public static int MaxLoginProviderLength { get; set; } = 64; + + /// + /// Default value: 196 + /// public static int MaxProviderKeyLength { get; set; } = 196; + + /// + /// Default value: 128 + /// public static int MaxProviderDisplayNameLength { get; set; } = 128; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs index 1e4eb4794b..a585a8383b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserTokenConsts.cs @@ -2,8 +2,14 @@ { public static class IdentityUserTokenConsts { + /// + /// Default value: 64 + /// public static int MaxLoginProviderLength { get; set; } = 64; + /// + /// Default value: 128 + /// public static int MaxNameLength { get; set; } = 128; } } From 581f92cf8e309e9848bce7e20566816325641ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:40:58 +0300 Subject: [PATCH 10/14] Identity server module consts converted to static --- .../Clients/ClientIdPRestrictionConsts.cs | 5 ++- .../ClientPostLogoutRedirectUriConsts.cs | 5 ++- .../Clients/ClientPropertyConsts.cs | 11 ++++-- .../Clients/ClientRedirectUriConsts.cs | 5 ++- .../Clients/ClientScopeConsts.cs | 5 ++- .../Grants/PersistedGrantConsts.cs | 35 +++++++++++++++---- .../IdentityResourceConsts.cs | 17 +++++++-- .../Volo/Abp/IdentityServer/SecretConsts.cs | 18 ++++++++-- .../Abp/IdentityServer/UserClaimConsts.cs | 5 ++- 9 files changed, 87 insertions(+), 19 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs index c71301871a..b238a01935 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs @@ -2,6 +2,9 @@ { public class ClientIdPRestrictionConsts { - public const int ProviderMaxLength = 200; + /// + /// Default value: 200 + /// + public static int ProviderMaxLength { get; set; } = 200; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs index 3092232d47..7d4764e1a3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs @@ -2,7 +2,10 @@ { public class ClientPostLogoutRedirectUriConsts { - public const int PostLogoutRedirectUriMaxLength = 2000; + /// + /// Default value: 200 + /// + public static int PostLogoutRedirectUriMaxLength { get; set; } = 2000; public static int PostLogoutRedirectUriMaxLengthValue { get; set; } = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs index 6535304596..664e1076b0 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs @@ -2,7 +2,14 @@ { public class ClientPropertyConsts { - public const int KeyMaxLength = 250; - public const int ValueMaxLength = 2000; + /// + /// Default value: 250 + /// + public static int KeyMaxLength { get; set; } = 250; + + /// + /// Default value: 2000 + /// + public static int ValueMaxLength { get; set; } = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs index e972388487..7650a3d952 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs @@ -2,7 +2,10 @@ { public class ClientRedirectUriConsts { - public const int RedirectUriMaxLength = 2000; + /// + /// Default value: 2000 + /// + public static int RedirectUriMaxLength { get; set; } = 2000; public static int RedirectUriMaxLengthValue { get; set; } = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs index 6a5b62e692..0ec1c04595 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs @@ -2,6 +2,9 @@ { public class ClientScopeConsts { - public const int ScopeMaxLength = 200; + /// + /// Default value: 200 + /// + public static int ScopeMaxLength { get; set; } = 200; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs index 6d0836ab17..b1dd21d6f8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs @@ -2,11 +2,34 @@ { public class PersistedGrantConsts { - public const int KeyMaxLength = 200; - public const int TypeMaxLength = 50; - public const int SubjectIdMaxLength = 200; - public const int ClientIdMaxLength = 200; - public const int DataMaxLength = 50000; - public static int DataMaxLengthValue { get; set; }= 50000; + /// + /// Default value: 200 + /// + public static int KeyMaxLength { get; set; } = 200; + + /// + /// Default value: 50 + /// + public static int TypeMaxLength { get; set; } = 50; + + /// + /// Default value: 200 + /// + public static int SubjectIdMaxLength { get; set; } = 200; + + /// + /// Default value: 200 + /// + public static int ClientIdMaxLength { get; set; } = 200; + + /// + /// Default value: 50000 + /// + public static int DataMaxLength { get; set; } = 50000; + + /// + /// Default value: 50000 + /// + public static int DataMaxLengthValue { get; set; } = 50000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs index c60cc34ad8..a7c713e161 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceConsts.cs @@ -2,8 +2,19 @@ { public class IdentityResourceConsts { - public const int NameMaxLength = 200; - public const int DisplayNameMaxLength = 200; - public const int DescriptionMaxLength = 1000; + /// + /// Default value: 200 + /// + public static int NameMaxLength { get; set; } = 200; + + /// + /// Default value: 200 + /// + public static int DisplayNameMaxLength { get; set; } = 200; + + /// + /// Default value: 200 + /// + public static int DescriptionMaxLength { get; set; } = 1000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs index 76635e322e..156088a97b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs @@ -2,9 +2,21 @@ { public class SecretConsts { - public const int TypeMaxLength = 250; - public const int ValueMaxLength = 4000; + /// + /// Default value: 250 + /// + public static int TypeMaxLength { get; set; } = 250; + + /// + /// Default value: 4000 + /// + public static int ValueMaxLength { get; set; } = 4000; + public static int ValueMaxLengthValue { get; set; } = ValueMaxLength; - public const int DescriptionMaxLength = 2000; + + /// + /// Default value: 2000 + /// + public static int DescriptionMaxLength { get; set; } = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs index 9133482f1f..cb0279fd2b 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs @@ -2,6 +2,9 @@ { public class UserClaimConsts { - public const int TypeMaxLength = 200; + /// + /// Default value: 200 + /// + public static int TypeMaxLength { get; set; } = 200; } } \ No newline at end of file From 40925bbffd8e36e86fae92949e563a2e317585f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:43:44 +0300 Subject: [PATCH 11/14] Update PermissionGrantConsts.cs --- .../PermissionManagement/PermissionGrantConsts.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs index 8d579638ec..5cb2397349 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/PermissionGrantConsts.cs @@ -2,10 +2,19 @@ { public static class PermissionGrantConsts { - public const int MaxNameLength = 128; + /// + /// Default value: 128 + /// + public static int MaxNameLength { get; set; } = 128; - public const int MaxProviderNameLength = 64; + /// + /// Default value: 64 + /// + public static int MaxProviderNameLength { get; set; } = 64; - public const int MaxProviderKeyLength = 64; + /// + /// Default value: 64 + /// + public static int MaxProviderKeyLength { get; set; } = 64; } } From 855c952e6f3f1275421362c5a3b4ffb38a0e7d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:45:24 +0300 Subject: [PATCH 12/14] Update SettingConsts.cs --- .../Abp/SettingManagement/SettingConsts.cs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingConsts.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingConsts.cs index 44a21f3ccb..e23a0e39a5 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingConsts.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/SettingConsts.cs @@ -2,10 +2,26 @@ { public static class SettingConsts { - public const int MaxNameLength = 128; - public const int MaxValueLength = 2048; + /// + /// Default value: 128 + /// + public static int MaxNameLength { get; set; } = 128; + + /// + /// Default value: 2048 + /// + public static int MaxValueLength { get; set; } = 2048; + public static int MaxValueLengthValue { get; set; } = MaxValueLength; - public const int MaxProviderNameLength = 64; - public const int MaxProviderKeyLength = 64; + + /// + /// Default value: 64 + /// + public static int MaxProviderNameLength { get; set; } = 64; + + /// + /// Default value: 64 + /// + public static int MaxProviderKeyLength { get; set; } = 64; } } From 87f8b2672afe2569a321a66aeaf48a0f68d684d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 15:49:42 +0300 Subject: [PATCH 13/14] Tenant Management Module consts converted to static --- .../TenantManagement/TenantCreateOrUpdateDtoBase.cs | 3 ++- .../TenantManagement/TenantConnectionStringConsts.cs | 10 ++++++++-- .../Volo/Abp/TenantManagement/TenantConsts.cs | 5 ++++- .../Tenants/ConnectionStringsModal.cshtml.cs | 3 ++- .../TenantManagement/Tenants/CreateModal.cshtml.cs | 3 ++- .../Pages/TenantManagement/Tenants/EditModal.cshtml.cs | 3 ++- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantCreateOrUpdateDtoBase.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantCreateOrUpdateDtoBase.cs index 19f73b0d51..7dc805ea79 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantCreateOrUpdateDtoBase.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantCreateOrUpdateDtoBase.cs @@ -1,12 +1,13 @@ using System.ComponentModel.DataAnnotations; using Volo.Abp.ObjectExtending; +using Volo.Abp.Validation; namespace Volo.Abp.TenantManagement { public abstract class TenantCreateOrUpdateDtoBase : ExtensibleObject { [Required] - [StringLength(TenantConsts.MaxNameLength)] + [DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))] public string Name { get; set; } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConnectionStringConsts.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConnectionStringConsts.cs index 4cdf8dee2a..b177e8d046 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConnectionStringConsts.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConnectionStringConsts.cs @@ -2,8 +2,14 @@ { public static class TenantConnectionStringConsts { - public const int MaxNameLength = 64; + /// + /// Default value: 64 + /// + public static int MaxNameLength { get; set; } = 64; - public const int MaxValueLength = 1024; + /// + /// Default value: 1024 + /// + public static int MaxValueLength { get; set; } = 1024; } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConsts.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConsts.cs index 328c422ab9..10de5e8773 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConsts.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/TenantConsts.cs @@ -2,6 +2,9 @@ { public static class TenantConsts { - public const int MaxNameLength = 64; + /// + /// Default value: 64 + /// + public static int MaxNameLength { get; set; } = 64; } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs index 9093437f98..45a36060e0 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { @@ -53,7 +54,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants public bool UseSharedDatabase { get; set; } - [StringLength(TenantConnectionStringConsts.MaxValueLength)] + [DynamicStringLength(typeof(TenantConnectionStringConsts), nameof(TenantConnectionStringConsts.MaxValueLength))] public string DefaultConnectionString { get; set; } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs index fa517594ee..0c1e6e0bec 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { @@ -34,7 +35,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants public class TenantInfoModel { [Required] - [StringLength(TenantConsts.MaxNameLength)] + [DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))] public string Name { get; set; } [Required] diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs index 74ac176b02..736d0174cf 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Validation; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { @@ -42,7 +43,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants public Guid Id { get; set; } [Required] - [StringLength(TenantConsts.MaxNameLength)] + [DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))] [Display(Name = "DisplayName:TenantName")] public string Name { get; set; } } From 397abba3baff82cf46b3db04743273fa8be0e96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Mon, 29 Jun 2020 16:09:40 +0300 Subject: [PATCH 14/14] Update AbpUserConsts.cs --- .../Volo/Abp/Users/AbpUserConsts.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs b/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs index ee37c6c9f4..efbd2e02b2 100644 --- a/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs +++ b/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs @@ -2,14 +2,29 @@ namespace Volo.Abp.Users { public class AbpUserConsts { + /// + /// Default value: 256 + /// public static int MaxUserNameLength { get; set; } = 256; + /// + /// Default value: 64 + /// public static int MaxNameLength { get; set; } = 64; + /// + /// Default value: 64 + /// public static int MaxSurnameLength { get; set; } = 64; + /// + /// Default value: 256 + /// public static int MaxEmailLength { get; set; } = 256; + /// + /// Default value: 16 + /// public static int MaxPhoneNumberLength { get; set; } = 16; } } \ No newline at end of file