Files
Umbraco-CMS/tests/Umbraco.Tests.Common/TestHelpers/TestDatabase.cs

566 lines
27 KiB
C#
Raw Normal View History

// Copyright (c) Umbraco.
// See LICENSE for more details.
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Linq.Expressions;
Merge remote-tracking branch 'origin/v8/dev' into netcore/dev # Conflicts: # build/NuSpecs/UmbracoCms.Core.nuspec # build/NuSpecs/UmbracoCms.Web.nuspec # src/SolutionInfo.cs # src/Umbraco.Core/Cache/CacheKeys.cs # src/Umbraco.Core/Composing/TypeFinder.cs # src/Umbraco.Core/Configuration/GlobalSettings.cs # src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs # src/Umbraco.Core/Configuration/IGlobalSettings.cs # src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs # src/Umbraco.Core/Configuration/UmbracoSettings/ContentSectionExtensions.cs # src/Umbraco.Core/Constants-AppSettings.cs # src/Umbraco.Core/Editors/UserEditorAuthorizationHelper.cs # src/Umbraco.Core/Extensions/StringExtensions.cs # src/Umbraco.Core/Extensions/UriExtensions.cs # src/Umbraco.Core/IO/IOHelper.cs # src/Umbraco.Core/IO/PhysicalFileSystem.cs # src/Umbraco.Core/Media/Exif/MathEx.cs # src/Umbraco.Core/Media/UploadAutoFillProperties.cs # src/Umbraco.Core/Models/Mapping/UserMapDefinition.cs # src/Umbraco.Core/Models/Membership/User.cs # src/Umbraco.Core/Models/UserExtensions.cs # src/Umbraco.Core/Packaging/PackageDefinitionXmlParser.cs # src/Umbraco.Core/PropertyEditors/ListViewConfiguration.cs # src/Umbraco.Core/PropertyEditors/ValueConverters/MediaPickerValueConverter.cs # src/Umbraco.Core/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs # src/Umbraco.Core/Routing/AliasUrlProvider.cs # src/Umbraco.Core/Routing/DefaultUrlProvider.cs # src/Umbraco.Core/Routing/UriUtility.cs # src/Umbraco.Core/Routing/UrlProviderExtensions.cs # src/Umbraco.Core/Runtime/CoreRuntime.cs # src/Umbraco.Core/RuntimeOptions.cs # src/Umbraco.Core/RuntimeState.cs # src/Umbraco.Core/Security/BackOfficeUserStore.cs # src/Umbraco.Core/Security/ContentPermissions.cs # src/Umbraco.Core/Sync/ApplicationUrlHelper.cs # src/Umbraco.Core/Trees/TreeNode.cs # src/Umbraco.Core/Udi.cs # src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs # src/Umbraco.Examine/Umbraco.Examine.csproj # src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs # src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs # src/Umbraco.Infrastructure/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs # src/Umbraco.Infrastructure/Scoping/Scope.cs # src/Umbraco.Infrastructure/Search/ExamineComponent.cs # src/Umbraco.Infrastructure/Security/IdentityMapDefinition.cs # src/Umbraco.Infrastructure/Services/Implement/ContentService.cs # src/Umbraco.Infrastructure/Services/Implement/MediaService.cs # src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs # src/Umbraco.Persistence.SqlCe/SqlCeSyntaxProvider.cs # src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/LocksTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/UserExtensionsTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Editors/UserEditorAuthorizationHelperTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Examine/UmbracoContentValueSetValidatorTests.cs # src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs # src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config # src/Umbraco.Tests/TestHelpers/SettingsForTests.cs # src/Umbraco.Tests/Testing/TestDatabase.cs # src/Umbraco.Tests/Web/Controllers/ContentControllerUnitTests.cs # src/Umbraco.Tests/Web/Controllers/FilterAllowedOutgoingContentAttributeTests.cs # src/Umbraco.Tests/Web/Controllers/MediaControllerUnitTests.cs # src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs # src/Umbraco.Web.BackOffice/Controllers/CodeFileController.cs # src/Umbraco.Web.BackOffice/Controllers/ContentController.cs # src/Umbraco.Web.BackOffice/Controllers/EntityController.cs # src/Umbraco.Web.BackOffice/Controllers/MacrosController.cs # src/Umbraco.Web.BackOffice/Controllers/MediaController.cs # src/Umbraco.Web.BackOffice/Controllers/PackageInstallController.cs # src/Umbraco.Web.BackOffice/Controllers/TourController.cs # src/Umbraco.Web.BackOffice/Controllers/UserGroupEditorAuthorizationHelper.cs # src/Umbraco.Web.BackOffice/Filters/FilterAllowedOutgoingContentAttribute.cs # src/Umbraco.Web.BackOffice/Filters/FilterAllowedOutgoingMediaAttribute.cs # src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs # src/Umbraco.Web.BackOffice/Services/IconService.cs # src/Umbraco.Web.BackOffice/Trees/ContentTreeController.cs # src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs # src/Umbraco.Web.BackOffice/Trees/FileSystemTreeController.cs # src/Umbraco.Web.BackOffice/Trees/MediaTreeController.cs # src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs # src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js # src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html # src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml # src/Umbraco.Web.UI/config/umbracoSettings.Release.config # src/Umbraco.Web/Cache/MemberCacheRefresher.cs # src/Umbraco.Web/Composing/ModuleInjector.cs # src/Umbraco.Web/Editors/BackOfficeController.cs # src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs # src/Umbraco.Web/Editors/ContentTypeController.cs # src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs # src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs # src/Umbraco.Web/Editors/Filters/UserGroupAuthorizationAttribute.cs # src/Umbraco.Web/Editors/TinyMceController.cs # src/Umbraco.Web/Editors/UserGroupsController.cs # src/Umbraco.Web/Editors/UsersController.cs # src/Umbraco.Web/ImageCropperTemplateExtensions.cs # src/Umbraco.Web/Logging/WebProfiler.cs # src/Umbraco.Web/Logging/WebProfilerProvider.cs # src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs # src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs # src/Umbraco.Web/Mvc/JsonNetResult.cs # src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs # src/Umbraco.Web/Mvc/RenderRouteHandler.cs # src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs # src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs # src/Umbraco.Web/RoutableDocumentFilter.cs # src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs # src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs # src/Umbraco.Web/Routing/PublishedRouter.cs # src/Umbraco.Web/Runtime/WebInitialComposer.cs # src/Umbraco.Web/Scheduling/KeepAlive.cs # src/Umbraco.Web/Security/AppBuilderExtensions.cs # src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs # src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs # src/Umbraco.Web/Trees/DictionaryTreeController.cs # src/Umbraco.Web/Trees/LanguageTreeController.cs # src/Umbraco.Web/Trees/LogViewerTreeController.cs # src/Umbraco.Web/Trees/PackagesTreeController.cs # src/Umbraco.Web/UmbracoApplication.cs # src/Umbraco.Web/UmbracoApplicationBase.cs # src/Umbraco.Web/UmbracoInjectedModule.cs # src/Umbraco.Web/WebApi/Filters/AdminUsersAuthorizeAttribute.cs # src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs # src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs # src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs # src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs
2021-03-05 15:36:27 +01:00
using Microsoft.Extensions.Options;
using Moq;
using NPoco;
using NPoco.DatabaseTypes;
using NPoco.Linq;
Merge remote-tracking branch 'origin/v8/dev' into netcore/dev # Conflicts: # build/NuSpecs/UmbracoCms.Core.nuspec # build/NuSpecs/UmbracoCms.Web.nuspec # src/SolutionInfo.cs # src/Umbraco.Core/Cache/CacheKeys.cs # src/Umbraco.Core/Composing/TypeFinder.cs # src/Umbraco.Core/Configuration/GlobalSettings.cs # src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs # src/Umbraco.Core/Configuration/IGlobalSettings.cs # src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs # src/Umbraco.Core/Configuration/UmbracoSettings/ContentSectionExtensions.cs # src/Umbraco.Core/Constants-AppSettings.cs # src/Umbraco.Core/Editors/UserEditorAuthorizationHelper.cs # src/Umbraco.Core/Extensions/StringExtensions.cs # src/Umbraco.Core/Extensions/UriExtensions.cs # src/Umbraco.Core/IO/IOHelper.cs # src/Umbraco.Core/IO/PhysicalFileSystem.cs # src/Umbraco.Core/Media/Exif/MathEx.cs # src/Umbraco.Core/Media/UploadAutoFillProperties.cs # src/Umbraco.Core/Models/Mapping/UserMapDefinition.cs # src/Umbraco.Core/Models/Membership/User.cs # src/Umbraco.Core/Models/UserExtensions.cs # src/Umbraco.Core/Packaging/PackageDefinitionXmlParser.cs # src/Umbraco.Core/PropertyEditors/ListViewConfiguration.cs # src/Umbraco.Core/PropertyEditors/ValueConverters/MediaPickerValueConverter.cs # src/Umbraco.Core/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs # src/Umbraco.Core/Routing/AliasUrlProvider.cs # src/Umbraco.Core/Routing/DefaultUrlProvider.cs # src/Umbraco.Core/Routing/UriUtility.cs # src/Umbraco.Core/Routing/UrlProviderExtensions.cs # src/Umbraco.Core/Runtime/CoreRuntime.cs # src/Umbraco.Core/RuntimeOptions.cs # src/Umbraco.Core/RuntimeState.cs # src/Umbraco.Core/Security/BackOfficeUserStore.cs # src/Umbraco.Core/Security/ContentPermissions.cs # src/Umbraco.Core/Sync/ApplicationUrlHelper.cs # src/Umbraco.Core/Trees/TreeNode.cs # src/Umbraco.Core/Udi.cs # src/Umbraco.Examine.Lucene/BackOfficeExamineSearcher.cs # src/Umbraco.Examine/Umbraco.Examine.csproj # src/Umbraco.Infrastructure/Examine/ContentValueSetValidator.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs # src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs # src/Umbraco.Infrastructure/Persistence/SqlSyntax/SqlServerSyntaxProvider.cs # src/Umbraco.Infrastructure/Scoping/Scope.cs # src/Umbraco.Infrastructure/Search/ExamineComponent.cs # src/Umbraco.Infrastructure/Security/IdentityMapDefinition.cs # src/Umbraco.Infrastructure/Services/Implement/ContentService.cs # src/Umbraco.Infrastructure/Services/Implement/MediaService.cs # src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs # src/Umbraco.Persistence.SqlCe/SqlCeSyntaxProvider.cs # src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/LocksTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/UserExtensionsTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Editors/UserEditorAuthorizationHelperTests.cs # src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Examine/UmbracoContentValueSetValidatorTests.cs # src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs # src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config # src/Umbraco.Tests/TestHelpers/SettingsForTests.cs # src/Umbraco.Tests/Testing/TestDatabase.cs # src/Umbraco.Tests/Web/Controllers/ContentControllerUnitTests.cs # src/Umbraco.Tests/Web/Controllers/FilterAllowedOutgoingContentAttributeTests.cs # src/Umbraco.Tests/Web/Controllers/MediaControllerUnitTests.cs # src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs # src/Umbraco.Web.BackOffice/Controllers/CodeFileController.cs # src/Umbraco.Web.BackOffice/Controllers/ContentController.cs # src/Umbraco.Web.BackOffice/Controllers/EntityController.cs # src/Umbraco.Web.BackOffice/Controllers/MacrosController.cs # src/Umbraco.Web.BackOffice/Controllers/MediaController.cs # src/Umbraco.Web.BackOffice/Controllers/PackageInstallController.cs # src/Umbraco.Web.BackOffice/Controllers/TourController.cs # src/Umbraco.Web.BackOffice/Controllers/UserGroupEditorAuthorizationHelper.cs # src/Umbraco.Web.BackOffice/Filters/FilterAllowedOutgoingContentAttribute.cs # src/Umbraco.Web.BackOffice/Filters/FilterAllowedOutgoingMediaAttribute.cs # src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs # src/Umbraco.Web.BackOffice/Services/IconService.cs # src/Umbraco.Web.BackOffice/Trees/ContentTreeController.cs # src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs # src/Umbraco.Web.BackOffice/Trees/FileSystemTreeController.cs # src/Umbraco.Web.BackOffice/Trees/MediaTreeController.cs # src/Umbraco.Web.Common/Extensions/FormCollectionExtensions.cs # src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js # src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.html # src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/media.controller.js # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml # src/Umbraco.Web.UI/config/umbracoSettings.Release.config # src/Umbraco.Web/Cache/MemberCacheRefresher.cs # src/Umbraco.Web/Composing/ModuleInjector.cs # src/Umbraco.Web/Editors/BackOfficeController.cs # src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs # src/Umbraco.Web/Editors/ContentTypeController.cs # src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs # src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs # src/Umbraco.Web/Editors/Filters/UserGroupAuthorizationAttribute.cs # src/Umbraco.Web/Editors/TinyMceController.cs # src/Umbraco.Web/Editors/UserGroupsController.cs # src/Umbraco.Web/Editors/UsersController.cs # src/Umbraco.Web/ImageCropperTemplateExtensions.cs # src/Umbraco.Web/Logging/WebProfiler.cs # src/Umbraco.Web/Logging/WebProfilerProvider.cs # src/Umbraco.Web/Macros/PublishedContentHashtableConverter.cs # src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs # src/Umbraco.Web/Mvc/JsonNetResult.cs # src/Umbraco.Web/Mvc/MemberAuthorizeAttribute.cs # src/Umbraco.Web/Mvc/RenderRouteHandler.cs # src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs # src/Umbraco.Web/PropertyEditors/MultiNodeTreePickerPropertyEditor.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs # src/Umbraco.Web/RoutableDocumentFilter.cs # src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs # src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs # src/Umbraco.Web/Routing/PublishedRouter.cs # src/Umbraco.Web/Runtime/WebInitialComposer.cs # src/Umbraco.Web/Scheduling/KeepAlive.cs # src/Umbraco.Web/Security/AppBuilderExtensions.cs # src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs # src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs # src/Umbraco.Web/Trees/DictionaryTreeController.cs # src/Umbraco.Web/Trees/LanguageTreeController.cs # src/Umbraco.Web/Trees/LogViewerTreeController.cs # src/Umbraco.Web/Trees/PackagesTreeController.cs # src/Umbraco.Web/UmbracoApplication.cs # src/Umbraco.Web/UmbracoApplicationBase.cs # src/Umbraco.Web/UmbracoInjectedModule.cs # src/Umbraco.Web/WebApi/Filters/AdminUsersAuthorizeAttribute.cs # src/Umbraco.Web/WebApi/Filters/CheckIfUserTicketDataIsStaleAttribute.cs # src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs # src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs # src/Umbraco.Web/WebApi/MemberAuthorizeAttribute.cs
2021-03-05 15:36:27 +01:00
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Infrastructure.Migrations.Install;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax;
v10 SQLite support + distributed locking abstractions (#11922) * Created Persistence.SQLite project skeleton. * SQLite database initialization * Various changes and hacks to make things work. * WIP integration tests * Fix thread safety tests * Fix tests that relied on tie breaker sorting. Spent a fair amount of time looking for a less lazy fix but gave up. * Convert right join to left join ContentTypeRepository.PerformGetByQuery SQLite doesn't support right join * Fix test Can_Generate_Delete_SubQuery_Statement Worth noting that NPoco.DatabaseTypes.SQLiteDatabaseType doesn't override EscapeSqlIdentifier so NPoco will escape with []. SQLite docs say > "A keyword enclosed in square brackets is an identifier. This is not standard SQL. This quoting mechanism is used by MS Access and SQL Server and is included in SQLite for compatibility." Also could have updated SqliteSyntaxProvider to match npoco but decided against it. * Fixes for paginated custom order by * Fix tests broken by lack of unique indexes. * Fix SqlServerTableByTableTest tests. These tests didn't actually do anything as the tables already exist so schema creator just returned. Did however point out that the default implementation for DoesTableExist just returns false so added a default naive implementation. * Fix ValidateLoginSession - SelectTop must come later * dry up database cleanup * Fix up db migration tests. We can't drop pk in sqlite without recreating table. Test looks to be testing that add column works as intended which we can test. * Prevent schema creation errors. * SQLite ignore lock tests, WAL back on. * Fix package schema tests * Fix NPocoFetchTests - case sensitivity not under test * Fix AdvancedMigrationTests (where possible) Migrations probably need a good look later. Maybe nuke old migrations and only support moving to v10 from v9. If we do that can do some cleanup. * Cleanup test database configuration * Run integration tests against SQLite on build agent. * Drop MS.Data.SQLite System.Data.SQLite was quicker to roll out due to more CLR type mapping * YAML * Skip Umbraco.Tests.Integration.SqlCe * Drop SqlServerTableByTable tests. Until this week they did nothing anyway as they with NewSchemaPerTest so the tests all passed as CreateTable was no op (already exists). Also all of the tables are created in an empty database by SchemaValidationTest.cs DatabaseSchemaCreation_Produces_DatabaseSchemaResult_With_Zero_Errors * Might aswell run against macOS also. * Copy azure pipelines task header layout * Delete SQLCe projects * Remove SQL CE specific code. * Remove SQL CE NuSpec, template params, build script setup * Delete umbraco-netcore-only.sln * Add SkipTests solution configuration and use for codeql * Remove reference to deleted nuspec file. * Refactor ConnectionStrings WRT DataDirectory placeholder & ProviderName. At this point you can try out SQLite support by setting the following in appsettings.json and then completing the install process. "ConnectionStrings": { "umbracoDbDSN": "Data Source=|DataDirectory|/umbraco.sqlite", "umbracoDbDSN_ProviderName": "System.Data.SQLite" }, Not currently possible via installer UI without provider name pre-set in configuration. * Switch to Microsoft.Data.Sqlite Some gross hacks but will be good to find out if this works with apple silicon. * Enable selection of SQLite via installer UI (also quick install) * Remove SqlServerDbProviderFactoryCreator to cleanup a TODO * Move SQL Server support to its own class library * Add persistence dependencies to Umbraco.CMS metapackage * Bugfix packages delete query Created invalid query for SQLite. * Try out cypress tests Linux + SQLite * Prevent cypress test artifact upload failure on attempt 2+ * LocalDb bugfixes * Drop redundant enum * Move SqlClient constant * Misc whitespace * Remove IsSqlCe extension (TODO: drop non 9->10 migrations later). * Umbraco.Persistence.* -> Umbraco.Cms.Persistence.* * Display quick install defaults and per provider default database name. * Misc remove old comment * little re-arrange * Remove almost all usages of IsSqlite extension. * visual adjustments * Custom Database Configuration is last step and should then say Install. * use text instead of disabled inputs * move legend, rename to Install * Update SqlMainDomLock to work without distributed locks. * Added IDistributedLockingMechanism interface and in memory impl. * Drop locking from ISqlSyntaxProvider & wire up scope to abstraction. * Added SqlServerDistributedLockingMechanism * Move distributed locking interfaces and exceptions to Core + xmldocs. * Fix tests, Misc cleanup, Add SQL distributed locking integration tests * Provide mechanism to specify DistributedLockingMechanism in config (even if added by composer) * Nomplementation -> NoImplementation * Fix misleading comment * Integration tests use SqlServerDistributedLockingMechanism when possible * Handle up-gradable locks SqlServerDistributedLockingMechanism. TODO: InMemoryDistributedLockingMechanism. Note: Nuked SqlServerDistributedLockingMechanismTests, will still sleep at night. Is covered by Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.LockTests * Make tests pass for InMemoryDistributedLockingMechanism, pretty hacky. * Tweak constraints on WithCollectionBuilder so i can drop bad constructor * Added SqliteDistributedLockingMechanism * Dropped InMemoryDistributedMechanism + magic InMemoryDistributedMechanism was pretty rubbish and now we have a decent implementation for SQLite as we no longer block readers see 8d1f42b. Also drop the CollectionBuilder setup, instead do the same as we do for syntax providers etc, it's more automagical so we never require an explicit selection although we are allowing for it. However keeping the optional IUmbracoBuilder constructor param for CollectionBuilders as it's extremely useful. * Fix quick install "" database name. * Hide Database Configuration section when a connection string is pre-set. Doesn't seem worth it to extract db name from connection string. * Ensure wal test 2+ * Fix logging inconsistencies. * Ensure in transaction when obtaining locks + no-op the SQLite read lock. There's no point in running the query just to make a single test pass. * Fix installer database display names * Allow SQLite shared cache without losing deferred transactions * Opt into shared cache for new SQLite databases + fix filename * Fix misc inconsistency in .gitignore * Prefer our interceptor interface * Restore DEBUG_DATABASES code OnConnectionOpened in case it's used. * Back to private cache. * Added retry strategy for SQLite + refactor out SQL server specific stuff * Fix SQL server tests. * Misc - Orphaned comment, incorrect casing. * InMemory SQLite test database & turn shared cache back on everywhere. Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
2022-03-11 16:14:20 +00:00
using Umbraco.Cms.Persistence.SqlServer.Services;
namespace Umbraco.Cms.Tests.Common.TestHelpers;
/// <summary>
/// An implementation of <see cref="IUmbracoDatabase" /> for tests.
/// </summary>
/// <remarks>
/// <para>Supports writing to the database, and logs Sql statements.</para>
/// <para>Cannot support reading from the database, and throws.</para>
/// <para>Tries to pretend it supports transactions, connections, etc. as best as possible.</para>
/// </remarks>
public class TestDatabase : IUmbracoDatabase
{
/// <summary>
/// Initializes a new instance of the <see cref="TestDatabase" /> class.
/// </summary>
/// <remarks>
/// <para>When both parameters are supplied, they should of course be consistent.</para>
/// </remarks>
public TestDatabase(DatabaseType databaseType = null, ISqlSyntaxProvider syntaxProvider = null)
{
DatabaseType = databaseType ?? new SqlServerDatabaseType();
SqlContext = new SqlContext(syntaxProvider ?? new SqlServerSyntaxProvider(Options.Create(new GlobalSettings())), DatabaseType, Mock.Of<IPocoDataFactory>());
}
/// <summary>
/// Gets the database operations.
/// </summary>
public List<Operation> Operations { get; } = new();
public void Dispose()
{
}
public IDatabase OpenSharedConnection() => this;
public void CloseSharedConnection()
{
}
(List<T1>, List<T2>, List<T3>, List<T4>) IDatabaseQuery.FetchMultiple<T1, T2, T3, T4>(Sql sql) =>
throw new NotImplementedException();
public int OneTimeCommandTimeout { get; set; }
public MapperCollection Mappers { get; set; }
public IPocoDataFactory PocoDataFactory { get; set; }
public DatabaseType DatabaseType { get; }
public List<IInterceptor> Interceptors { get; }
public string ConnectionString { get; }
public DbConnection Connection { get; }
public DbTransaction Transaction { get; }
2022-01-18 15:23:53 +00:00
public IDictionary<string, object> Data { get; }
public int CommandTimeout { get; set; }
public ISqlContext SqlContext { get; }
public string InstanceId { get; }
public bool InTransaction { get; }
public bool EnableSqlCount { get; set; }
public int SqlCount { get; }
IMapperCollection IDatabaseConfig.Mappers { get => Mappers; set => throw new NotImplementedException(); }
IDatabaseType IDatabaseConfig.DatabaseType => DatabaseType;
public int BulkInsertRecords<T>(IEnumerable<T> records) => throw new NotImplementedException();
public bool IsUmbracoInstalled() => true;
public DatabaseSchemaResult ValidateSchema() => throw new NotImplementedException();
public DbParameter CreateParameter() => throw new NotImplementedException();
public void AddParameter(DbCommand cmd, object value) => throw new NotImplementedException();
public DbCommand
CreateCommand(DbConnection connection, CommandType commandType, string sql, params object[] args) =>
throw new NotImplementedException();
public ITransaction GetTransaction() => throw new NotImplementedException();
public ITransaction GetTransaction(IsolationLevel isolationLevel) => throw new NotImplementedException();
public void SetTransaction(DbTransaction tran) => throw new NotImplementedException();
public void BeginTransaction() => Operations.Add(new Operation("BEGIN"));
public void BeginTransaction(IsolationLevel isolationLevel) =>
Operations.Add(new Operation("BEGIN " + isolationLevel));
public void AbortTransaction() => Operations.Add(new Operation("ABORT"));
public void CompleteTransaction() => Operations.Add(new Operation("COMMIT"));
public int Execute(string sql, params object[] args)
{
Operations.Add(new Operation("EXECUTE", sql, args));
return default;
}
Merge remote-tracking branch 'origin/v8/dev' into netcore/feature/merge-v8-18-01-2021 # Conflicts: # .gitignore # build/NuSpecs/UmbracoCms.Core.nuspec # src/SolutionInfo.cs # src/Umbraco.Core/Configuration/UmbracoSettings/BackOfficeElement.cs # src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs # src/Umbraco.Core/Configuration/UmbracoSettings/IBackOfficeSection.cs # src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs # src/Umbraco.Core/IO/SystemFiles.cs # src/Umbraco.Core/Models/ContentBase.cs # src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs # src/Umbraco.Core/Persistence/UmbracoDatabaseExtensions.cs # src/Umbraco.Core/Runtime/CoreRuntime.cs # src/Umbraco.Core/RuntimeOptions.cs # src/Umbraco.Core/RuntimeState.cs # src/Umbraco.Core/Telemetry/TelemetryMarkerComponent.cs # src/Umbraco.Core/Telemetry/TelemetryMarkerComposer.cs # src/Umbraco.Examine/Umbraco.Examine.csproj # src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs # src/Umbraco.Infrastructure/Install/InstallStepCollection.cs # src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs # src/Umbraco.Infrastructure/Migrations/Install/DatabaseSchemaCreator.cs # src/Umbraco.Infrastructure/Runtime/SqlMainDomLock.cs # src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs # src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs # src/Umbraco.Tests/Runtimes/StandaloneTests.cs # src/Umbraco.Tests/Testing/TestDatabase.cs # src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs # src/Umbraco.Web.UI.Client/src/installer/steps/database.controller.js # src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/TextString.cshtml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml # src/Umbraco.Web.UI/Umbraco/config/lang/cs.xml # src/Umbraco.Web.UI/config/umbracoSettings.Release.config # src/Umbraco.Web/Composing/CompositionExtensions/Installer.cs # src/Umbraco.Web/Editors/PreviewController.cs # src/Umbraco.Web/Editors/UsersController.cs # src/Umbraco.Web/JavaScript/PreviewInitialize.js # src/Umbraco.Web/Telemetry/TelemetryComponent.cs # src/Umbraco.Web/UmbracoApplication.cs
2021-01-18 15:40:22 +01:00
public int Execute(Sql sql)
{
Operations.Add(new Operation("EXECUTE", sql.SQL, sql.Arguments));
return default;
}
public int Execute(string sql, CommandType commandType, params object[] args)
{
Operations.Add(new Operation("EXECUTE", sql, args));
return default;
}
public T ExecuteScalar<T>(string sql, params object[] args)
{
Operations.Add(new Operation("EXECUTE SCALAR", sql, args));
return default;
}
public T ExecuteScalar<T>(Sql sql)
{
Operations.Add(new Operation("EXECUTE SCALAR", sql.SQL, sql.Arguments));
return default;
}
public T ExecuteScalar<T>(string sql, CommandType commandType, params object[] args)
{
Operations.Add(new Operation("EXECUTE SCALAR", sql, args));
return default;
}
public Task<T> ExecuteScalarAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> ExecuteScalarAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<T> ExecuteScalarAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<int> ExecuteAsync(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<int> ExecuteAsync(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<int> ExecuteAsync(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<object> InsertAsync(string tableName, string primaryKeyName, object poco, CancellationToken token) =>
throw new NotImplementedException();
public object Insert<T>(string tableName, string primaryKeyName, bool autoIncrement, T poco) =>
throw new NotImplementedException();
public object Insert<T>(string tableName, string primaryKeyName, T poco) => throw new NotImplementedException();
public object Insert<T>(T poco) => throw new NotImplementedException();
public void InsertBulk<T>(IEnumerable<T> pocos, InsertBulkOptions? options) =>
throw new NotImplementedException();
public Task<object> InsertAsync<T>(T poco, CancellationToken token) => throw new NotImplementedException();
public Task InsertBulkAsync<T>(IEnumerable<T> pocos, InsertBulkOptions? options, CancellationToken token) =>
throw new NotImplementedException();
public Task<int> InsertBatchAsync<T>(IEnumerable<T> pocos, BatchOptions? options, CancellationToken token) =>
throw new NotImplementedException();
public Task<int> UpdateAsync(object poco, CancellationToken token) => throw new NotImplementedException();
public Task<int> UpdateAsync(object poco, IEnumerable<string> columns, CancellationToken token) => throw new NotImplementedException();
public Task<int> UpdateAsync<T>(T poco, Expression<Func<T, object>> fields, CancellationToken token) => throw new NotImplementedException();
public Task<int> UpdateBatchAsync<T>(IEnumerable<UpdateBatch<T>> pocos, BatchOptions? options, CancellationToken token) =>
throw new NotImplementedException();
public Task<int> DeleteAsync(object poco, CancellationToken token) => throw new NotImplementedException();
public IAsyncUpdateQueryProvider<T> UpdateManyAsync<T>() => throw new NotImplementedException();
public IAsyncDeleteQueryProvider<T> DeleteManyAsync<T>() => throw new NotImplementedException();
public Task<bool> IsNewAsync<T>(T poco, CancellationToken token) => throw new NotImplementedException();
public Task SaveAsync<T>(T poco, CancellationToken token) => throw new NotImplementedException();
int IDatabase.InsertBatch<T>(IEnumerable<T> pocos, BatchOptions options) => throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public int Update(string tableName, string primaryKeyName, object poco, object primaryKeyValue) =>
throw new NotImplementedException();
public int Update(string tableName, string primaryKeyName, object poco) => throw new NotImplementedException();
public int Update(string tableName, string primaryKeyName, object poco, object primaryKeyValue, IEnumerable<string> columns) => throw new NotImplementedException();
public int Update(string tableName, string primaryKeyName, object poco, IEnumerable<string> columns) =>
throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public int Update(object poco, IEnumerable<string> columns) => throw new NotImplementedException();
public int Update(object poco, object primaryKeyValue, IEnumerable<string> columns) =>
throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public int Update(object poco) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public int Update<T>(T poco, Expression<Func<T, object>> fields) => throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public int Update(object poco, object primaryKeyValue) => throw new NotImplementedException();
public int Update<T>(string sql, params object[] args) => throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public int Update<T>(Sql sql) => throw new NotImplementedException();
public int UpdateBatch<T>(IEnumerable<UpdateBatch<T>> pocos, BatchOptions options = null) =>
throw new NotImplementedException();
public IUpdateQueryProvider<T> UpdateMany<T>() => throw new NotImplementedException();
public int Delete(string tableName, string primaryKeyName, object poco) => throw new NotImplementedException();
public int Delete(string tableName, string primaryKeyName, object poco, object primaryKeyValue) =>
throw new NotImplementedException();
public int Delete(object poco) => throw new NotImplementedException();
public int Delete<T>(string sql, params object[] args) => throw new NotImplementedException();
public int Delete<T>(Sql sql) => throw new NotImplementedException();
public int Delete<T>(object pocoOrPrimaryKey) => throw new NotImplementedException();
public IDeleteQueryProvider<T> DeleteMany<T>() => throw new NotImplementedException();
public void Save<T>(T poco) => throw new NotImplementedException();
public bool IsNew<T>(T poco) => throw new NotImplementedException();
public List<object> Fetch(Type type, string sql, params object[] args) => throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public List<object> Fetch(Type type, Sql sql) => throw new NotImplementedException();
public IEnumerable<object> Query(Type type, string sql, params object[] args) =>
throw new NotImplementedException();
public IEnumerable<object> Query(Type type, Sql sql) => throw new NotImplementedException();
public List<T> Fetch<T>() => throw new NotImplementedException();
public List<T> Fetch<T>(string sql, params object[] args) => throw new NotImplementedException();
public List<T> Fetch<T>(Sql sql) => throw new NotImplementedException();
public List<T> Fetch<T>(long page, long itemsPerPage, string sql, params object[] args) =>
throw new NotImplementedException();
public List<T> Fetch<T>(long page, long itemsPerPage, Sql sql) => throw new NotImplementedException();
public Page<T> Page<T>(long page, long itemsPerPage, string sql, params object[] args) =>
throw new NotImplementedException();
public Page<T> Page<T>(long page, long itemsPerPage, Sql sql) => throw new NotImplementedException();
public List<T> SkipTake<T>(long skip, long take, string sql, params object[] args) =>
throw new NotImplementedException();
public List<T> SkipTake<T>(long skip, long take, Sql sql) => throw new NotImplementedException();
public List<T> FetchOneToMany<T>(Expression<Func<T, IList>> many, string sql, params object[] args) =>
throw new NotImplementedException();
public List<T> FetchOneToMany<T>(Expression<Func<T, IList>> many, Sql sql) => throw new NotImplementedException();
public List<T> FetchOneToMany<T>(Expression<Func<T, IList>> many, Func<T, object> idFunc, string sql, params object[] args) => throw new NotImplementedException();
public List<T> FetchOneToMany<T>(Expression<Func<T, IList>> many, Func<T, object> idFunc, Sql sql) =>
throw new NotImplementedException();
public IEnumerable<T> Query<T>(string sql, params object[] args) => throw new NotImplementedException();
public IEnumerable<T> Query<T>(Sql sql) => throw new NotImplementedException();
public IQueryProviderWithIncludes<T> Query<T>() => throw new NotImplementedException();
public T SingleById<T>(object primaryKey) => throw new NotImplementedException();
public T Single<T>(string sql, params object[] args) => throw new NotImplementedException();
public T SingleInto<T>(T instance, string sql, params object[] args) => throw new NotImplementedException();
public T SingleOrDefaultById<T>(object primaryKey) => throw new NotImplementedException();
public T SingleOrDefault<T>(string sql, params object[] args) => throw new NotImplementedException();
public T SingleOrDefaultInto<T>(T instance, string sql, params object[] args) =>
throw new NotImplementedException();
public T First<T>(string sql, params object[] args) => throw new NotImplementedException();
public T FirstInto<T>(T instance, string sql, params object[] args) => throw new NotImplementedException();
public T FirstOrDefault<T>(string sql, params object[] args) => throw new NotImplementedException();
public T FirstOrDefaultInto<T>(T instance, string sql, params object[] args) => throw new NotImplementedException();
public T Single<T>(Sql sql) => throw new NotImplementedException();
public T SingleInto<T>(T instance, Sql sql) => throw new NotImplementedException();
public T SingleOrDefault<T>(Sql sql) => throw new NotImplementedException();
public T SingleOrDefaultInto<T>(T instance, Sql sql) => throw new NotImplementedException();
public T First<T>(Sql sql) => throw new NotImplementedException();
public T FirstInto<T>(T instance, Sql sql) => throw new NotImplementedException();
public T FirstOrDefault<T>(Sql sql) => throw new NotImplementedException();
public T FirstOrDefaultInto<T>(T instance, Sql sql) => throw new NotImplementedException();
public Dictionary<TKey, TValue> Dictionary<TKey, TValue>(Sql sql) => throw new NotImplementedException();
public Dictionary<TKey, TValue> Dictionary<TKey, TValue>(string sql, params object[] args) =>
throw new NotImplementedException();
public bool Exists<T>(object primaryKey) => throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, string sql, params object[] args) =>
throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, string sql, params object[] args) => throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, string sql, params object[] args) => throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, Sql sql) =>
throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, Sql sql) =>
throw new NotImplementedException();
public TRet FetchMultiple<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, Sql sql) =>
throw new NotImplementedException();
(List<T1>, List<T2>) IDatabaseQuery.FetchMultiple<T1, T2>(string sql, params object[] args) =>
throw new NotImplementedException();
(List<T1>, List<T2>, List<T3>) IDatabaseQuery.FetchMultiple<T1, T2, T3>(string sql, params object[] args) =>
throw new NotImplementedException();
(List<T1>, List<T2>, List<T3>, List<T4>) IDatabaseQuery.FetchMultiple<T1, T2, T3, T4>(string sql, params object[] args) => throw new NotImplementedException();
(List<T1>, List<T2>) IDatabaseQuery.FetchMultiple<T1, T2>(Sql sql) => throw new NotImplementedException();
(List<T1>, List<T2>, List<T3>) IDatabaseQuery.FetchMultiple<T1, T2, T3>(Sql sql) =>
throw new NotImplementedException();
public Task<T> SingleAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> SingleAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<T> SingleAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> SingleOrDefaultAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> SingleOrDefaultAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<T> SingleOrDefaultAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Task<T> SingleByIdAsync<T>(object primaryKey, CancellationToken token) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Task<T> SingleOrDefaultByIdAsync<T>(object primaryKey, CancellationToken token) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Task<T> FirstAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Task<T> FirstAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<T> FirstAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> FirstOrDefaultAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<T> FirstOrDefaultAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<T> FirstOrDefaultAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public IAsyncQueryProviderWithIncludes<T> QueryAsync<T>() => throw new NotImplementedException();
IAsyncEnumerable<T> IAsyncQueryDatabase.QueryAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
IAsyncEnumerable<T> IAsyncQueryDatabase.QueryAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
IAsyncEnumerable<T> IAsyncQueryDatabase.QueryAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public IAsyncQueryProviderWithIncludes<T> QueryAsync<T>(CancellationToken token) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(string sql, CancellationToken token) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(CancellationToken token) => throw new NotImplementedException();
public Task<Page<T>> PageAsync<T>(long page, long itemsPerPage, string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<Page<T>> PageAsync<T>(long page, long itemsPerPage, string sql, object[] args, CancellationToken token) =>
throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<Page<T>> PageAsync<T>(long page, long itemsPerPage, Sql sql, CancellationToken token) => throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<List<T>> FetchAsync<T>(long page, long itemsPerPage, string sql, CancellationToken token) =>
throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<List<T>> FetchAsync<T>(long page, long itemsPerPage, string sql, object[] args, CancellationToken token) =>
throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(long page, long itemsPerPage, Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<List<T>> SkipTakeAsync<T>(long skip, long take, string sql, CancellationToken token) =>
throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<List<T>> SkipTakeAsync<T>(long skip, long take, string sql, object[] args, CancellationToken token) =>
throw new NotImplementedException();
public Task<List<T>> SkipTakeAsync<T>(long skip, long take, Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<TRet> FetchMultipleAsync<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<TRet> FetchMultipleAsync<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<TRet> FetchMultipleAsync<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, Sql sql, CancellationToken token) =>
throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Task<TRet> FetchMultipleAsync<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, Sql sql, CancellationToken token) =>
throw new NotImplementedException();
2018-03-30 10:16:21 +02:00
public Task<TRet> FetchMultipleAsync<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>)> FetchMultipleAsync<T1, T2>(string sql, object[] args, CancellationToken token) =>
throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>)> FetchMultipleAsync<T1, T2, T3>(string sql, object[] args, CancellationToken token) =>
throw new NotImplementedException();
2019-12-12 08:11:23 +01:00
public Task<(List<T1>, List<T2>, List<T3>, List<T4>)> FetchMultipleAsync<T1, T2, T3, T4>(string sql, object[] args, CancellationToken token) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>)> FetchMultipleAsync<T1, T2>(Sql sql, CancellationToken token) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>)> FetchMultipleAsync<T1, T2, T3>(Sql sql, CancellationToken token) =>
throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>, List<T4>)> FetchMultipleAsync<T1, T2, T3, T4>(Sql sql, CancellationToken token) =>
throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>)> FetchMultipleAsync<T1, T2>(string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>)> FetchMultipleAsync<T1, T2, T3>(string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>, List<T4>)> FetchMultipleAsync<T1, T2, T3, T4>(string sql, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public void BuildPageQueries<T>(long skip, long take, string sql, ref object[] args, out string sqlCount, out string sqlPage) => throw new NotImplementedException();
public void InsertBulk<T>(IEnumerable<T> pocos) => throw new NotImplementedException();
public void InsertBatch<T>(IEnumerable<T> pocos, BatchOptions options = null) =>
throw new NotImplementedException();
public Tuple<List<T1>, List<T2>> FetchMultiple<T1, T2>(string sql, params object[] args) =>
throw new NotImplementedException();
public Tuple<List<T1>, List<T2>, List<T3>> FetchMultiple<T1, T2, T3>(string sql, params object[] args) =>
throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Tuple<List<T1>, List<T2>, List<T3>, List<T4>>
FetchMultiple<T1, T2, T3, T4>(string sql, params object[] args) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Tuple<List<T1>, List<T2>> FetchMultiple<T1, T2>(Sql sql) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Tuple<List<T1>, List<T2>, List<T3>> FetchMultiple<T1, T2, T3>(Sql sql) =>
throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public Tuple<List<T1>, List<T2>, List<T3>, List<T4>> FetchMultiple<T1, T2, T3, T4>(Sql sql) =>
throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public IDatabase OpenSharedConnection(OpenConnectionOptions? options = null) => throw new NotImplementedException();
public Task<IAsyncDatabase> OpenSharedConnectionAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task<IAsyncDatabase> OpenSharedConnectionAsync(OpenConnectionOptions options, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task CloseSharedConnectionAsync() => throw new NotImplementedException();
public Task<IAsyncTransaction> GetTransactionAsync() => throw new NotImplementedException();
public Task<IAsyncTransaction> GetTransactionAsync(IsolationLevel isolationLevel) => throw new NotImplementedException();
public Task BeginTransactionAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task BeginTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task AbortTransactionAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException();
public Task CompleteTransactionAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
public ValueTask DisposeAsync() => throw new NotImplementedException();
2022-01-18 15:23:53 +00:00
/// <summary>
/// Represents a database operation.
/// </summary>
public class Operation
{
public Operation(string text) => Text = text;
2022-01-18 15:23:53 +00:00
public Operation(string text, string sql)
: this(text) => Sql = sql;
2022-01-18 15:23:53 +00:00
public Operation(string text, string sql, params object[] args)
: this(text, sql) => Args = args;
2022-01-18 15:23:53 +00:00
/// <summary>
/// Gets the operation text.
/// </summary>
public string Text { get; }
2022-01-18 15:23:53 +00:00
/// <summary>
/// Gets the operation Sql statement.
/// </summary>
public string Sql { get; }
/// <summary>
/// Gets the operation Sql arguments.
/// </summary>
public object[] Args { get; }
}
}