diff --git a/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj b/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj
index a77c183a..fb2a0845 100644
--- a/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj
+++ b/src/OrchardCoreContrib.Contents/OrchardCoreContrib.Contents.csproj
@@ -30,8 +30,9 @@
-
+
+
diff --git a/src/OrchardCoreContrib.Contents/Services/SharedDraftLinkService.cs b/src/OrchardCoreContrib.Contents/Services/SharedDraftLinkService.cs
index d39e5c68..3fbda99c 100644
--- a/src/OrchardCoreContrib.Contents/Services/SharedDraftLinkService.cs
+++ b/src/OrchardCoreContrib.Contents/Services/SharedDraftLinkService.cs
@@ -3,7 +3,7 @@
using OrchardCore.Environment.Shell;
using OrchardCoreContrib.Contents.Indexes;
using OrchardCoreContrib.Contents.Models;
-using Parlot.Fluent;
+using OrchardCoreContrib.Infrastructure;
using YesSql;
namespace OrchardCoreContrib.Contents.Services;
@@ -16,7 +16,7 @@ public class SharedDraftLinkService(
{
public async Task GenerateLinkAsync(string contentItemId)
{
- ArgumentException.ThrowIfNullOrEmpty(contentItemId);
+ Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));
var existingLink = await session.Query()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
@@ -44,7 +44,7 @@ public async Task GenerateLinkAsync(string contentItemId)
public string GetGeneratedLink(string token)
{
- ArgumentException.ThrowIfNullOrEmpty(token);
+ Guard.ArgumentNotNullOrEmpty(token, nameof(token));
var tenant = shellSettings.RequestUrlPrefix;
var baseUrl = $"{httpContextAccessor.HttpContext.Request.Scheme}://{httpContextAccessor.HttpContext.Request.Host}";
@@ -56,7 +56,7 @@ public string GetGeneratedLink(string token)
public async Task GetDraftContentAsync(string token)
{
- ArgumentException.ThrowIfNullOrEmpty(token);
+ Guard.ArgumentNotNullOrEmpty(token, nameof(token));
var link = await session.Query()
.Where(l => l.Token == token && l.ExpirationUtc > DateTime.UtcNow)
@@ -83,6 +83,8 @@ public async Task CleanupExpiredLinksAsync()
public async Task RevokeLinkAsync(string contentItemId)
{
+ Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));
+
var link = await session.Query()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
.FirstOrDefaultAsync();
@@ -102,7 +104,7 @@ public async Task RevokeLinkAsync(string contentItemId)
public async Task GetActiveLinkAsync(string contentItemId)
{
- ArgumentException.ThrowIfNullOrEmpty(contentItemId);
+ Guard.ArgumentNotNullOrEmpty(contentItemId, nameof(contentItemId));
return await session.Query()
.Where(l => l.ContentItemId == contentItemId && l.ExpirationUtc > DateTime.UtcNow)
diff --git a/src/OrchardCoreContrib.Gravatar/OrchardCoreContrib.Gravatar.csproj b/src/OrchardCoreContrib.Gravatar/OrchardCoreContrib.Gravatar.csproj
index bef0900b..2239dd8c 100644
--- a/src/OrchardCoreContrib.Gravatar/OrchardCoreContrib.Gravatar.csproj
+++ b/src/OrchardCoreContrib.Gravatar/OrchardCoreContrib.Gravatar.csproj
@@ -36,6 +36,7 @@
+
diff --git a/src/OrchardCoreContrib.Gravatar/Services/GravatarService.cs b/src/OrchardCoreContrib.Gravatar/Services/GravatarService.cs
index ef24d3d1..15c20f74 100644
--- a/src/OrchardCoreContrib.Gravatar/Services/GravatarService.cs
+++ b/src/OrchardCoreContrib.Gravatar/Services/GravatarService.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.Options;
+using OrchardCoreContrib.Infrastructure;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;
using System.Text;
@@ -13,10 +14,7 @@ public class GravatarService(IOptions gravatarOptions) : IGrava
public string GetAvatarUrl(string email, [Range(1, 512)] int size = GravatarConstants.DefaultSize)
{
- if (string.IsNullOrEmpty(email))
- {
- throw new ArgumentException($"'{nameof(email)}' cannot be null or empty.", nameof(email));
- }
+ Guard.ArgumentNotNullOrEmpty(email, nameof(email));
var hash = ComputeHash(email);
diff --git a/src/OrchardCoreContrib.System/Extensions/ApplicationBuilderExtensions.cs b/src/OrchardCoreContrib.System/Extensions/ApplicationBuilderExtensions.cs
index c28fbdc2..36499863 100644
--- a/src/OrchardCoreContrib.System/Extensions/ApplicationBuilderExtensions.cs
+++ b/src/OrchardCoreContrib.System/Extensions/ApplicationBuilderExtensions.cs
@@ -5,6 +5,7 @@
using OrchardCore.ContentManagement.Routing;
using OrchardCore.Settings;
using OrchardCore.Users;
+using OrchardCoreContrib.Infrastructure;
using OrchardCoreContrib.System.Services;
namespace Microsoft.AspNetCore.Builder;
@@ -24,7 +25,7 @@ public static class ApplicationBuilderExtensions
/// Thrown if is null.
public static IApplicationBuilder UseMaintenanceRedirect(this IApplicationBuilder app)
{
- ArgumentNullException.ThrowIfNull(app);
+ Guard.ArgumentNotNull(app, nameof(app));
var siteService = app.ApplicationServices.GetService();
var adminOptions = app.ApplicationServices.GetService>();
diff --git a/src/OrchardCoreContrib.System/OrchardCoreContrib.System.csproj b/src/OrchardCoreContrib.System/OrchardCoreContrib.System.csproj
index 81a8d826..90351538 100644
--- a/src/OrchardCoreContrib.System/OrchardCoreContrib.System.csproj
+++ b/src/OrchardCoreContrib.System/OrchardCoreContrib.System.csproj
@@ -38,6 +38,7 @@
+