diff --git a/BulkUploader.Console/Enumerations.cs b/BulkUploader.Console/Enumerations.cs
index 6c8a1c2..8e707c6 100644
--- a/BulkUploader.Console/Enumerations.cs
+++ b/BulkUploader.Console/Enumerations.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux Uploader
namespace Noftware.In.Faux.BulkUploader
{
diff --git a/BulkUploader.Console/Helpers.cs b/BulkUploader.Console/Helpers.cs
index 906c2e0..2341306 100644
--- a/BulkUploader.Console/Helpers.cs
+++ b/BulkUploader.Console/Helpers.cs
@@ -1,9 +1,7 @@
-using System;
+// Ignore Spelling: Noftware Faux Uploader
+
using System.Collections;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.BulkUploader
{
diff --git a/BulkUploader.Console/In.Faux.BulkUploader.Console.csproj b/BulkUploader.Console/In.Faux.BulkUploader.Console.csproj
index 0cc65a2..af71970 100644
--- a/BulkUploader.Console/In.Faux.BulkUploader.Console.csproj
+++ b/BulkUploader.Console/In.Faux.BulkUploader.Console.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
Noftware.In.Faux.BulkUploader
BulkUploader
@@ -12,11 +12,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/BulkUploader.Console/Program.cs b/BulkUploader.Console/Program.cs
index 3f0675b..daa7630 100644
--- a/BulkUploader.Console/Program.cs
+++ b/BulkUploader.Console/Program.cs
@@ -1,16 +1,17 @@
-using System;
+// Ignore Spelling: Noftware Faux Uploader
+
+using System;
+using System.Linq;
+using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using System.Linq;
-using System.Threading.Tasks;
-using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Core.Data;
-using Noftware.In.Faux.Data.Azure.Entities;
-using Noftware.In.Faux.Data.Repositories;
using Noftware.In.Faux.Core.Extensions;
using Noftware.In.Faux.Core.Models;
using Noftware.In.Faux.Core.Services;
+using Noftware.In.Faux.Data.Azure.Entities;
+using Noftware.In.Faux.Data.Repositories;
using Noftware.In.Faux.Data.Services;
namespace Noftware.In.Faux.BulkUploader
@@ -76,7 +77,7 @@ public static async Task Main(string[] args)
PersistenceMode mode;
// If arguments are specified, ensure they are valid
- if (args?.Any() == true)
+ if (args?.Length > 0)
{
// Only a single argument is supported
if (args.Length > 1)
diff --git a/BulkUploader.Console/Startup.cs b/BulkUploader.Console/Startup.cs
index 957bd2e..4e14702 100644
--- a/BulkUploader.Console/Startup.cs
+++ b/BulkUploader.Console/Startup.cs
@@ -1,38 +1,27 @@
-using Microsoft.Extensions.Configuration;
+// Ignore Spelling: Noftware Faux Uploader
+
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Noftware.In.Faux.Data.Azure;
-using Noftware.In.Faux.Data.Azure.Entities;
-using Noftware.In.Faux.Data.Repositories;
-using Noftware.In.Faux.Data.Services;
using Noftware.In.Faux.Core.Data;
-using Noftware.In.Faux.Core.Services;
using Noftware.In.Faux.Core.Extensions;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using Noftware.In.Faux.Core.Models;
+using Noftware.In.Faux.Core.Services;
+using Noftware.In.Faux.Data.Azure.Entities;
+using Noftware.In.Faux.Data.Repositories;
+using Noftware.In.Faux.Data.Services;
namespace Noftware.In.Faux.BulkUploader
{
///
/// DI startup.
///
- public class Startup
+ /// Represents a set of key/value application configuration properties.
+ public class Startup(IConfiguration configuration)
{
- ///
- /// Constructor.
- ///
- /// Represents a set of key/value application configuration properties.
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
-
///
/// Represents a set of key/value application configuration properties.
///
- public IConfiguration Configuration { get; }
+ public IConfiguration Configuration { get; } = configuration;
///
/// This method gets called by the runtime. Use this method to add services to the container.
diff --git a/Client/In.Faux.Client.csproj b/Client/In.Faux.Client.csproj
index edd89b6..dc0257e 100644
--- a/Client/In.Faux.Client.csproj
+++ b/Client/In.Faux.Client.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
Noftware.In.Faux.Client
Noftware.In.Faux.Client
@@ -12,9 +12,9 @@
-
-
-
+
+
+
diff --git a/Client/Pages/Quotes/Components/QuoteButton.razor.cs b/Client/Pages/Quotes/Components/QuoteButton.razor.cs
index 6fc5570..1d19306 100644
--- a/Client/Pages/Quotes/Components/QuoteButton.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteButton.razor.cs
@@ -1,14 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Json;
+// Ignore Spelling: Noftware Faux
+
using System.Threading.Tasks;
-using System.Threading;
-using Noftware.In.Faux.Core.Models;
using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Web;
-using Noftware.In.Faux.Core.Services;
using Microsoft.Extensions.Configuration;
using Noftware.In.Faux.Client.Services;
using Noftware.In.Faux.Client.ViewModels;
diff --git a/Client/Pages/Quotes/Components/QuoteDisplay.razor.cs b/Client/Pages/Quotes/Components/QuoteDisplay.razor.cs
index d9f85d0..841dbd9 100644
--- a/Client/Pages/Quotes/Components/QuoteDisplay.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteDisplay.razor.cs
@@ -1,10 +1,7 @@
-using Microsoft.AspNetCore.Components;
+// Ignore Spelling: Noftware Faux
+
+using Microsoft.AspNetCore.Components;
using Noftware.In.Faux.Client.ViewModels;
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Client.Pages.Quotes.Components
{
diff --git a/Client/Pages/Quotes/Components/QuoteList.razor.cs b/Client/Pages/Quotes/Components/QuoteList.razor.cs
index de959fe..aa8cb3b 100644
--- a/Client/Pages/Quotes/Components/QuoteList.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteList.razor.cs
@@ -1,13 +1,11 @@
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Web;
+// Ignore Spelling: Noftware Faux
+
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using Noftware.In.Faux.Client.Services;
using Noftware.In.Faux.Client.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Client.Pages.Quotes.Components
{
@@ -53,12 +51,12 @@ private async Task DisplayQuoteAsync(ViewQuote quote)
// Get the display image, if it was not loaded
if (quote.Base64Image == null)
{
- await this.BusyIndicatorVisibilityAsync(quote, showBusyIndicator: true);
+ await BusyIndicatorVisibilityAsync(quote, showBusyIndicator: true);
string resizedImage = await this.QuoteService.GetResizedImageAsync(quote.Key, quote.FileName);
quote.Base64Image = resizedImage;
- await this.BusyIndicatorVisibilityAsync(quote, showBusyIndicator: false);
+ await BusyIndicatorVisibilityAsync(quote, showBusyIndicator: false);
}
// Does the 'display' image need to be fetched?
@@ -85,7 +83,7 @@ private async Task DisplayQuoteAsync(ViewQuote quote)
/// The associated quote's row to show the busy indicator within.
/// True to show or false to hide.
///
- private async Task BusyIndicatorVisibilityAsync(ViewQuote quote, bool showBusyIndicator)
+ private static async Task BusyIndicatorVisibilityAsync(ViewQuote quote, bool showBusyIndicator)
{
// Show or hide busy indicator
quote.SearchShowBusyIndicator = showBusyIndicator;
diff --git a/Client/Pages/Quotes/Components/QuoteRandom.razor.cs b/Client/Pages/Quotes/Components/QuoteRandom.razor.cs
index a2106cb..58b9547 100644
--- a/Client/Pages/Quotes/Components/QuoteRandom.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteRandom.razor.cs
@@ -1,13 +1,9 @@
-using Microsoft.AspNetCore.Components;
+// Ignore Spelling: Noftware Faux
+
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Components;
using Noftware.In.Faux.Client.Services;
using Noftware.In.Faux.Client.ViewModels;
-using Noftware.In.Faux.Core.Models;
-using Noftware.In.Faux.Core.Services;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Client.Pages.Quotes.Components
{
diff --git a/Client/Pages/Quotes/Components/QuoteSearch.razor.cs b/Client/Pages/Quotes/Components/QuoteSearch.razor.cs
index bf279cb..3417a36 100644
--- a/Client/Pages/Quotes/Components/QuoteSearch.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteSearch.razor.cs
@@ -1,17 +1,15 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
+using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Json;
using System.Threading.Tasks;
-using System.Threading;
-using Noftware.In.Faux.Core.Models;
using Microsoft.AspNetCore.Components;
-using Noftware.In.Faux.Core.Extensions;
+using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.Configuration;
using Noftware.In.Faux.Client.Services;
using Noftware.In.Faux.Client.ViewModels;
-using Microsoft.AspNetCore.Components.Web;
+using Noftware.In.Faux.Core.Extensions;
namespace Noftware.In.Faux.Client.Pages.Quotes.Components
{
diff --git a/Client/Pages/Quotes/Components/QuoteTimer.razor.cs b/Client/Pages/Quotes/Components/QuoteTimer.razor.cs
index ed7d8dc..97304b4 100644
--- a/Client/Pages/Quotes/Components/QuoteTimer.razor.cs
+++ b/Client/Pages/Quotes/Components/QuoteTimer.razor.cs
@@ -1,13 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Json;
+// Ignore Spelling: Noftware Faux
+
+using System;
using System.Threading.Tasks;
-using System.Threading;
-using Noftware.In.Faux.Core.Models;
using Microsoft.AspNetCore.Components;
-using Noftware.In.Faux.Core.Services;
using Microsoft.Extensions.Configuration;
using Noftware.In.Faux.Client.Services;
using Noftware.In.Faux.Client.ViewModels;
diff --git a/Client/Pages/Quotes/Timer.Razor.cs b/Client/Pages/Quotes/Timer.Razor.cs
index ff9d38f..e4fb96e 100644
--- a/Client/Pages/Quotes/Timer.Razor.cs
+++ b/Client/Pages/Quotes/Timer.Razor.cs
@@ -1,10 +1,7 @@
-using Microsoft.AspNetCore.Components;
+// Ignore Spelling: Noftware Faux
+
+using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Client.Pages.Quotes
{
@@ -27,7 +24,7 @@ public partial class Timer
///
protected override void OnInitialized()
{
- int.TryParse(Configuration["TimerRefreshSeconds"], out SecondsRefresh);
+ _ = int.TryParse(Configuration["TimerRefreshSeconds"], out SecondsRefresh);
}
}
}
diff --git a/Client/Program.cs b/Client/Program.cs
index e0e5c3f..6e99f06 100644
--- a/Client/Program.cs
+++ b/Client/Program.cs
@@ -1,13 +1,12 @@
-using Noftware.In.Faux.Core.Services;
-using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Noftware.In.Faux.Client.Services;
+// Ignore Spelling: Noftware Faux
+
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Web;
+using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
+using Microsoft.Extensions.DependencyInjection;
+using Noftware.In.Faux.Client.Services;
namespace Noftware.In.Faux.Client
{
diff --git a/Client/Services/ClientQuoteService.cs b/Client/Services/ClientQuoteService.cs
index a0bfd7a..d4860e2 100644
--- a/Client/Services/ClientQuoteService.cs
+++ b/Client/Services/ClientQuoteService.cs
@@ -1,15 +1,15 @@
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
-using Noftware.In.Faux.Client.ViewModels;
-using Noftware.In.Faux.Core.Models;
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
-using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using Noftware.In.Faux.Client.ViewModels;
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Client.Services
{
@@ -76,10 +76,7 @@ public async Task GetRandomQuoteAsync()
// If quote is still empty, get the default out-of-the-box one
- if (quote is null)
- {
- quote = Quote.GetDefault();
- }
+ quote ??= Quote.GetDefault();
// Map to view model
if (quote is not null)
diff --git a/Client/Services/IClientQuoteService.cs b/Client/Services/IClientQuoteService.cs
index 879a6e8..0dc845a 100644
--- a/Client/Services/IClientQuoteService.cs
+++ b/Client/Services/IClientQuoteService.cs
@@ -1,9 +1,8 @@
-using Noftware.In.Faux.Client.ViewModels;
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
+using Noftware.In.Faux.Client.ViewModels;
namespace Noftware.In.Faux.Client.Services
{
diff --git a/Client/ViewModels/ViewQuote.cs b/Client/ViewModels/ViewQuote.cs
index 7300483..5460f02 100644
--- a/Client/ViewModels/ViewQuote.cs
+++ b/Client/ViewModels/ViewQuote.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Client.ViewModels
{
diff --git a/Client/ViewModels/ViewQuoteFileName.cs b/Client/ViewModels/ViewQuoteFileName.cs
index 317098c..4f89328 100644
--- a/Client/ViewModels/ViewQuoteFileName.cs
+++ b/Client/ViewModels/ViewQuoteFileName.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Client.ViewModels
{
diff --git a/Client/ViewModels/ViewQuoteSearch.cs b/Client/ViewModels/ViewQuoteSearch.cs
index 1077ec7..0cfdc72 100644
--- a/Client/ViewModels/ViewQuoteSearch.cs
+++ b/Client/ViewModels/ViewQuoteSearch.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
+// Ignore Spelling: Noftware Faux
+
using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Client.ViewModels
{
diff --git a/Core/Data/DataEventArgs.cs b/Core/Data/DataEventArgs.cs
index ce69b60..9b4577d 100644
--- a/Core/Data/DataEventArgs.cs
+++ b/Core/Data/DataEventArgs.cs
@@ -1,36 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using System;
namespace Noftware.In.Faux.Core.Data
{
///
/// Base class for all data-related event arguments.
///
- public abstract class DataEventArgs : EventArgs
+ /// Notification message.
+ /// Status of the operation.
+ public abstract class DataEventArgs(string message, OperationStatus status) : EventArgs
{
///
/// Notification message.
///
- public string Message { get; private set; }
+ public string Message { get; private set; } = message;
///
/// Status of the operation.
///
- public OperationStatus Status { get; set; }
-
- ///
- /// Constructor.
- ///
- /// Notification message.
- /// Status of the operation.
- public DataEventArgs(string message, OperationStatus status)
- {
- this.Status = status;
- this.Message = message;
- }
+ public OperationStatus Status { get; set; } = status;
}
///
diff --git a/Core/Data/FileShareEventArgs.cs b/Core/Data/FileShareEventArgs.cs
index de38046..6327c8c 100644
--- a/Core/Data/FileShareEventArgs.cs
+++ b/Core/Data/FileShareEventArgs.cs
@@ -1,21 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Data
{
///
/// Event arguments for Azure file share notifications.
///
- public class FileShareEventArgs : DataEventArgs
- {
- ///
- /// Constructor.
- ///
- /// Notification message.
- /// Status of the operation.
- public FileShareEventArgs(string message, OperationStatus operationStatus) : base(message, operationStatus) { }
- }
+ /// Notification message.
+ /// Status of the operation.
+ public class FileShareEventArgs(string message, OperationStatus operationStatus) : DataEventArgs(message, operationStatus) { }
}
diff --git a/Core/Data/IFileShareRepository.cs b/Core/Data/IFileShareRepository.cs
index d9d74f2..0aed4c0 100644
--- a/Core/Data/IFileShareRepository.cs
+++ b/Core/Data/IFileShareRepository.cs
@@ -1,17 +1,15 @@
-using Azure.Storage.Files.Shares.Models;
-using Noftware.In.Faux.Core.Models;
+// Ignore Spelling: Noftware Faux
+
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Core.Data
{
- ///
- /// Azure file share repository.
- ///
- public interface IFileShareRepository where TFile : File, new()
+ ///
+ /// Azure file share repository.
+ ///
+ public interface IFileShareRepository where TFile : File, new()
{
// https://www.serverless360.com/blog/azure-blob-storage-vs-file-storage
diff --git a/Core/Data/ITableRepository.cs b/Core/Data/ITableRepository.cs
index 7f9cddf..42288f2 100644
--- a/Core/Data/ITableRepository.cs
+++ b/Core/Data/ITableRepository.cs
@@ -1,8 +1,10 @@
-using Azure.Data.Tables;
-using Noftware.In.Faux.Core.Models;
+// Ignore Spelling: Noftware Faux
+
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Azure.Data.Tables;
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Core.Data
{
diff --git a/Core/Data/TableRepositoryEventArgs.cs b/Core/Data/TableRepositoryEventArgs.cs
index 47eb2a5..09ccc4e 100644
--- a/Core/Data/TableRepositoryEventArgs.cs
+++ b/Core/Data/TableRepositoryEventArgs.cs
@@ -1,21 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Data
{
///
/// Event arguments for Azure table repository notifications.
///
- public class TableRepositoryEventArgs : DataEventArgs
- {
- ///
- /// Constructor.
- ///
- /// Notification message.
- /// Status of the operation.
- public TableRepositoryEventArgs(string message, OperationStatus operationStatus) : base(message, operationStatus) { }
- }
+ /// Notification message.
+ /// Status of the operation.
+ public class TableRepositoryEventArgs(string message, OperationStatus operationStatus) : DataEventArgs(message, operationStatus) { }
}
diff --git a/Core/Extensions/NumericExtensions.cs b/Core/Extensions/NumericExtensions.cs
index e0525e6..68d69f2 100644
--- a/Core/Extensions/NumericExtensions.cs
+++ b/Core/Extensions/NumericExtensions.cs
@@ -1,8 +1,8 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
+using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Core.Extensions
{
diff --git a/Core/Extensions/ObjectExtensions.cs b/Core/Extensions/ObjectExtensions.cs
index 0c40251..daa2747 100644
--- a/Core/Extensions/ObjectExtensions.cs
+++ b/Core/Extensions/ObjectExtensions.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
using Dawn;
namespace Noftware.In.Faux.Core.Extensions
diff --git a/Core/Extensions/StringExtensions.cs b/Core/Extensions/StringExtensions.cs
index d473a44..43ceb1e 100644
--- a/Core/Extensions/StringExtensions.cs
+++ b/Core/Extensions/StringExtensions.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Extensions
{
@@ -26,7 +22,7 @@ public static string Pluralize(this string input, int count)
else
{
var newInput = input;
- if (input.EndsWith("y"))
+ if (input.EndsWith('y') == true)
{
newInput = newInput.TrimEnd('y');
newInput += "ie";
diff --git a/Core/Extensions/ThreadSafeRandom.cs b/Core/Extensions/ThreadSafeRandom.cs
index 744d2f0..0a080d3 100644
--- a/Core/Extensions/ThreadSafeRandom.cs
+++ b/Core/Extensions/ThreadSafeRandom.cs
@@ -1,9 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+// Ignore Spelling: Noftware Faux
+
+using System;
using System.Threading;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Core.Extensions
{
@@ -15,10 +13,10 @@ public static class ThreadSafeRandom
// https://stackoverflow.com/questions/3049467/is-c-sharp-random-number-generator-thread-safe/24648788#24648788
// Random number generator
- private static readonly System.Random _globalRandom = new Random();
+ private static readonly System.Random _globalRandom = new();
// ThreadLocal: Provides thread-local storage of data.
- private static readonly ThreadLocal _localRandom = new ThreadLocal(() =>
+ private static readonly ThreadLocal _localRandom = new(() =>
{
lock (_globalRandom)
{
diff --git a/Core/In.Faux.Core.csproj b/Core/In.Faux.Core.csproj
index 73fea91..09f0e12 100644
--- a/Core/In.Faux.Core.csproj
+++ b/Core/In.Faux.Core.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
Noftware.In.Faux.Core
Noftware.In.Faux.Core
Library
@@ -16,8 +16,8 @@
-
-
+
+
diff --git a/Core/Models/BaseTableEntity.cs b/Core/Models/BaseTableEntity.cs
index 47dfe90..e3efaad 100644
--- a/Core/Models/BaseTableEntity.cs
+++ b/Core/Models/BaseTableEntity.cs
@@ -1,10 +1,8 @@
-using Azure;
-using Azure.Data.Tables;
+// Ignore Spelling: Noftware Faux
+
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Azure;
+using Azure.Data.Tables;
namespace Noftware.In.Faux.Core.Models
{
diff --git a/Core/Models/File.cs b/Core/Models/File.cs
index 8beea9c..5b424e7 100644
--- a/Core/Models/File.cs
+++ b/Core/Models/File.cs
@@ -1,9 +1,4 @@
-using Azure.Storage.Files.Shares;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Models
{
diff --git a/Core/Models/ParsedQuote.cs b/Core/Models/ParsedQuote.cs
index 3378c9b..78bbaa7 100644
--- a/Core/Models/ParsedQuote.cs
+++ b/Core/Models/ParsedQuote.cs
@@ -1,15 +1,14 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Core.Models
{
- ///
- /// A quote parsed from a source text file.
- ///
- public class ParsedQuote
+ ///
+ /// A quote parsed from a source text file.
+ ///
+ public class ParsedQuote
{
///
/// Source line.
diff --git a/Core/Models/Quote.cs b/Core/Models/Quote.cs
index 48a07f7..ec21a67 100644
--- a/Core/Models/Quote.cs
+++ b/Core/Models/Quote.cs
@@ -1,6 +1,6 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
-using System.Text;
namespace Noftware.In.Faux.Core.Models
{
diff --git a/Core/Models/QuoteParserSettings.cs b/Core/Models/QuoteParserSettings.cs
index 394b4fe..b7a971c 100644
--- a/Core/Models/QuoteParserSettings.cs
+++ b/Core/Models/QuoteParserSettings.cs
@@ -1,15 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Models
{
- ///
- /// Settings for the quote flat file parser and image resizing.
- ///
- public class QuoteParserSettings
+ ///
+ /// Settings for the quote flat file parser and image resizing.
+ ///
+ public class QuoteParserSettings
{
///
/// Maximum resized dimension in pixels.
diff --git a/Core/Models/TableEntityFilter.cs b/Core/Models/TableEntityFilter.cs
index f87e0d2..173be9d 100644
--- a/Core/Models/TableEntityFilter.cs
+++ b/Core/Models/TableEntityFilter.cs
@@ -1,14 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Models
{
- ///
- /// A single Azure table entity filter to be used in the filter builder.
- ///
- public class TableEntityFilter
+ ///
+ /// A single Azure table entity filter to be used in the filter builder.
+ ///
+ public class TableEntityFilter
{
///
/// Boolean operator.
diff --git a/Core/Models/TableEntityFilterBuilder.cs b/Core/Models/TableEntityFilterBuilder.cs
index 1e72f8b..c30954c 100644
--- a/Core/Models/TableEntityFilterBuilder.cs
+++ b/Core/Models/TableEntityFilterBuilder.cs
@@ -1,22 +1,23 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Core.Models
{
- ///
- /// Azure table entity filter builder.
- ///
- public class TableEntityFilterBuilder
+ ///
+ /// Azure table entity filter builder.
+ ///
+ public class TableEntityFilterBuilder
{
- ///
- /// Based on one or more filter expressions, build a filter for an Azure table query.
- ///
- /// One of more filters.
- /// filter or null, if the filters parameter is empty.
- public string Build(IEnumerable filters)
+ ///
+ /// Based on one or more filter expressions, build a filter for an Azure table query.
+ ///
+ /// One of more filters.
+ /// filter or null, if the filters parameter is empty.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "")]
+ public string Build(IEnumerable filters)
{
if (filters?.Any() == false)
{
diff --git a/Core/Noftware.In.Faux.Core.xml b/Core/Noftware.In.Faux.Core.xml
index f8672a5..4ec8ca1 100644
--- a/Core/Noftware.In.Faux.Core.xml
+++ b/Core/Noftware.In.Faux.Core.xml
@@ -8,6 +8,15 @@
Base class for all data-related event arguments.
+ Notification message.
+ Status of the operation.
+
+
+
+ Base class for all data-related event arguments.
+
+ Notification message.
+ Status of the operation.
@@ -19,13 +28,6 @@
Status of the operation.
-
-
- Constructor.
-
- Notification message.
- Status of the operation.
-
Status of the operation.
@@ -50,10 +52,12 @@
Event arguments for Azure file share notifications.
+ Notification message.
+ Status of the operation.
- Constructor.
+ Event arguments for Azure file share notifications.
Notification message.
Status of the operation.
@@ -156,10 +160,12 @@
Event arguments for Azure table repository notifications.
+ Notification message.
+ Status of the operation.
- Constructor.
+ Event arguments for Azure table repository notifications.
Notification message.
Status of the operation.
diff --git a/Core/Services/ICacheService.cs b/Core/Services/ICacheService.cs
index 2514a85..4c3a655 100644
--- a/Core/Services/ICacheService.cs
+++ b/Core/Services/ICacheService.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+// Ignore Spelling: Noftware Faux
+
using System.Threading.Tasks;
namespace Noftware.In.Faux.Core.Services
diff --git a/Core/Services/IKeyVaultSettings.cs b/Core/Services/IKeyVaultSettings.cs
index 51d8ec1..87e82e4 100644
--- a/Core/Services/IKeyVaultSettings.cs
+++ b/Core/Services/IKeyVaultSettings.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
namespace Noftware.In.Faux.Core.Services
{
diff --git a/Core/Services/IQuoteParser.cs b/Core/Services/IQuoteParser.cs
index 2cf639b..7b73530 100644
--- a/Core/Services/IQuoteParser.cs
+++ b/Core/Services/IQuoteParser.cs
@@ -1,18 +1,16 @@
-using Noftware.In.Faux.Core.Models;
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Core.Services
{
- ///
- /// Parses a text file that contains quote data.
- /// Format: Quote text {Meaning/explanation text} [FileName] |Comma-separated keywords/tags|
- /// Example: Circle back {Following up on progress.} [CircleBack.png] |reach,contact,follow,up,follow-up,communicate|
- ///
- public interface IQuoteParser
+ ///
+ /// Parses a text file that contains quote data.
+ /// Format: Quote text {Meaning/explanation text} [FileName] |Comma-separated keywords/tags|
+ /// Example: Circle back {Following up on progress.} [CircleBack.png] |reach,contact,follow,up,follow-up,communicate|
+ ///
+ public interface IQuoteParser
{
///
/// Parses the quote text file.
diff --git a/Core/Services/IQuoteService.cs b/Core/Services/IQuoteService.cs
index 27d30ef..e63b5d7 100644
--- a/Core/Services/IQuoteService.cs
+++ b/Core/Services/IQuoteService.cs
@@ -1,10 +1,9 @@
-using Noftware.In.Faux.Core.Models;
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Core.Services
{
diff --git a/Data/Azure/Entities/OriginalImageFile.cs b/Data/Azure/Entities/OriginalImageFile.cs
index ab3283f..259b0fe 100644
--- a/Data/Azure/Entities/OriginalImageFile.cs
+++ b/Data/Azure/Entities/OriginalImageFile.cs
@@ -1,9 +1,6 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
diff --git a/Data/Azure/Entities/QuoteImpressionTableEntity.cs b/Data/Azure/Entities/QuoteImpressionTableEntity.cs
index 044ee61..3fb4749 100644
--- a/Data/Azure/Entities/QuoteImpressionTableEntity.cs
+++ b/Data/Azure/Entities/QuoteImpressionTableEntity.cs
@@ -1,9 +1,6 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
diff --git a/Data/Azure/Entities/QuoteMetadataTableEntity.cs b/Data/Azure/Entities/QuoteMetadataTableEntity.cs
index 617da74..3b2d1e7 100644
--- a/Data/Azure/Entities/QuoteMetadataTableEntity.cs
+++ b/Data/Azure/Entities/QuoteMetadataTableEntity.cs
@@ -1,9 +1,6 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux Metadata
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
diff --git a/Data/Azure/Entities/QuoteSearchIndexTableEntity.cs b/Data/Azure/Entities/QuoteSearchIndexTableEntity.cs
index 9ca286f..5b1f27d 100644
--- a/Data/Azure/Entities/QuoteSearchIndexTableEntity.cs
+++ b/Data/Azure/Entities/QuoteSearchIndexTableEntity.cs
@@ -1,16 +1,13 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
- ///
- /// Azure Table entity for quote search index.
- ///
- public class QuoteSearchIndexTableEntity : BaseTableEntity
+ ///
+ /// Azure Table entity for quote search index.
+ ///
+ public class QuoteSearchIndexTableEntity : BaseTableEntity
{
///
/// The indexed quote word.
diff --git a/Data/Azure/Entities/QuoteTableEntity.cs b/Data/Azure/Entities/QuoteTableEntity.cs
index d9aa8a6..8e95977 100644
--- a/Data/Azure/Entities/QuoteTableEntity.cs
+++ b/Data/Azure/Entities/QuoteTableEntity.cs
@@ -1,15 +1,13 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
- ///
- /// Azure Table entity for quote items.
- ///
- public class QuoteTableEntity : BaseTableEntity
+ ///
+ /// Azure Table entity for quote items.
+ ///
+ public class QuoteTableEntity : BaseTableEntity
{
///
/// The text.
diff --git a/Data/Azure/Entities/ResizedImageFile.cs b/Data/Azure/Entities/ResizedImageFile.cs
index 6735aec..a11249e 100644
--- a/Data/Azure/Entities/ResizedImageFile.cs
+++ b/Data/Azure/Entities/ResizedImageFile.cs
@@ -1,9 +1,6 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
diff --git a/Data/Azure/Entities/ThumbnailImageFile.cs b/Data/Azure/Entities/ThumbnailImageFile.cs
index 7c952c0..b8066d9 100644
--- a/Data/Azure/Entities/ThumbnailImageFile.cs
+++ b/Data/Azure/Entities/ThumbnailImageFile.cs
@@ -1,9 +1,6 @@
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Core.Models;
namespace Noftware.In.Faux.Data.Azure.Entities
{
diff --git a/Data/Azure/FileShareRepository.cs b/Data/Azure/FileShareRepository.cs
index efcc2d5..0409506 100644
--- a/Data/Azure/FileShareRepository.cs
+++ b/Data/Azure/FileShareRepository.cs
@@ -1,4 +1,6 @@
-using Azure;
+// Ignore Spelling: Noftware Faux
+
+using Azure;
using Azure.Storage.Files.Shares;
using Azure.Storage.Files.Shares.Models;
using Noftware.In.Faux.Core.Data;
@@ -242,7 +244,7 @@ public async Task AddOrUpdateAsync(TFile file)
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
{
// Create a memory stream for the buffer to upload
- using MemoryStream ms = new MemoryStream(buffer, 0, bytesRead);
+ using MemoryStream ms = new(buffer, 0, bytesRead);
var result = await fileClient.Value.UploadRangeAsync(new HttpRange(index, ms.Length), ms);
index += ms.Length; // increment the index to the account for bytes already written
}
diff --git a/Data/Azure/KeyVaultSettings.cs b/Data/Azure/KeyVaultSettings.cs
index bafdcf7..92ec302 100644
--- a/Data/Azure/KeyVaultSettings.cs
+++ b/Data/Azure/KeyVaultSettings.cs
@@ -1,9 +1,11 @@
-using System;
+// Ignore Spelling: Noftware Faux
+
+using System;
using Azure.Core;
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
-using Noftware.In.Faux.Data.Extensions;
using Noftware.In.Faux.Core.Services;
+using Noftware.In.Faux.Data.Extensions;
namespace Noftware.In.Faux.Data.Azure
{
@@ -128,7 +130,7 @@ public ParsedKey(string input)
}
// Does it contain a forward slash? If so, treat it as a version
- if (output.Contains("/") == true)
+ if (output.Contains('/') == true)
{
var items = output.Split('/');
this.KeyName = items[0];
diff --git a/Data/Azure/TableRepository.cs b/Data/Azure/TableRepository.cs
index 20c5c3a..aa82356 100644
--- a/Data/Azure/TableRepository.cs
+++ b/Data/Azure/TableRepository.cs
@@ -1,11 +1,13 @@
-using Azure;
+// Ignore Spelling: Noftware Faux
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Azure;
using Azure.Data.Tables;
using Azure.Data.Tables.Models;
using Noftware.In.Faux.Core.Data;
using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Azure
{
diff --git a/Data/Extensions/StringExtensions.cs b/Data/Extensions/StringExtensions.cs
index 6153f23..3dd1f30 100644
--- a/Data/Extensions/StringExtensions.cs
+++ b/Data/Extensions/StringExtensions.cs
@@ -1,15 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+// Ignore Spelling: Noftware Faux
+
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Extensions
{
- ///
- /// String extensions/helpers.
- ///
- public static class StringExtensions
+ ///
+ /// String extensions/helpers.
+ ///
+ public static class StringExtensions
{
///
/// Replace all text within the string while ignoring the case sensitivity.
diff --git a/Data/In.Faux.Data.csproj b/Data/In.Faux.Data.csproj
index 7b4e1da..41f85ab 100644
--- a/Data/In.Faux.Data.csproj
+++ b/Data/In.Faux.Data.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
Noftware.In.Faux.Data
Noftware.In.Faux.Data
Library
@@ -12,11 +12,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Data/Noftware.In.Faux.Data.xml b/Data/Noftware.In.Faux.Data.xml
index 02bf78b..8fe99a5 100644
--- a/Data/Noftware.In.Faux.Data.xml
+++ b/Data/Noftware.In.Faux.Data.xml
@@ -328,43 +328,65 @@
The Azure file share repository for original images. These are the original/untouched images from the source directory.
+
+ Constructor to set the Azure storage connection string.
+
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure file share repository for original images. These are the original/untouched images from the source directory.
+
+ Constructor to set the Azure storage connection string.
+
Azure storage connection string.
The Azure table repository for the quote impressions.
+
+ Constructor to set the Azure storage connection string.
+
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure table repository for the quote impressions.
+
+ Constructor to set the Azure storage connection string.
+
Azure storage connection string.
The Azure table repository for the single quote metadata item.
+
+ Constructor to set the Azure storage connection string.
+
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure table repository for the single quote metadata item.
+
+ Constructor to set the Azure storage connection string.
+
Azure storage connection string.
The Azure table repository for the quote search index.
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure table repository for the quote search index.
Azure storage connection string.
@@ -372,10 +394,11 @@
The Azure table repository for quotes.
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure table repository for quotes.
Azure storage connection string.
@@ -383,21 +406,29 @@
The Azure file share repository for resized images. These are the ones shown with each quote.
+
+ Constructor to set the Azure storage connection string.
+
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure file share repository for resized images. These are the ones shown with each quote.
+
+ Constructor to set the Azure storage connection string.
+
Azure storage connection string.
The Azure file share repository for thumbnail images. These are the ones shown with multiple search results.
+ Azure storage connection string.
- Constructor to set the Azure storage connection string.
+ The Azure file share repository for thumbnail images. These are the ones shown with multiple search results.
Azure storage connection string.
@@ -451,11 +482,21 @@
Format: Quote text {Meaning/explanation text} [FileName] |Comma-separated keywords/tags|
Example: Circle back {Following up on progress.} [CircleBack.png] |reach,contact,follow,up,follow-up,communicate|
+
+ Constructor.
+
+ Settings for the parser.
+
- Constructor.
+ Parses a text file that contains quote data.
+ Format: Quote text {Meaning/explanation text} [FileName] |Comma-separated keywords/tags|
+ Example: Circle back {Following up on progress.} [CircleBack.png] |reach,contact,follow,up,follow-up,communicate|
+
+ Constructor.
+
Settings for the parser.
@@ -485,10 +526,16 @@
Service for obtaining quote items from the data store.
+ Azure Table repository for quotes.
+ Azure Table repository for a single quote metadata item.
+ Azure Table repository for the quote search index.
+ Azure Table repository for the quote impressions.
+ Azure file share repository for resized quote images.
+ Azure file share repository for thumbnail quote images.
- Constructor.
+ Service for obtaining quote items from the data store.
Azure Table repository for quotes.
Azure Table repository for a single quote metadata item.
diff --git a/Data/Repositories/OriginalQuoteFileShareRepository.cs b/Data/Repositories/OriginalQuoteFileShareRepository.cs
index 6832241..c621945 100644
--- a/Data/Repositories/OriginalQuoteFileShareRepository.cs
+++ b/Data/Repositories/OriginalQuoteFileShareRepository.cs
@@ -1,22 +1,16 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure file share repository for original images. These are the original/untouched images from the source directory.
///
- public class OriginalQuoteFileShareRepository : FileShareRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public OriginalQuoteFileShareRepository(string storageConnectionString) : base(storageConnectionString, "quote", "original") { }
- }
+ ///
+ /// Constructor to set the Azure storage connection string.
+ ///
+ /// Azure storage connection string.
+ public class OriginalQuoteFileShareRepository(string storageConnectionString) : FileShareRepository(storageConnectionString, "quote", "original") { }
}
diff --git a/Data/Repositories/QuoteImpressionTableRepository.cs b/Data/Repositories/QuoteImpressionTableRepository.cs
index 6a66619..0155fae 100644
--- a/Data/Repositories/QuoteImpressionTableRepository.cs
+++ b/Data/Repositories/QuoteImpressionTableRepository.cs
@@ -1,22 +1,16 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure table repository for the quote impressions.
///
- public class QuoteImpressionTableRepository : TableRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public QuoteImpressionTableRepository(string storageConnectionString) : base(storageConnectionString, "QuoteImpression", "QuoteImpression") { }
- }
+ ///
+ /// Constructor to set the Azure storage connection string.
+ ///
+ /// Azure storage connection string.
+ public class QuoteImpressionTableRepository(string storageConnectionString) : TableRepository(storageConnectionString, "QuoteImpression", "QuoteImpression") { }
}
diff --git a/Data/Repositories/QuoteMetadataTableRepository.cs b/Data/Repositories/QuoteMetadataTableRepository.cs
index eec791b..3eada5e 100644
--- a/Data/Repositories/QuoteMetadataTableRepository.cs
+++ b/Data/Repositories/QuoteMetadataTableRepository.cs
@@ -1,22 +1,16 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux Metadata
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure table repository for the single quote metadata item.
///
- public class QuoteMetadataTableRepository : TableRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public QuoteMetadataTableRepository(string storageConnectionString) : base(storageConnectionString, "QuoteMetadata", "QuoteMetadata") { }
- }
+ ///
+ /// Constructor to set the Azure storage connection string.
+ ///
+ /// Azure storage connection string.
+ public class QuoteMetadataTableRepository(string storageConnectionString) : TableRepository(storageConnectionString, "QuoteMetadata", "QuoteMetadata") { }
}
diff --git a/Data/Repositories/QuoteSearchIndexTableRepository.cs b/Data/Repositories/QuoteSearchIndexTableRepository.cs
index 14d7872..b61911d 100644
--- a/Data/Repositories/QuoteSearchIndexTableRepository.cs
+++ b/Data/Repositories/QuoteSearchIndexTableRepository.cs
@@ -1,4 +1,6 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
using Noftware.In.Faux.Core.Models;
using System;
@@ -6,17 +8,12 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure table repository for the quote search index.
///
- public class QuoteSearchIndexTableRepository : TableRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public QuoteSearchIndexTableRepository(string storageConnectionString) : base(storageConnectionString, "QuoteSearchIndex", "QuoteSearchIndex") { }
- }
+ /// Azure storage connection string.
+ public class QuoteSearchIndexTableRepository(string storageConnectionString) : TableRepository(storageConnectionString, "QuoteSearchIndex", "QuoteSearchIndex") { }
}
diff --git a/Data/Repositories/QuoteTableRepository.cs b/Data/Repositories/QuoteTableRepository.cs
index c741f21..2655fea 100644
--- a/Data/Repositories/QuoteTableRepository.cs
+++ b/Data/Repositories/QuoteTableRepository.cs
@@ -1,23 +1,13 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using Noftware.In.Faux.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure table repository for quotes.
///
- public class QuoteTableRepository : TableRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public QuoteTableRepository(string storageConnectionString) : base(storageConnectionString, "Quote", "Quote") { }
- }
+ /// Azure storage connection string.
+ public class QuoteTableRepository(string storageConnectionString) : TableRepository(storageConnectionString, "Quote", "Quote") { }
}
diff --git a/Data/Repositories/ResizedQuoteFileShareRepository.cs b/Data/Repositories/ResizedQuoteFileShareRepository.cs
index a901056..2fbef53 100644
--- a/Data/Repositories/ResizedQuoteFileShareRepository.cs
+++ b/Data/Repositories/ResizedQuoteFileShareRepository.cs
@@ -1,22 +1,16 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure file share repository for resized images. These are the ones shown with each quote.
///
- public class ResizedQuoteFileShareRepository : FileShareRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public ResizedQuoteFileShareRepository(string storageConnectionString) : base(storageConnectionString, "quote", "resized") { }
- }
+ ///
+ /// Constructor to set the Azure storage connection string.
+ ///
+ /// Azure storage connection string.
+ public class ResizedQuoteFileShareRepository(string storageConnectionString) : FileShareRepository(storageConnectionString, "quote", "resized") { }
}
diff --git a/Data/Repositories/ThumbnailQuoteFileShareRepository.cs b/Data/Repositories/ThumbnailQuoteFileShareRepository.cs
index 3553b99..06fa266 100644
--- a/Data/Repositories/ThumbnailQuoteFileShareRepository.cs
+++ b/Data/Repositories/ThumbnailQuoteFileShareRepository.cs
@@ -1,22 +1,13 @@
-using Noftware.In.Faux.Data.Azure;
+// Ignore Spelling: Noftware Faux
+
+using Noftware.In.Faux.Data.Azure;
using Noftware.In.Faux.Data.Azure.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Noftware.In.Faux.Data.Repositories
{
///
/// The Azure file share repository for thumbnail images. These are the ones shown with multiple search results.
///
- public class ThumbnailQuoteFileShareRepository : FileShareRepository
- {
- ///
- /// Constructor to set the Azure storage connection string.
- ///
- /// Azure storage connection string.
- public ThumbnailQuoteFileShareRepository(string storageConnectionString) : base(storageConnectionString, "quote", "thumbnail") { }
- }
+ /// Azure storage connection string.
+ public class ThumbnailQuoteFileShareRepository(string storageConnectionString) : FileShareRepository(storageConnectionString, "quote", "thumbnail") { }
}
diff --git a/Data/Services/QuoteCacheService.cs b/Data/Services/QuoteCacheService.cs
index 87f57c6..68f9de5 100644
--- a/Data/Services/QuoteCacheService.cs
+++ b/Data/Services/QuoteCacheService.cs
@@ -1,10 +1,11 @@
-using Noftware.In.Faux.Core.Models;
-using Noftware.In.Faux.Core.Services;
-using Noftware.In.Faux.Core.Extensions;
-using System;
+// Ignore Spelling: Noftware Faux
+
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Noftware.In.Faux.Core.Extensions;
+using Noftware.In.Faux.Core.Models;
+using Noftware.In.Faux.Core.Services;
namespace Noftware.In.Faux.Data.Services
{
@@ -14,7 +15,7 @@ namespace Noftware.In.Faux.Data.Services
public class QuoteCacheService : ICacheService
{
// Cached list
- private readonly List _cachedQuotes = new List();
+ private readonly List _cachedQuotes = [];
///
/// Add or update a cached quote.
diff --git a/Data/Services/QuoteParser.cs b/Data/Services/QuoteParser.cs
index 3db6560..6da6eac 100644
--- a/Data/Services/QuoteParser.cs
+++ b/Data/Services/QuoteParser.cs
@@ -1,12 +1,13 @@
-using Noftware.In.Faux.Core.Models;
+// Ignore Spelling: Noftware Faux
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Noftware.In.Faux.Core.Models;
using Noftware.In.Faux.Core.Services;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Processing;
-using System.Collections.Generic;
-using System.Drawing;
-using System.IO;
-using System.Linq;
namespace Noftware.In.Faux.Data.Services
{
@@ -15,32 +16,20 @@ namespace Noftware.In.Faux.Data.Services
/// Format: Quote text {Meaning/explanation text} [FileName] |Comma-separated keywords/tags|
/// Example: Circle back {Following up on progress.} [CircleBack.png] |reach,contact,follow,up,follow-up,communicate|
///
- public class QuoteParser : IQuoteParser
+ ///
+ /// Constructor.
+ ///
+ /// Settings for the parser.
+ ///
+ public class QuoteParser(QuoteParserSettings settings, IQuoteService quoteService) : IQuoteParser
{
- // Settings for the parser
- private readonly QuoteParserSettings _settings;
-
- // Quote service to use BuildSearchWords()
- private readonly IQuoteService _quoteService;
-
- ///
- /// Constructor.
- ///
- /// Settings for the parser.
- ///
- public QuoteParser(QuoteParserSettings settings, IQuoteService quoteService)
- {
- _settings = settings;
- _quoteService = quoteService;
- }
-
///
/// Parses the quote text file.
///
///
public async IAsyncEnumerable ParseInputFileAsync()
{
- if (System.IO.File.Exists(_settings.QuoteTextFile) == false)
+ if (System.IO.File.Exists(settings.QuoteTextFile) == false)
{
yield return null;
}
@@ -53,7 +42,7 @@ public async IAsyncEnumerable ParseInputFileAsync()
string description;
string keywords;
- string[] lines = await System.IO.File.ReadAllLinesAsync(_settings.QuoteTextFile);
+ string[] lines = await System.IO.File.ReadAllLinesAsync(settings.QuoteTextFile);
foreach (var line in lines)
{
cleanLine = line?.Trim();
@@ -73,8 +62,8 @@ public async IAsyncEnumerable ParseInputFileAsync()
cleanLine.Contains('[') == true && cleanLine.Contains(']') == true)
{
// Meaning: Ensure index2 is after index1
- index1 = cleanLine.IndexOf("{");
- index2 = cleanLine.IndexOf("}");
+ index1 = cleanLine.IndexOf('{');
+ index2 = cleanLine.IndexOf('}');
if (index2 > index1)
{
description = cleanLine.Substring(index1 + 1, index2 - index1 - 1)?.Trim();
@@ -90,8 +79,8 @@ public async IAsyncEnumerable ParseInputFileAsync()
quote.Text = text;
// Image: Ensure index2 is after index1
- index1 = cleanLine.IndexOf("[");
- index2 = cleanLine.IndexOf("]");
+ index1 = cleanLine.IndexOf('[');
+ index2 = cleanLine.IndexOf(']');
if (index2 > index1)
{
filename = cleanLine.Substring(index1 + 1, index2 - index1 - 1)?.Trim();
@@ -101,13 +90,13 @@ public async IAsyncEnumerable ParseInputFileAsync()
if (quote.OriginalImage != null)
{
// Resized/display image
- ResizeImage(quote, (int)_settings.MaximumResizedImageDimension, out byte[] newImage, out int newHeight, out int newWidth);
+ ResizeImage(quote, (int)settings.MaximumResizedImageDimension, out byte[] newImage, out int newHeight, out int newWidth);
quote.ResizedImage = newImage;
quote.ResizedImageHeight = newHeight;
quote.ResizedImageWidth = newWidth;
// Thumbnail image
- ResizeImage(quote, (int)_settings.MaximumThumbnailImageDimension, out newImage, out newHeight, out newWidth);
+ ResizeImage(quote, (int)settings.MaximumThumbnailImageDimension, out newImage, out newHeight, out newWidth);
quote.ThumbnailImage = newImage;
quote.ThumbnailImageHeight = newHeight;
quote.ThumbnailImageWidth = newWidth;
@@ -119,8 +108,8 @@ public async IAsyncEnumerable ParseInputFileAsync()
}
// Keywords: Ensure index2 is after index1
- index1 = cleanLine.IndexOf("|");
- index2 = cleanLine.LastIndexOf("|");
+ index1 = cleanLine.IndexOf('|');
+ index2 = cleanLine.LastIndexOf('|');
if (index2 > index1)
{
keywords = cleanLine.Substring(index1 + 1, index2 - index1 - 1)?.Trim();
@@ -128,7 +117,7 @@ public async IAsyncEnumerable ParseInputFileAsync()
{
// Remove any spaces in the keywords and split on a comma
keywords = keywords.Replace(" ", string.Empty);
- quote.KeyWords = keywords.Split(new char[] { ',' });
+ quote.KeyWords = keywords.Split([',']);
}
else
{
@@ -145,7 +134,7 @@ public async IAsyncEnumerable ParseInputFileAsync()
if (string.IsNullOrWhiteSpace(quote.Text) == false)
{
// Get the search words from the Text
- var items = _quoteService.BuildSearchWords(quote.Text);
+ var items = quoteService.BuildSearchWords(quote.Text);
if (items?.Any() == true)
{
searchWords.AddRange(items);
@@ -154,7 +143,7 @@ public async IAsyncEnumerable ParseInputFileAsync()
if (string.IsNullOrWhiteSpace(quote.Description) == false)
{
// Get the search words from the Description
- var items = _quoteService.BuildSearchWords(quote.Description);
+ var items = quoteService.BuildSearchWords(quote.Description);
if (items?.Any() == true)
{
searchWords.AddRange(items);
@@ -184,7 +173,7 @@ public async IAsyncEnumerable ParseInputFileAsync()
private void LoadImage(ParsedQuote quote)
{
string filename = quote.FileName;
- string imageFile = System.IO.Path.Combine(_settings.InputImagePath, filename);
+ string imageFile = System.IO.Path.Combine(settings.InputImagePath, filename);
if (System.IO.File.Exists(imageFile) == false)
{
@@ -204,11 +193,11 @@ private void LoadImage(ParsedQuote quote)
else
{
// Load file and store as byte array
- using var image = SixLabors.ImageSharp.Image.Load(imageFile, out IImageFormat format);
+ using var image = SixLabors.ImageSharp.Image.Load(imageFile);
quote.OriginalImageHeight = image.Height;
quote.OriginalImageWidth = image.Width;
using var ms = new MemoryStream();
- image.Save(ms, format);
+ image.Save(ms, image.Metadata.DecodedImageFormat);
quote.OriginalImage = ms.ToArray();
}
}
@@ -273,7 +262,7 @@ private static void ResizeImage(ParsedQuote quote, int maximumDimension, out byt
newImageHeight = (int)newHeight;
newImageWidth = (int)newWidth;
- using var image = SixLabors.ImageSharp.Image.Load(quote.OriginalImage, out IImageFormat format);
+ using var image = SixLabors.ImageSharp.Image.Load(quote.OriginalImage);
int height = newImageHeight;
int width = newImageWidth;
@@ -281,7 +270,7 @@ private static void ResizeImage(ParsedQuote quote, int maximumDimension, out byt
.Resize(width, height));
using var ms = new MemoryStream();
- image.Save(ms, format);
+ image.Save(ms, image.Metadata.DecodedImageFormat);
newImageBytes = ms.ToArray();
}
}
diff --git a/Data/Services/QuoteService.cs b/Data/Services/QuoteService.cs
index 7b12b5f..ea187a3 100644
--- a/Data/Services/QuoteService.cs
+++ b/Data/Services/QuoteService.cs
@@ -1,67 +1,34 @@
-using Noftware.In.Faux.Core.Services;
-using Noftware.In.Faux.Data.Azure;
-using Noftware.In.Faux.Core.Models;
+// Ignore Spelling: Noftware Faux
+
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using System.Threading.Tasks;
+using Noftware.In.Faux.Core.Data;
using Noftware.In.Faux.Core.Extensions;
-using System.Security.Cryptography;
-using System.IO;
+using Noftware.In.Faux.Core.Models;
+using Noftware.In.Faux.Core.Services;
using Noftware.In.Faux.Data.Azure.Entities;
-using Noftware.In.Faux.Core.Data;
-using System.Text;
namespace Noftware.In.Faux.Data.Services
{
///
/// Service for obtaining quote items from the data store.
///
- public class QuoteService : IQuoteService
+ /// Azure Table repository for quotes.
+ /// Azure Table repository for a single quote metadata item.
+ /// Azure Table repository for the quote search index.
+ /// Azure Table repository for the quote impressions.
+ /// Azure file share repository for resized quote images.
+ /// Azure file share repository for thumbnail quote images.
+ public class QuoteService(ITableRepository quoteTableRepository,
+ ITableRepository quoteTablemetaDataRepository,
+ ITableRepository quoteSearchTableRepository,
+ ITableRepository quoteImpressionTableRepository,
+ IFileShareRepository resizedImageFileRepository,
+ IFileShareRepository thumbnailImageFileRepository) : IQuoteService
{
- // Azure Table repository for quotes
- private readonly ITableRepository _quoteTableRepository;
-
- // Azure Table repository for a single quote metadata item
- private readonly ITableRepository _quoteTableMetadataRepository;
-
- // Azure Table repository for the quote search index
- private readonly ITableRepository _quoteSearchTableRepository;
-
- // Azure Table repository for the quote search index
- private readonly ITableRepository _quoteImpressionTableRepository;
-
- // Azure file share repository for resized quote images
- private readonly IFileShareRepository _resizedImageFileRepository;
-
- // Azure file share repository for thumbnail quote images
- private readonly IFileShareRepository _thumbnailImageFileRepository;
-
- ///
- /// Constructor.
- ///
- /// Azure Table repository for quotes.
- /// Azure Table repository for a single quote metadata item.
- /// Azure Table repository for the quote search index.
- /// Azure Table repository for the quote impressions.
- /// Azure file share repository for resized quote images.
- /// Azure file share repository for thumbnail quote images.
- public QuoteService(ITableRepository quoteTableRepository,
- ITableRepository quoteTablemetaDataRepository,
- ITableRepository quoteSearchTableRepository,
- ITableRepository quoteImpressionTableRepository,
- IFileShareRepository resizedImageFileRepository,
- IFileShareRepository thumbnailImageFileRepository)
- {
- _quoteTableRepository = quoteTableRepository;
- _quoteTableMetadataRepository = quoteTablemetaDataRepository;
- _quoteSearchTableRepository = quoteSearchTableRepository;
- _quoteImpressionTableRepository = quoteImpressionTableRepository;
-
- _resizedImageFileRepository = resizedImageFileRepository;
- _thumbnailImageFileRepository = thumbnailImageFileRepository;
- }
-
///
/// Get a random quote from the data store.
///
@@ -69,7 +36,7 @@ public QuoteService(ITableRepository quoteTableRepository,
public async Task GetRandomQuoteAsync()
{
// This is only a single quote metadata record
- var quoteMetadata = await _quoteTableMetadataRepository.GetAsync("1", GetQuoteMetadataSelectFields());
+ var quoteMetadata = await quoteTablemetaDataRepository.GetAsync("1", GetQuoteMetadataSelectFields());
if (quoteMetadata is null)
{
return null;
@@ -82,7 +49,7 @@ public async Task GetRandomQuoteAsync()
int randomQuoteKey = ThreadSafeRandom.Next(1, totalQuoteCount + 1);
// Get the quote based on row key
- var quoteEntity = await _quoteTableRepository.GetAsync(randomQuoteKey.ToString(), GetQuoteSelectFields());
+ var quoteEntity = await quoteTableRepository.GetAsync(randomQuoteKey.ToString(), GetQuoteSelectFields());
if (quoteEntity is null)
{
return null;
@@ -110,11 +77,11 @@ public async Task GetRandomQuoteAsync()
///
public async Task GetResizedImageAsync(string quoteKey, string fileName)
{
- var file = await _resizedImageFileRepository.GetFileAsync(fileName);
+ var file = await resizedImageFileRepository.GetFileAsync(fileName);
string base64Image = (file is null ? null : System.Convert.ToBase64String(file.Contents));
// Add a new impression/view
- await _quoteImpressionTableRepository.AddOrUpdateAsync(new QuoteImpressionTableEntity()
+ await quoteImpressionTableRepository.AddOrUpdateAsync(new QuoteImpressionTableEntity()
{
QuoteRowKey = quoteKey,
PartitionKey = "QuoteImpression",
@@ -184,7 +151,7 @@ public async Task> SearchQuotesAsync(string searchPhrase)
}
// Search the search index for all matches and get a count of items by matches
- var searchedWords = await _quoteSearchTableRepository.SearchAsync(filters, selectFieldsSearch).ToListAsync();
+ var searchedWords = await quoteSearchTableRepository.SearchAsync(filters, selectFieldsSearch).ToListAsync();
var groupedSearchWords = searchedWords.GroupBy(g => g.QuoteRowKey)
.Select(group => new
{
@@ -203,12 +170,12 @@ public async Task> SearchQuotesAsync(string searchPhrase)
foreach (var groupedSearchWord in groupedSearchWords)
{
// Get the quote
- var quoteEntity = await _quoteTableRepository.GetAsync(groupedSearchWord.QuoteRowKey, selectFieldsQuote);
+ var quoteEntity = await quoteTableRepository.GetAsync(groupedSearchWord.QuoteRowKey, selectFieldsQuote);
if (quoteEntity != null)
{
// Get the thumbnail and build the return quote
- var resizedFile = await _resizedImageFileRepository.GetFileAsync(quoteEntity.FileName);
- var thumbnailFile = await _thumbnailImageFileRepository.GetFileAsync(quoteEntity.FileName);
+ var resizedFile = await resizedImageFileRepository.GetFileAsync(quoteEntity.FileName);
+ var thumbnailFile = await thumbnailImageFileRepository.GetFileAsync(quoteEntity.FileName);
var quote = new Quote()
{
@@ -285,12 +252,12 @@ public IEnumerable BuildSearchWords(string input)
/// Select columns.
private static string[] GetQuoteSelectFields()
{
- string[] selectFields = new string[] {
+ string[] selectFields = [
nameof(QuoteTableEntity.Description),
nameof(QuoteTableEntity.RowKey),
nameof(QuoteTableEntity.FileName),
nameof(QuoteTableEntity.Text)
- };
+ ];
return selectFields;
}
@@ -301,9 +268,9 @@ private static string[] GetQuoteSelectFields()
/// Select fields.
private static string[] GetQuoteMetadataSelectFields()
{
- string[] selectFields = new string[] {
+ string[] selectFields = [
nameof(QuoteMetadataTableEntity.QuoteTotalCount)
- };
+ ];
return selectFields;
}
@@ -314,10 +281,10 @@ private static string[] GetQuoteMetadataSelectFields()
/// Select fields.
private static string[] GetQuoteSearchSelectFields()
{
- string[] selectFields = new string[] {
+ string[] selectFields = [
nameof(QuoteSearchIndexTableEntity.QuoteRowKey),
nameof(QuoteSearchIndexTableEntity.Word)
- };
+ ];
return selectFields;
}
diff --git a/Function/In.Faux.Function.csproj b/Function/In.Faux.Function.csproj
index 70a3ffa..5b66c61 100644
--- a/Function/In.Faux.Function.csproj
+++ b/Function/In.Faux.Function.csproj
@@ -1,6 +1,6 @@
- net7.0
+ net8.0
v4
Exe
enable
@@ -12,11 +12,11 @@
S:\Sync\Dev\Blazor\InFaux\Function\Noftware.In.Faux.Function.xml
-
-
-
-
-
+
+
+
+
+
@@ -32,6 +32,6 @@
-
+
diff --git a/Function/Noftware.In.Faux.Function.xml b/Function/Noftware.In.Faux.Function.xml
index 7ad05d2..d395488 100644
--- a/Function/Noftware.In.Faux.Function.xml
+++ b/Function/Noftware.In.Faux.Function.xml
@@ -8,10 +8,11 @@
Get a random quote.
+ Quote service.
- DI constructor.
+ Get a random quote.
Quote service.
@@ -52,5 +53,35 @@
}
+
+
+ Custom implementation that returns function metadata definitions for the current worker."/>
+
+
+
+
+
+
+
+ Extension methods to enable registration of the custom implementation generated for the current worker.
+
+
+
+
+ Adds the GeneratedFunctionMetadataProvider to the service collection.
+ During initialization, the worker will return generated function metadata instead of relying on the Azure Functions host for function indexing.
+
+
+
+
+ Auto startup class to register the custom implementation generated for the current worker.
+
+
+
+
+ Configures the to use the custom implementation generated for the current worker.
+
+ The instance to use for service registration.
+
diff --git a/Function/QuoteFunction.cs b/Function/QuoteFunction.cs
index 9fb4ca2..cf0de9f 100644
--- a/Function/QuoteFunction.cs
+++ b/Function/QuoteFunction.cs
@@ -1,31 +1,22 @@
+// Ignore Spelling: Noftware Faux req
+
+using System.Dynamic;
+using System.Text.Json;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using Noftware.In.Faux.Core.Models;
using Noftware.In.Faux.Core.Services;
using Noftware.In.Faux.Data.Azure.Entities;
-using System.Dynamic;
-using System.Text.Json;
namespace Noftware.In.Faux.Function
{
///
/// Get a random quote.
///
- public class QuoteFunction
+ /// Quote service.
+ public class QuoteFunction(IQuoteService quoteService)
{
- // Quote service
- private readonly IQuoteService _quoteService;
-
- ///
- /// DI constructor.
- ///
- /// Quote service.
- public QuoteFunction(IQuoteService quoteService)
- {
- _quoteService = quoteService;
- }
-
///
/// Get a random quote.
///
@@ -38,9 +29,9 @@ public async Task GetRandomQuote([HttpTrigger(AuthorizationLev
{
var logger = executionContext.GetLogger(nameof(GetRandomQuote));
string caller = $"{typeof(QuoteFunction).Name}.{nameof(GetRandomQuote)}";
- logger.LogInformation(caller);
+ logger.LogInformation("{Message}", caller);
- var quote = await _quoteService.GetRandomQuoteAsync();
+ var quote = await quoteService.GetRandomQuoteAsync();
var response = req.CreateResponse(System.Net.HttpStatusCode.OK);
await response.WriteAsJsonAsync(quote);
@@ -67,14 +58,14 @@ public async Task GetResizedImage(
{
var logger = executionContext.GetLogger(nameof(GetResizedImage));
string caller = $"{typeof(QuoteFunction).Name}.{nameof(GetResizedImage)}";
- logger.LogInformation(caller);
+ logger.LogInformation("{Message}", caller);
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var data = JsonSerializer.Deserialize(requestBody);
- var quoteKey = data?.FirstOrDefault(f => f.Key.ToLower() == nameof(QuoteImpressionTableEntity.QuoteRowKey).ToLower()).Value?.ToString();
- var fileName = data?.FirstOrDefault(f => f.Key.ToLower() == nameof(ParsedQuote.FileName).ToLower()).Value?.ToString();
+ var quoteKey = data?.FirstOrDefault(f => f.Key.Equals(nameof(QuoteImpressionTableEntity.QuoteRowKey), StringComparison.CurrentCultureIgnoreCase)).Value?.ToString();
+ var fileName = data?.FirstOrDefault(f => f.Key.Equals(nameof(ParsedQuote.FileName), StringComparison.CurrentCultureIgnoreCase)).Value?.ToString();
- var base64Image = await _quoteService.GetResizedImageAsync(quoteKey, fileName);
+ var base64Image = await quoteService.GetResizedImageAsync(quoteKey, fileName);
var response = req.CreateResponse(System.Net.HttpStatusCode.OK);
await response.WriteStringAsync(base64Image);
@@ -100,13 +91,13 @@ public async Task SearchQuotes(
{
var logger = executionContext.GetLogger(nameof(SearchQuotes));
string caller = $"{typeof(QuoteFunction).Name}.{nameof(SearchQuotes)}";
- logger.LogInformation(caller);
+ logger.LogInformation("{Message}", caller);
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var data = JsonSerializer.Deserialize(requestBody);
- string? searchPhrase = data?.FirstOrDefault(f => f.Key.ToLower() == "phrase").Value?.ToString();
+ string? searchPhrase = data?.FirstOrDefault(f => f.Key.Equals("phrase", StringComparison.CurrentCultureIgnoreCase)).Value?.ToString();
- var searchResults = await _quoteService.SearchQuotesAsync(searchPhrase);
+ var searchResults = await quoteService.SearchQuotesAsync(searchPhrase);
var response = req.CreateResponse(System.Net.HttpStatusCode.OK);
await response.WriteAsJsonAsync>(searchResults);