diff --git a/Lombiq.HelpfulLibraries.Common/Extensions/RNGCryptoServiceProviderExtensions.cs b/Lombiq.HelpfulLibraries.Common/Extensions/RNGCryptoServiceProviderExtensions.cs deleted file mode 100644 index b740e190..00000000 --- a/Lombiq.HelpfulLibraries.Common/Extensions/RNGCryptoServiceProviderExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace System.Security.Cryptography; - -// The extension method should follow the naming of the original class. -#pragma warning disable S101 // Types should be named in PascalCase - -public static class RNGCryptoServiceProviderExtensions -#pragma warning restore S101 // Types should be named in PascalCase -{ - /// - /// Returns a non-negative cryptographically secure random integer that is within a specified range. - /// - /// The inclusive lower bound of the random number returned. - /// - /// The exclusive upper bound of the random number returned. must be greater than or - /// equal to . - /// - /// A cryptographically random number within the specified range. - /// - /// - /// Taken from . - /// - /// - [Obsolete("Since RNGCryptoServiceProvider is obsolete, use the similar extension on RandomNumberGenerator instead.")] - public static int Next(this RNGCryptoServiceProvider rng, int minValue, int maxValue) - { - if (minValue > maxValue) throw new ArgumentOutOfRangeException(nameof(minValue)); - if (minValue == maxValue) return minValue; - - var diff = (long)maxValue - minValue; - var uint32Buffer = new byte[4]; - - while (true) - { - rng.GetBytes(uint32Buffer); - var rand = BitConverter.ToUInt32(uint32Buffer, 0); - - const long max = 1 + (long)uint.MaxValue; - var remainder = max % diff; - if (rand < max - remainder) - { - return (int)(minValue + (rand % diff)); - } - } - } -} diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 1da1d468..27f311eb 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -25,6 +25,6 @@ - + diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/ManualConnectingIndexService.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/ManualConnectingIndexService.cs index 01b2359f..8d9b385a 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/ManualConnectingIndexService.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Data/ManualConnectingIndexService.cs @@ -82,7 +82,9 @@ async Task Run( { _tablePrefix ??= session?.Store.Configuration.TablePrefix; var dialect = session?.Store.Configuration.SqlDialect; - var quotedTableName = dialect?.QuoteForTableName(_tablePrefix + _type.Name); + var quotedTableName = dialect?.QuoteForTableName( + _tablePrefix + _type.Name, + session?.Store.Configuration.Schema); var result = await request(transaction.Connection, transaction, dialect, quotedTableName); if (doCommit) await transaction.CommitAsync(); diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/SessionExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/SessionExtensions.cs index a7a4248f..472af7f6 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/SessionExtensions.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/Data/SessionExtensions.cs @@ -73,6 +73,7 @@ private static string GetQuery( { var parserResult = SqlParser.TryParse( sql, + session.Store.Configuration.Schema, session.Store.Configuration.SqlDialect, session.Store.Configuration.TablePrefix, parameters: null, @@ -106,7 +107,7 @@ public static async Task UpdateDocumentDirectlyAsync(this ISession session var tableName = session.Store.Configuration.TablePrefix + session.Store.Configuration.TableNameConvention.GetDocumentTable(); - var sql = @$"UPDATE {dialect.QuoteForTableName(tableName)} + var sql = @$"UPDATE {dialect.QuoteForTableName(tableName, session.Store.Configuration.Schema)} SET {dialect.QuoteForColumnName("Content")} = @Content WHERE {dialect.QuoteForColumnName("Id")} = @Id"; diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Data/TransactionSqlDialectFactory.cs b/Lombiq.HelpfulLibraries.OrchardCore/Data/TransactionSqlDialectFactory.cs deleted file mode 100644 index 1d85f9a2..00000000 --- a/Lombiq.HelpfulLibraries.OrchardCore/Data/TransactionSqlDialectFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Data.Common; - -namespace YesSql; - -public static class TransactionSqlDialectFactory -{ - /// - /// Retrieves the for the given . - /// - [Obsolete("This is no longer supported since YesSql 3. Use ISession.Value.Store.Configuration.SqlDialect.")] - public static ISqlDialect For(DbTransaction transaction) => throw new NotSupportedException(); -} diff --git a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs index 8740ca7f..9facfdc8 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs +++ b/Lombiq.HelpfulLibraries.OrchardCore/GraphQL/TotalOfContentTypeBuilder.cs @@ -1,7 +1,6 @@ using GraphQL.Types; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; -using OrchardCore.Apis.GraphQL; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.GraphQL.Queries.Types; using OrchardCore.ContentManagement.Metadata.Models; @@ -30,7 +29,7 @@ public void Build(FieldType contentQuery, ContentTypeDefinition contentTypeDefin builder.ResolveAsync(async context => { - var serviceProvider = context.ResolveServiceProvider(); + var serviceProvider = context.RequestServices; var session = serviceProvider.GetService(); return await session.QueryIndex(index => index.Published && diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Liquid/LiquidTemplateManagerExtensions.cs b/Lombiq.HelpfulLibraries.OrchardCore/Liquid/LiquidTemplateManagerExtensions.cs deleted file mode 100644 index 7fb3bd65..00000000 --- a/Lombiq.HelpfulLibraries.OrchardCore/Liquid/LiquidTemplateManagerExtensions.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace OrchardCore.Liquid; - -[Obsolete("" + - "Use ILiquidTemplateManager.RenderStringAsync() instead of RenderLiquidExpressionAsync() and " + - "new Fluid.Values.ObjectValue(myObject) instead of SetJsonToTemplateContext().")] -public static class LiquidTemplateManagerExtensions -{ -} diff --git a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj index 95667c6e..f689f9c1 100644 --- a/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj +++ b/Lombiq.HelpfulLibraries.OrchardCore/Lombiq.HelpfulLibraries.OrchardCore.csproj @@ -24,26 +24,25 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + diff --git a/Lombiq.HelpfulLibraries.Samples/Controllers/LinqToDbSamplesController.cs b/Lombiq.HelpfulLibraries.Samples/Controllers/LinqToDbSamplesController.cs index de493a65..6cb79649 100644 --- a/Lombiq.HelpfulLibraries.Samples/Controllers/LinqToDbSamplesController.cs +++ b/Lombiq.HelpfulLibraries.Samples/Controllers/LinqToDbSamplesController.cs @@ -2,6 +2,7 @@ using Lombiq.HelpfulLibraries.LinqToDb; using Lombiq.HelpfulLibraries.Samples.Models; using Microsoft.AspNetCore.Mvc; +using OrchardCore.Autoroute.Core.Indexes; using OrchardCore.ContentManagement.Records; using System; using System.Collections.Generic; diff --git a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj index c89252bb..b3fe36a8 100644 --- a/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj +++ b/Lombiq.HelpfulLibraries.Samples/Lombiq.HelpfulLibraries.Samples.csproj @@ -12,12 +12,12 @@ - - - - - - + + + + + + diff --git a/Lombiq.HelpfulLibraries.Samples/Startup.cs b/Lombiq.HelpfulLibraries.Samples/Startup.cs index c6033461..43d16179 100644 --- a/Lombiq.HelpfulLibraries.Samples/Startup.cs +++ b/Lombiq.HelpfulLibraries.Samples/Startup.cs @@ -11,8 +11,8 @@ public class Startup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddScoped(); - services.AddScoped(); + services.AddDataMigration(); + services.AddDataMigration(); services.AddScoped(); } }