Files
Umbraco-CMS/tests/Umbraco.Tests.Common/TestHelpers/TestDatabase.cs
Nikolaj Geisle 64e7933d57 V11: Merge dev to contrib (#13363)
* Bump version

* Add IContextCache to deploy connectors (#13287)

* Add IContextCache and implementations

* Update connector interfaces to use IContextCache

* Minor cleanup

* Move DeployContextCache prefix to constant

* Move default implementations to obsolete methods

* Remove DeployContextCache and DictionaryCache

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Add IContextCache to deploy connectors (#13287)

* Add IContextCache and implementations

* Update connector interfaces to use IContextCache

* Minor cleanup

* Move DeployContextCache prefix to constant

* Move default implementations to obsolete methods

* Remove DeployContextCache and DictionaryCache

Co-authored-by: Andy Butland <abutland73@gmail.com>

* Parse lockId as invariant (#13284)

Co-authored-by: Zeegaan <nge@umbraco.dk>

* Fix Sqlite database locking issue (#13246)

* Add locking for creating scope

* Lock the repository instead

* Add scope in action instead of locking in service

* Fix up post-merge

Co-authored-by: Zeegaan <nge@umbraco.dk>

* Bump version to next minor

* Fix for UseExceptionHandler no longer working since v10.3 RC (#13218)

* Fix for UseExceptionHandler no longer working since v10.3 RC

* Update the management api path to match the new one

Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>

* New backoffice: Cleanup management API routes (#13296)

* Rename ModelsBuilderDashboard folder to ModelsBuilder

* Fix modelsbuilder paths and related naming

* Rename analytics route to telemetry

* Fix controller bases - routes and tags

* Fix items route

* Fix more controllerbase routes

* Fix route

* Fix OpenApi file

* Merging DictionaryItem and Dictionary

* Fix TrackedReferences naming

* Update OpenApi file

* Rename Analytics* related types to Telemetry*

* New Backoffice: Return AnalyticsLevelViewModel from Telemetry/ (#13298)

* Return TelemetryLevelViewModel instead of TelemetryLevel

* Fix schema

* Change telemetry/current to telemetry/level

(cherry picked from commit f2b8494c669cbbf04b623753abbf1be211973aa9)

* Add contants for tree and recycle-bin subpaths

(cherry picked from commit 4449f56bc00832ea6d357a3854b454791c80e0e2)

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Updated Smidge, Npoco and MailKit (#13310)

* Updated Smidge, Npoco and MailKit

* Added missing command (after breaking interface in npoco)

* OpenId Connect authentication for new management API (#13318)

* First attempt at OpenIddict

* Making headway and more TODOs

* Redo current policies for multiple schemas + clean up auth controller

* Fix bad merge

* Clean up some more test code

* Fix spacing

* Include AddAuthentication() in OpenIddict addition

* A little more clean-up

* Move application creation to its own implementation + prepare for middleware to handle valid callback URL

* Enable refresh token flow

* Fix bad merge from v11/dev

* Support auth for Swagger and Postman in non-production environments + use default login screen for back-office logins

* Add workaround to client side login handling so the OAuth return URL is not corrupted before redirection

* Add temporary configuration handling for new backoffice

* Restructure the code somewhat, move singular responsibility from management API project

* Add recurring task for cleaning up old tokens in the DB

* Fix bad merge + make auth controller align with the new management API structure

* Explicitly handle the new management API path as a backoffice path (NOTE: this is potentially behaviorally breaking!)

* Redo handle the new management API requests as backoffice requests, this time in a non-breaking way

* Add/update TODOs

* Revert duplication of current auth policies for OpenIddict (as it breaks everything for V11 without the new management APIs) and introduce a dedicated PoC policy setup for OpenIddict.

* Fix failing unit tests

* Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* Update src/Umbraco.Core/Routing/UmbracoRequestPaths.cs

Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>

* V11: Using IFileProvider to access assets added from packages (#13141)

* Creating a FileProviderFactory for getting the package.manifest and grid.editors.config.js files through a file provider

* Collecting the package.manifest-s from different sources

* Searching different sources for grid.editors.config.js

* Using an IFileProvider to collect all tours

* Refactoring IconService.cs

* Typo

* Optimizations when looping through the file system

* Moving WebRootFileProviderFactory to Umbraco.Web.Common proj

* Removes double registering

* pluginLangFileSources includes the localPluginFileSources

* Comments

* Remove linq from foreach

* Change workflow for grid.editors.config.js so we check first physical file, then RCL, then Embedded

* Clean up

* Check if config dir exists

* Discover nested package.manifest files

* Fix IFileInfo.PhysicalPath check

* Revert 712810e1fd995720047832ee689f804185ea69d6 as that way files in content root are preferred over those in web root

* Adding comments

* Refactoring

* Remove PhysicalPath check

* Fix registration of WebRootFileProviderFactory

* Use Swashbuckle instead of NSwag (#13350)

* First attempt at OpenIddict

* Making headway and more TODOs

* Redo current policies for multiple schemas + clean up auth controller

* Fix bad merge

* Clean up some more test code

* Fix spacing

* Include AddAuthentication() in OpenIddict addition

* A little more clean-up

* Move application creation to its own implementation + prepare for middleware to handle valid callback URL

* Enable refresh token flow

* Fix bad merge from v11/dev

* Support auth for Swagger and Postman in non-production environments + use default login screen for back-office logins

* Add workaround to client side login handling so the OAuth return URL is not corrupted before redirection

* Add temporary configuration handling for new backoffice

* Restructure the code somewhat, move singular responsibility from management API project

* Add recurring task for cleaning up old tokens in the DB

* Fix bad merge + make auth controller align with the new management API structure

* Explicitly handle the new management API path as a backoffice path (NOTE: this is potentially behaviorally breaking!)

* Redo handle the new management API requests as backoffice requests, this time in a non-breaking way

* Add/update TODOs

* Replace NSwag with Swashbuckle and clean up unnecessary client secret workaround

* Revert duplication of current auth policies for OpenIddict (as it breaks everything for V11 without the new management APIs) and introduce a dedicated PoC policy setup for OpenIddict.

* Fix failing unit tests

* A little niceness + export new OpenApi.json and fix path in contract unit test

* Redo after merge with v11/dev + filter out unwanted mime types

* Remove CreatedResult and NotFoundObjectResult where possible

* Custom schema IDs - no more "ViewModel" postfix and make generic lists look less clunky too

* A little more explanation for generic schema ID generation

* Force Swashbuckle to use enum string names

* Update OpenApi.json to match new enum string values

* Add clarifying comment about weird looking construct

* add workflow to schema (#13349)

* add workflow to schema

* add licenses to CMSDefinition - intentionally only adding to schema, not registered as options

Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch>
Co-authored-by: Ronald Barendse <ronald@barend.se>
Co-authored-by: Andy Butland <abutland73@gmail.com>
Co-authored-by: Zeegaan <nge@umbraco.dk>
Co-authored-by: Justin Neville <67802060+justin-nevitech@users.noreply.github.com>
Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
2022-11-08 08:21:55 +01:00

509 lines
22 KiB
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Moq;
using NPoco;
using NPoco.DatabaseTypes;
using NPoco.Linq;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Infrastructure.Migrations.Install;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.SqlSyntax;
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; }
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; }
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;
}
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, params object[] args) => throw new NotImplementedException();
public Task<T> ExecuteScalarAsync<T>(Sql sql) => throw new NotImplementedException();
public Task<int> ExecuteAsync(string sql, params object[] args) => throw new NotImplementedException();
public Task<int> ExecuteAsync(Sql sql) => throw new NotImplementedException();
public Task<object> InsertAsync(string tableName, string primaryKeyName, object poco) =>
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 = null) =>
throw new NotImplementedException();
public Task<object> InsertAsync<T>(T poco) => throw new NotImplementedException();
public Task InsertBulkAsync<T>(IEnumerable<T> pocos, InsertBulkOptions options = null) =>
throw new NotImplementedException();
public Task<int> InsertBatchAsync<T>(IEnumerable<T> pocos, BatchOptions options = null) =>
throw new NotImplementedException();
public Task<int> UpdateAsync(object poco) => throw new NotImplementedException();
public Task<int> UpdateAsync(object poco, IEnumerable<string> columns) => throw new NotImplementedException();
public Task<int> UpdateAsync<T>(T poco, Expression<Func<T, object>> fields) => throw new NotImplementedException();
public Task<int> UpdateBatchAsync<T>(IEnumerable<UpdateBatch<T>> pocos, BatchOptions options = null) =>
throw new NotImplementedException();
public Task<int> DeleteAsync(object poco) => 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) => throw new NotImplementedException();
public Task SaveAsync<T>(T poco) => throw new NotImplementedException();
int IDatabase.InsertBatch<T>(IEnumerable<T> pocos, BatchOptions options) => throw new NotImplementedException();
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();
public int Update(object poco, IEnumerable<string> columns) => throw new NotImplementedException();
public int Update(object poco, object primaryKeyValue, IEnumerable<string> columns) =>
throw new NotImplementedException();
public int Update(object poco) => throw new NotImplementedException();
public int Update<T>(T poco, Expression<Func<T, object>> fields) => throw new NotImplementedException();
public int Update(object poco, object primaryKeyValue) => throw new NotImplementedException();
public int Update<T>(string sql, params object[] args) => throw new NotImplementedException();
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();
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, params object[] args) => throw new NotImplementedException();
public Task<T> SingleAsync<T>(Sql sql) => throw new NotImplementedException();
public Task<T> SingleOrDefaultAsync<T>(string sql, params object[] args) => throw new NotImplementedException();
public Task<T> SingleOrDefaultAsync<T>(Sql sql) => throw new NotImplementedException();
public Task<T> SingleByIdAsync<T>(object primaryKey) => throw new NotImplementedException();
public Task<T> SingleOrDefaultByIdAsync<T>(object primaryKey) => throw new NotImplementedException();
public Task<T> FirstAsync<T>(string sql, params object[] args) => throw new NotImplementedException();
public Task<T> FirstAsync<T>(Sql sql) => throw new NotImplementedException();
public Task<T> FirstOrDefaultAsync<T>(string sql, params object[] args) => throw new NotImplementedException();
public Task<T> FirstOrDefaultAsync<T>(Sql sql) => throw new NotImplementedException();
IAsyncEnumerable<T> IAsyncQueryDatabase.QueryAsync<T>(string sql, params object[] args) =>
throw new NotImplementedException();
IAsyncEnumerable<T> IAsyncQueryDatabase.QueryAsync<T>(Sql sql) => throw new NotImplementedException();
public IAsyncQueryProviderWithIncludes<T> QueryAsync<T>() => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(string sql, params object[] args) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(Sql sql) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>() => throw new NotImplementedException();
public Task<Page<T>> PageAsync<T>(long page, long itemsPerPage, string sql, params object[] args) =>
throw new NotImplementedException();
public Task<Page<T>> PageAsync<T>(long page, long itemsPerPage, Sql sql) => throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(long page, long itemsPerPage, string sql, params object[] args) =>
throw new NotImplementedException();
public Task<List<T>> FetchAsync<T>(long page, long itemsPerPage, Sql sql) => throw new NotImplementedException();
public Task<List<T>> SkipTakeAsync<T>(long skip, long take, string sql, params object[] args) =>
throw new NotImplementedException();
public Task<List<T>> SkipTakeAsync<T>(long skip, long take, Sql sql) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, string sql, params object[] args) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, string sql, params object[] args) => 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, params object[] args) => throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, TRet>(Func<List<T1>, List<T2>, TRet> cb, Sql sql) =>
throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, T3, TRet>(Func<List<T1>, List<T2>, List<T3>, TRet> cb, Sql sql) =>
throw new NotImplementedException();
public Task<TRet> FetchMultipleAsync<T1, T2, T3, T4, TRet>(Func<List<T1>, List<T2>, List<T3>, List<T4>, TRet> cb, Sql sql) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>)> FetchMultipleAsync<T1, T2>(string sql, params object[] args) =>
throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>)> FetchMultipleAsync<T1, T2, T3>(string sql, params object[] args) =>
throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>, List<T4>)> FetchMultipleAsync<T1, T2, T3, T4>(string sql, params object[] args) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>)> FetchMultipleAsync<T1, T2>(Sql sql) => throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>)> FetchMultipleAsync<T1, T2, T3>(Sql sql) =>
throw new NotImplementedException();
public Task<(List<T1>, List<T2>, List<T3>, List<T4>)> FetchMultipleAsync<T1, T2, T3, T4>(Sql sql) =>
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();
public Tuple<List<T1>, List<T2>, List<T3>, List<T4>>
FetchMultiple<T1, T2, T3, T4>(string sql, params object[] args) => throw new NotImplementedException();
public Tuple<List<T1>, List<T2>> FetchMultiple<T1, T2>(Sql sql) => throw new NotImplementedException();
public Tuple<List<T1>, List<T2>, List<T3>> FetchMultiple<T1, T2, T3>(Sql sql) =>
throw new NotImplementedException();
public Tuple<List<T1>, List<T2>, List<T3>, List<T4>> FetchMultiple<T1, T2, T3, T4>(Sql sql) =>
throw new NotImplementedException();
public Task<IEnumerable<T>> QueryAsync<T>(string sql, params object[] args) => throw new NotImplementedException();
public Task<IEnumerable<T>> QueryAsync<T>(Sql sql) => throw new NotImplementedException();
/// <summary>
/// Represents a database operation.
/// </summary>
public class Operation
{
public Operation(string text) => Text = text;
public Operation(string text, string sql)
: this(text) => Sql = sql;
public Operation(string text, string sql, params object[] args)
: this(text, sql) => Args = args;
/// <summary>
/// Gets the operation text.
/// </summary>
public string Text { get; }
/// <summary>
/// Gets the operation Sql statement.
/// </summary>
public string Sql { get; }
/// <summary>
/// Gets the operation Sql arguments.
/// </summary>
public object[] Args { get; }
}
}