[
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n*.sln    merge=union\n*.csproj merge=union\n*.vbproj merge=union\n*.fsproj merge=union\n*.dbproj merge=union\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: maxtoroq\n"
  },
  {
    "path": ".gitignore",
    "content": "/.vs/\n/.nuget/\n/packages/\n/docs/api/_toc.xml\n\n[Bb]in\n[Oo]bj\n[Tt]est[Rr]esults\n*.suo\n*.user\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"build/sandcastle-md\"]\n\tpath = build/sandcastle-md\n\turl = https://github.com/maxtoroq/sandcastle-md.git\n"
  },
  {
    "path": "CHANGES.md",
    "content": "﻿This page has moved [here](https://maxtoroq.github.io/DbExtensions/docs/7/changes.html)."
  },
  {
    "path": "DbExtensions.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.11.35222.181\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"DbExtensions\", \"src\\DbExtensions\\DbExtensions.csproj\", \"{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"src\", \"src\", \"{0CD55BAA-00D6-4D14-AF01-B2ECC3F8E092}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"tests\", \"tests\", \"{CDC6A939-6F5A-4CF5-ABDB-A2F87513A769}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"DbExtensions.Tests\", \"tests\\DbExtensions.Tests\\DbExtensions.Tests.csproj\", \"{ABB8412B-D292-4393-BB6D-F0241C41D198}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"samples\", \"samples\", \"{A1718337-F793-499A-A4D1-5A6CF5F265DA}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Samples.CSharp\", \"samples\\CSharp\\Samples.CSharp.csproj\", \"{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Samples.App\", \"samples\\App\\Samples.App.csproj\", \"{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"DbExtensions.SqlBuilder\", \"src\\DbExtensions.SqlBuilder\\DbExtensions.SqlBuilder.csproj\", \"{07B53903-2EB1-4E69-98A2-84069197ADB2}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"DbExtensions.SqlSet\", \"src\\DbExtensions.SqlSet\\DbExtensions.SqlSet.csproj\", \"{75C3AEF3-213C-494A-97FA-D4DCA76FA94A}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"DbExtensions-QE\", \"src\\DbExtensions-QE\\DbExtensions-QE.csproj\", \"{731E7958-87D2-4C2F-9D59-6308D1553F53}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{ABB8412B-D292-4393-BB6D-F0241C41D198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{ABB8412B-D292-4393-BB6D-F0241C41D198}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{ABB8412B-D292-4393-BB6D-F0241C41D198}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{ABB8412B-D292-4393-BB6D-F0241C41D198}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{07B53903-2EB1-4E69-98A2-84069197ADB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{07B53903-2EB1-4E69-98A2-84069197ADB2}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{07B53903-2EB1-4E69-98A2-84069197ADB2}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{07B53903-2EB1-4E69-98A2-84069197ADB2}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{75C3AEF3-213C-494A-97FA-D4DCA76FA94A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{75C3AEF3-213C-494A-97FA-D4DCA76FA94A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{75C3AEF3-213C-494A-97FA-D4DCA76FA94A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{75C3AEF3-213C-494A-97FA-D4DCA76FA94A}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{731E7958-87D2-4C2F-9D59-6308D1553F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{731E7958-87D2-4C2F-9D59-6308D1553F53}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{731E7958-87D2-4C2F-9D59-6308D1553F53}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{731E7958-87D2-4C2F-9D59-6308D1553F53}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(NestedProjects) = preSolution\n\t\t{0C0CB7A6-FDBA-49A0-8FA9-A35EFFFDE34D} = {0CD55BAA-00D6-4D14-AF01-B2ECC3F8E092}\n\t\t{ABB8412B-D292-4393-BB6D-F0241C41D198} = {CDC6A939-6F5A-4CF5-ABDB-A2F87513A769}\n\t\t{CC01AB1C-A3CD-4E56-9AF0-8E4FD2000CE0} = {A1718337-F793-499A-A4D1-5A6CF5F265DA}\n\t\t{0ECA5137-1C9A-46BB-B5EB-ED87F0678FB4} = {A1718337-F793-499A-A4D1-5A6CF5F265DA}\n\t\t{07B53903-2EB1-4E69-98A2-84069197ADB2} = {0CD55BAA-00D6-4D14-AF01-B2ECC3F8E092}\n\t\t{75C3AEF3-213C-494A-97FA-D4DCA76FA94A} = {0CD55BAA-00D6-4D14-AF01-B2ECC3F8E092}\n\t\t{731E7958-87D2-4C2F-9D59-6308D1553F53} = {0CD55BAA-00D6-4D14-AF01-B2ECC3F8E092}\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {96FE150F-41AE-4AB7-AA87-2B8D278F1FF3}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "NOTICE.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n=========================================================================\n==  NOTICE file corresponding to the section 4 d of                    ==\n==  the Apache License, Version 2.0,                                   ==\n==  in this case for the DbExtensions distribution.                    ==\n=========================================================================\n-->\n<notice>\n   <work>DbExtensions</work>\n   <website>https://maxtoroq.github.io/DbExtensions/</website>\n   <copyright>2009-2025 Max Toro Q.</copyright>\n   <authors>Max Toro Q.</authors>\n   <license name=\"Apache-2.0\" src=\"LICENSE.txt\"/>\n   <foreign-work type=\"source\">\n      <notice>\n         <work>.NET Framework</work>\n         <website>https://github.com/Microsoft/referencesource</website>\n         <copyright>Microsoft Corporation</copyright>\n         <license name=\"MIT\"><![CDATA[The MIT License (MIT)\n\nCopyright (c) Microsoft Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining a copy \nof this software and associated documentation files (the \"Software\"), to deal \nin the Software without restriction, including without limitation the rights \nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell \ncopies of the Software, and to permit persons to whom the Software is \nfurnished to do so, subject to the following conditions: \n\nThe above copyright notice and this permission notice shall be included in all \ncopies or substantial portions of the Software. \n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE \nSOFTWARE.]]></license>\n      </notice>\n      <used-by-source path=\"src/DbExtensions/\"/>\n   </foreign-work>\n</notice>\n"
  },
  {
    "path": "README.md",
    "content": "﻿[DbExtensions][1] — The SQL framework for .NET\n==============================================\nDbExtensions is a data-access framework with a strong focus on **query composition, granularity and code aesthetics**. It supports both POCO and dynamic (untyped) mapping.\n\nSee the [project home][1] and the [documentation][2] for more information.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/qw9hoyur7yvlpi8y/branch/v7?svg=true)](https://ci.appveyor.com/project/maxtoroq/dbextensions/branch/v7)\n![Tests](https://img.shields.io/appveyor/tests/maxtoroq/DbExtensions/v7)\n\n[1]: https://maxtoroq.github.io/DbExtensions/\n[2]: https://maxtoroq.github.io/DbExtensions/docs/7/\n"
  },
  {
    "path": "appveyor.yml",
    "content": "image: Visual Studio 2022\n\nbefore_build:\n  - cmd: MSBuild -t:restore\n\nversion: '{build}'\n\nbuild:\n  verbosity: minimal\n"
  },
  {
    "path": "build/.gitignore",
    "content": "/api-docs/\n/EWSoftware.SHFB/\n/EWSoftware.SHFB.*/\n/nupkg/\n"
  },
  {
    "path": "build/DbExtensions.shfbproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"4.0\">\n  <PropertyGroup>\n    <SHFBROOT Condition=\" '$(SHFBROOT)' == '' \">$(MSBuildThisFileDirectory)\\EWSoftware.SHFB\\tools\\</SHFBROOT>\n    <!-- The configuration and platform will be used to determine which\n         assemblies to include from solution and project documentation\n         sources -->\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <SchemaVersion>2.0</SchemaVersion>\n    <ProjectGuid>{e4c3bd2c-c9c8-4484-bc16-0d4a5f6dfcd3}</ProjectGuid>\n    <SHFBSchemaVersion>2017.9.26.0</SHFBSchemaVersion>\n    <!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual\n         Studio adds them anyway -->\n    <AssemblyName>Documentation</AssemblyName>\n    <RootNamespace>Documentation</RootNamespace>\n    <Name>Documentation</Name>\n    <!-- SHFB properties -->\n    <OutputPath>api-docs\\html\\</OutputPath>\n    <HtmlHelpName>Documentation</HtmlHelpName>\n    <Language>en-US</Language>\n    <HelpFileFormat>Website</HelpFileFormat>\n    <KeepLogFile>False</KeepLogFile>\n    <HelpTitle>DbExtensions</HelpTitle>\n    <NamingMethod>MemberName</NamingMethod>\n    <SdkLinkTarget>Top</SdkLinkTarget>\n    <SyntaxFilters>C#</SyntaxFilters>\n    <BinaryTOC>False</BinaryTOC>\n    <ProjectName>DbExtensions</ProjectName>\n    <DocumentationSources>\n      <DocumentationSource sourceFile=\"..\\src\\$(ProjectName)\\$(ProjectName).csproj\" />\n    </DocumentationSources>\n    <NamespaceSummaries>\n      <NamespaceSummaryItem name=\"DbExtensions\" isDocumented=\"True\">DbExtensions is a data-access framework with a strong focus on query composition, granularity and code aesthetics. &lt;see cref=\"T:DbExtensions.Database\"/&gt; is the entry point of the &lt;see cref=\"N:DbExtensions\"/&gt; API.</NamespaceSummaryItem>\n    </NamespaceSummaries>\n    <RootNamespaceContainer>True</RootNamespaceContainer>\n    <PresentationStyle>VS2013</PresentationStyle>\n    <Preliminary>False</Preliminary>\n    <ContentPlacement>AboveNamespaces</ContentPlacement>\n    <BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>\n    <IndentHtml>False</IndentHtml>\n    <FrameworkVersion>.NET Core/.NET Standard/.NET 5.0+</FrameworkVersion>\n    <DisableCodeBlockComponent>False</DisableCodeBlockComponent>\n    <CppCommentsFixup>False</CppCommentsFixup>\n    <CleanIntermediates>False</CleanIntermediates>\n    <MissingTags>AutoDocumentCtors, AutoDocumentDispose</MissingTags>\n    <MaximumGroupParts>2</MaximumGroupParts>\n    <NamespaceGrouping>False</NamespaceGrouping>\n    <RootNamespaceTitle>DbExtensions Namespaces</RootNamespaceTitle>\n    <VisibleItems>InheritedMembers, Protected, SealedProtected, NonBrowsable</VisibleItems>\n    <ComponentConfigurations>\n      <ComponentConfig id=\"IntelliSense Component\" enabled=\"True\" xmlns=\"\">\n        <component id=\"IntelliSense Component\">\n          <!-- Output options (optional)\n  Attributes:\n    Include namespaces (false by default)\n    Namespaces comments filename (\"Namespaces\" if not specified or empty)\n    Output folder (current folder if not specified or empty) -->\n          <output includeNamespaces=\"false\" namespacesFile=\"Namespaces\" folder=\"{@OutputFolder}\\..\\xml\\{@ProjectName}\\\" />\n        </component>\n      </ComponentConfig>\n    </ComponentConfigurations>\n  </PropertyGroup>\n  <!-- There are no properties for these groups.  AnyCPU needs to appear in\n       order for Visual Studio to perform the build.  The others are optional\n       common platform types that may appear. -->\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x86' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x86' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|x64' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|x64' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|Win32' \">\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|Win32' \">\n  </PropertyGroup>\n  <!-- Import the SHFB build targets -->\n  <Import Project=\"$(SHFBROOT)\\SandcastleHelpFileBuilder.targets\" />\n</Project>"
  },
  {
    "path": "build/build-docs.ps1",
    "content": "param([string]$ProjectName = \"DbExtensions\", [switch]$NoBuildProj, [switch]$XmlOnly)\n\n$ErrorActionPreference = \"Stop\"\nPush-Location (Split-Path $script:MyInvocation.MyCommand.Path)\n\ntry {\n\n   $nuget = .\\ensure-nuget.ps1\n\n   if (-not (Test-Path EWSoftware.SHFB -PathType Container)) {\n      &$nuget install EWSoftware.SHFB -Version 2025.3.22 -ExcludeVersion\n   }\n\n   if (-not (Test-Path EWSoftware.SHFB.NET -PathType Container)) {\n      &$nuget install EWSoftware.SHFB.NET -Version 5.0.0.2 -ExcludeVersion\n   }\n\n   if (-not $NoBuildProj) {\n      MSBuild ..\\src\\$ProjectName\\$ProjectName.csproj /v:minimal /p:Configuration=Release\n   }\n\n   MSBuild DbExtensions.shfbproj /v:minimal /p:ProjectName=$ProjectName\n\n   if (-not $XmlOnly) {\n\n      .\\sandcastle-md\\packages\\restore.ps1\n      MSBuild sandcastle-md\\sandcastle-md.sln /v:minimal\n\n      if (Test-Path ..\\docs\\api -PathType Container) {\n         rm ..\\docs\\api -Recurse\n      }\n\n      sandcastle-md\\src\\sandcastle-md\\bin\\Debug\\sandcastle-md.exe api-docs\\html ..\\docs\\api `\n        --remove-assembly-name `\n        --remove-assembly-version `\n        --exclude-icons\n   }\n\n} finally {\n   Pop-Location\n}\n"
  },
  {
    "path": "build/ensure-nuget.ps1",
    "content": "﻿$ErrorActionPreference = \"Stop\"\nPush-Location (Split-Path $script:MyInvocation.MyCommand.Path)\n\n$nuget = \"..\\.nuget\\nuget.exe\"\n\ntry {\n\n   $nugetDir = Split-Path $nuget\n\n   if (-not (Test-Path $nugetDir -PathType Container)) {\n      md $nugetDir | Out-Null\n   }\n\n   if (-not (Test-Path $nuget -PathType Leaf)) {\n      Write-Host \"Downloading NuGet...\"\n      Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $nuget\n   }\n\n   Resolve-Path $nuget\n\n} finally {\n   Pop-Location\n}\n"
  },
  {
    "path": "build/release.ps1",
    "content": "param(\n   [Parameter(Mandatory=$true)][Version]$AssemblyVersion,\n   [Parameter(Mandatory=$true)][Version]$PackageVersion,\n   [Parameter()][string]$PreRelease\n)\n\n$ErrorActionPreference = \"Stop\"\nPush-Location (Split-Path $script:MyInvocation.MyCommand.Path)\n\n$solutionPath = Resolve-Path ..\n$configuration = \"Release\"\n\nfunction ProjectPath([string]$projName) {\n   Resolve-Path $solutionPath\\src\\$projName\n}\n\nfunction ProjectFile([string]$projName) {\n   $projPath = ProjectPath $projName\n   return \"$projPath\\$projName.csproj\"\n}\n\nfunction BuildProj([string]$projName, [string]$target) {\n\n   $pack = $target -eq \"Pack\"\n\n   MSBuild $(ProjectFile($projName)) /t:$target /v:minimal `\n      /p:NoBuild=$pack `\n      /p:Configuration=$configuration `\n      /p:PackageOutputPath=$outputPath `\n      /p:AssemblyVersion=$AssemblyVersion `\n      /p:FileVersion=$PackageVersion `\n      /p:VersionPrefix=$PackageVersion `\n      /p:VersionSuffix=$PreRelease `\n      /p:ContinuousIntegrationBuild=true `\n      /p:GenerateDocumentationFile=$(-not $pack) `\n      /p:Authors=$($notice.authors) `\n      /p:Product=$($notice.work) `\n      /p:Copyright=$($notice.copyright) `\n      /p:Company=$($notice.website) `\n      /p:PackageLicenseExpression=$($notice.license.name) `\n      /p:PackageProjectUrl=$($notice.website) `\n      /p:PackageReleaseNotes=\"For a list of changes see $($notice.website)docs/7/changes.html\" `\n      /p:RepositoryBranch=$(git branch --show-current)\n}\n\nfunction NuPack([string]$projName) {\n\n   BuildProj $projName \"Build\" | Out-Host\n\n   .\\build-docs.ps1 -ProjectName $projName -NoBuildProj -XmlOnly | Out-Host\n\n   BuildProj $projName \"Pack\" | Out-Host\n\n   return Join-Path $outputPath \"$projName.$pkgVer.nupkg\"\n}\n\nfunction Prompt-Choices($Choices=(\"&Yes\", \"&No\"), [string]$Title=\"Confirm\", [string]$Message=\"Are you sure?\", [int]$Default=0) {\n\n   $choicesArr = [Management.Automation.Host.ChoiceDescription[]] `\n      ($Choices | % {New-Object Management.Automation.Host.ChoiceDescription $_})\n\n   return $host.ui.PromptForChoice($Title, $Message, $choicesArr, $Default)\n}\n\ntry {\n\n   [xml]$noticeDoc = Get-Content $solutionPath\\NOTICE.xml\n   $notice = $noticeDoc.DocumentElement\n\n   if (-not (Test-Path nupkg -PathType Container)) {\n      md nupkg | Out-Null\n   }\n\n   $outputPath = Resolve-Path nupkg\n\n   $pkgVer = $PackageVersion.ToString(3)\n\n   if ($PreRelease) {\n      $pkgVer = $pkgVer + \"-\" + $PreRelease\n   }\n\n   $newTag = \"v$pkgVer\"\n\n   MSBuild $solutionPath\\DbExtensions.sln -t:Restore\n\n   $newPackages = (NuPack DbExtensions), (NuPack DbExtensions-QE)\n\n   if ((Prompt-Choices -Message \"Create tag $newTag ?\" -Default 1) -eq 0) {\n\n      git tag -a $newTag -m $newTag\n      Write-Warning \"Created tag: $newTag\"\n\n      if ((Prompt-Choices -Message \"Push package(s) to gallery?\" -Default 1) -eq 0) {\n         foreach ($pkgPath in $newPackages) {\n            dotnet nuget push $pkgPath --source nuget.org\n         }\n      }\n\n      if ((Prompt-Choices -Message \"Push new tag $newTag to origin?\" -Default 1) -eq 0) {\n         git push origin $newTag\n      }\n   }\n\n} finally {\n   Pop-Location\n}\n"
  },
  {
    "path": "docs/README.md",
    "content": "﻿Documentation has moved [here](https://maxtoroq.github.io/DbExtensions/docs/7/)."
  },
  {
    "path": "docs/SqlBuilder.md",
    "content": "﻿This page has moved [here](https://maxtoroq.github.io/DbExtensions/docs/7/SqlBuilder.html)."
  },
  {
    "path": "docs/SqlSet.md",
    "content": "﻿This page has moved [here](https://maxtoroq.github.io/DbExtensions/docs/7/SqlSet.html)."
  },
  {
    "path": "docs/api/DbExtensions/AssociationAttribute/Name.md",
    "content": "AssociationAttribute.Name Property\n==================================\nGets or sets the name of a constraint.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Name { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[AssociationAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/AssociationAttribute/OtherKey.md",
    "content": "AssociationAttribute.OtherKey Property\n======================================\nGets or sets one or more members of the target entity class as key values on the other side of the association.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? OtherKey { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[AssociationAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/AssociationAttribute/README.md",
    "content": "AssociationAttribute Class\n==========================\nDesignates a property to represent a database association, such as a foreign key relationship.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  [System.Attribute][2]  \n    **DbExtensions.AssociationAttribute**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class AssociationAttribute : Attribute\n```\n\nThe **AssociationAttribute** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                      | Description                                                      |\n| ------------------------- | ---------------------------------------------------------------- |\n| [AssociationAttribute][4] | Initializes a new instance of the **AssociationAttribute** class |\n\n\nProperties\n----------\n\n| Name          | Description                                                                                                     |\n| ------------- | --------------------------------------------------------------------------------------------------------------- |\n| [Name][5]     | Gets or sets the name of a constraint.                                                                          |\n| [OtherKey][6] | Gets or sets one or more members of the target entity class as key values on the other side of the association. |\n| [ThisKey][7]  | Gets or sets members of this entity class to represent the key values on this side of the association.          |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: https://learn.microsoft.com/dotnet/api/system.attribute\n[3]: ../README.md\n[4]: _ctor.md\n[5]: Name.md\n[6]: OtherKey.md\n[7]: ThisKey.md"
  },
  {
    "path": "docs/api/DbExtensions/AssociationAttribute/ThisKey.md",
    "content": "AssociationAttribute.ThisKey Property\n=====================================\nGets or sets members of this entity class to represent the key values on this side of the association.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? ThisKey { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[AssociationAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/AssociationAttribute/_ctor.md",
    "content": "AssociationAttribute Constructor\n================================\nInitializes a new instance of the [AssociationAttribute][1] class\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic AssociationAttribute()\n```\n\n\nSee Also\n--------\n\n#### Reference\n[AssociationAttribute Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md"
  },
  {
    "path": "docs/api/DbExtensions/AutoSync/README.md",
    "content": "AutoSync Enumeration\n====================\nUsed to specify for during INSERT and UPDATE operations when a data member should be read back after the operation completes.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic enum AutoSync\n```\n\n\nMembers\n-------\n\n| Member name | Value | Description                                       |\n| ----------- | ----- | ------------------------------------------------- |\n| Default     | 0     | Automatically selects the value.                  |\n| Always      | 1     | Always returns the value.                         |\n| Never       | 2     | Never returns the value.                          |\n| OnInsert    | 3     | Returns the value only after an INSERT operation. |\n| OnUpdate    | 4     | Returns the value only after an UPDATE operation. |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][1]  \n\n[1]: ../README.md"
  },
  {
    "path": "docs/api/DbExtensions/ChangeConflictException/README.md",
    "content": "ChangeConflictException Class\n=============================\nAn exception that is thrown when a concurrency violation is encountered while saving to the database. A concurrency violation occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has been modified since it was loaded into memory.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  [System.Exception][2]  \n    **DbExtensions.ChangeConflictException**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class ChangeConflictException : Exception\n```\n\nThe **ChangeConflictException** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                         | Description                                                                                         |\n| ---------------------------- | --------------------------------------------------------------------------------------------------- |\n| [ChangeConflictException][4] | Initializes a new instance of the **ChangeConflictException** class with a specified error message. |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: https://learn.microsoft.com/dotnet/api/system.exception\n[3]: ../README.md\n[4]: _ctor.md"
  },
  {
    "path": "docs/api/DbExtensions/ChangeConflictException/_ctor.md",
    "content": "ChangeConflictException Constructor\n===================================\nInitializes a new instance of the [ChangeConflictException][1] class with a specified error message.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ChangeConflictException(\n\tstring message\n)\n```\n\n#### Parameters\n\n##### *message*  [String][3]\nThe message that describes the error.\n\n\nSee Also\n--------\n\n#### Reference\n[ChangeConflictException Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/AutoSync.md",
    "content": "ColumnAttribute.AutoSync Property\n=================================\nGets or sets the [AutoSync][1] enumeration.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic AutoSync AutoSync { get; set; }\n```\n\n#### Property Value\n[AutoSync][1]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][2]  \n\n[1]: ../AutoSync/README.md\n[2]: ../README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/ConvertTo.md",
    "content": "ColumnAttribute.ConvertTo Property\n==================================\nGets or sets the type to convert this member to before sending to the database.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Type? ConvertTo { get; set; }\n```\n\n#### Property Value\n[Type][2]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.type\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/IsDbGenerated.md",
    "content": "ColumnAttribute.IsDbGenerated Property\n======================================\nGets or sets whether a column contains values that the database auto-generates.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool IsDbGenerated { get; set; }\n```\n\n#### Property Value\n[Boolean][2]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/IsPrimaryKey.md",
    "content": "ColumnAttribute.IsPrimaryKey Property\n=====================================\nGets or sets whether this class member represents a column that is part or all of the primary key of the table.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool IsPrimaryKey { get; set; }\n```\n\n#### Property Value\n[Boolean][2]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/IsVersion.md",
    "content": "ColumnAttribute.IsVersion Property\n==================================\nGets or sets whether the column type of the member is a database timestamp or version number.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool IsVersion { get; set; }\n```\n\n#### Property Value\n[Boolean][2]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/Name.md",
    "content": "ColumnAttribute.Name Property\n=============================\nGets or sets the name of a column.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Name { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/README.md",
    "content": "ColumnAttribute Class\n=====================\nAssociates a property with a column in a database table.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  [System.Attribute][2]  \n    **DbExtensions.ColumnAttribute**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class ColumnAttribute : Attribute\n```\n\nThe **ColumnAttribute** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                 | Description                                                 |\n| -------------------- | ----------------------------------------------------------- |\n| [ColumnAttribute][4] | Initializes a new instance of the **ColumnAttribute** class |\n\n\nProperties\n----------\n\n| Name               | Description                                                                                                     |\n| ------------------ | --------------------------------------------------------------------------------------------------------------- |\n| [AutoSync][5]      | Gets or sets the [AutoSync][6] enumeration.                                                                     |\n| [ConvertTo][7]     | Gets or sets the type to convert this member to before sending to the database.                                 |\n| [IsDbGenerated][8] | Gets or sets whether a column contains values that the database auto-generates.                                 |\n| [IsPrimaryKey][9]  | Gets or sets whether this class member represents a column that is part or all of the primary key of the table. |\n| [IsVersion][10]    | Gets or sets whether the column type of the member is a database timestamp or version number.                   |\n| [Name][11]         | Gets or sets the name of a column.                                                                              |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: https://learn.microsoft.com/dotnet/api/system.attribute\n[3]: ../README.md\n[4]: _ctor.md\n[5]: AutoSync.md\n[6]: ../AutoSync/README.md\n[7]: ConvertTo.md\n[8]: IsDbGenerated.md\n[9]: IsPrimaryKey.md\n[10]: IsVersion.md\n[11]: Name.md"
  },
  {
    "path": "docs/api/DbExtensions/ColumnAttribute/_ctor.md",
    "content": "ColumnAttribute Constructor\n===========================\nInitializes a new instance of the [ColumnAttribute][1] class\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ColumnAttribute()\n```\n\n\nSee Also\n--------\n\n#### Reference\n[ColumnAttribute Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md"
  },
  {
    "path": "docs/api/DbExtensions/ComplexPropertyAttribute/Name.md",
    "content": "ComplexPropertyAttribute.Name Property\n======================================\nThe base name for the columns on the complex property. The default is the property name.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Name { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[ComplexPropertyAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ComplexPropertyAttribute/README.md",
    "content": "ComplexPropertyAttribute Class\n==============================\nDesignates a property as a complex property that groups columns of a table that share the same base name.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  [System.Attribute][2]  \n    **DbExtensions.ComplexPropertyAttribute**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class ComplexPropertyAttribute : Attribute\n```\n\nThe **ComplexPropertyAttribute** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                          | Description                                                          |\n| ----------------------------- | -------------------------------------------------------------------- |\n| [ComplexPropertyAttribute][4] | Initializes a new instance of the **ComplexPropertyAttribute** class |\n\n\nProperties\n----------\n\n| Name           | Description                                                                                                                                                                                                                                                                                   |\n| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Name][5]      | The base name for the columns on the complex property. The default is the property name.                                                                                                                                                                                                      |\n| [Separator][6] | The separator to use between the base name and the complex property's columns. The default is null, which means the separator is taken from [DatabaseConfiguration.DefaultComplexPropertySeparator][7]. To use no separator and override the default configuration, use an empty [String][8]. |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: https://learn.microsoft.com/dotnet/api/system.attribute\n[3]: ../README.md\n[4]: _ctor.md\n[5]: Name.md\n[6]: Separator.md\n[7]: ../DatabaseConfiguration/DefaultComplexPropertySeparator.md\n[8]: https://learn.microsoft.com/dotnet/api/system.string"
  },
  {
    "path": "docs/api/DbExtensions/ComplexPropertyAttribute/Separator.md",
    "content": "ComplexPropertyAttribute.Separator Property\n===========================================\nThe separator to use between the base name and the complex property's columns. The default is null, which means the separator is taken from [DatabaseConfiguration.DefaultComplexPropertySeparator][1]. To use no separator and override the default configuration, use an empty [String][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Separator { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[ComplexPropertyAttribute Class][4]  \n[DbExtensions Namespace][3]  \n\n[1]: ../DatabaseConfiguration/DefaultComplexPropertySeparator.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: ../README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/ComplexPropertyAttribute/_ctor.md",
    "content": "ComplexPropertyAttribute Constructor\n====================================\nInitializes a new instance of the [ComplexPropertyAttribute][1] class\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ComplexPropertyAttribute()\n```\n\n\nSee Also\n--------\n\n#### Reference\n[ComplexPropertyAttribute Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Add.md",
    "content": "Database.Add Method\n===================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic void Add(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n\nRemarks\n-------\nThis method is a shortcut for `db.Table(entity.GetType()).Add(entity)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n[SqlTable.Add(Object)][4]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md\n[4]: ../SqlTable/Add.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/AddAsync.md",
    "content": "Database.AddAsync Method\n========================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]\n\nRemarks\n-------\nThis method is a shortcut for `await db.Table(entity.GetType()).AddAsync(entity, cancellationToken)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][1]  \n[SqlTable.AddAsync(Object, CancellationToken)][7]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[6]: README.md\n[7]: ../SqlTable/AddAsync.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/AsyncMap.md",
    "content": "Database.AsyncMap(SqlBuilder) Method\n====================================\nMaps the results of the *query* to dynamic objects. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                  | Description                                                                                                                 |\n| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| **AsyncMap(SqlBuilder)**                                              | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [AsyncMap(SqlBuilder, Type)][2]                                       | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [AsyncMap&lt;TResult>(SqlBuilder)][3]                                 | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<Object> AsyncMap(\n\tSqlBuilder query\n)\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n#### Return Value\n[IAsyncEnumerable][6]&lt;[Object][7]>  \nThe results of the query as dynamic objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AsyncMap_1.md\n[3]: AsyncMap__1.md\n[4]: AsyncMap__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/AsyncMap_1.md",
    "content": "Database.AsyncMap(SqlBuilder, Type) Method\n==========================================\nMaps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                  | Description                                                                                                                 |\n| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [AsyncMap(SqlBuilder)][2]                                             | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| **AsyncMap(SqlBuilder, Type)**                                        | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [AsyncMap&lt;TResult>(SqlBuilder)][3]                                 | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<Object> AsyncMap(\n\tSqlBuilder query,\n\tType resultType\n)\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n##### *resultType*  [Type][6]\nThe type of objects to map the results to.\n\n#### Return Value\n[IAsyncEnumerable][7]&lt;[Object][8]>  \nThe results of the query as objects of type specified by the *resultType* parameter.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AsyncMap.md\n[3]: AsyncMap__1.md\n[4]: AsyncMap__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.type\n[7]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/AsyncMap__1.md",
    "content": "Database.AsyncMap&lt;TResult>(SqlBuilder) Method\n================================================\nMaps the results of the *query* to TResult objects. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                  | Description                                                                                                                 |\n| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [AsyncMap(SqlBuilder)][2]                                             | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [AsyncMap(SqlBuilder, Type)][3]                                       | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| **AsyncMap&lt;TResult>(SqlBuilder)**                                  | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<TResult> AsyncMap<TResult>(\n\tSqlBuilder query\n)\n\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[IAsyncEnumerable][6]&lt;**TResult**>  \nThe results of the query as TResult objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AsyncMap.md\n[3]: AsyncMap_1.md\n[4]: AsyncMap__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/AsyncMap__1_1.md",
    "content": "Database.AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>) Method\n================================================================================\nMaps the results of the *query* to TResult objects, using the provided *mapper* delegate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                 | Description                                                                                                                 |\n| -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [AsyncMap(SqlBuilder)][2]                                            | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [AsyncMap(SqlBuilder, Type)][3]                                      | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [AsyncMap&lt;TResult>(SqlBuilder)][4]                                | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| **AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)** | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<TResult> AsyncMap<TResult>(\n\tSqlBuilder query,\n\tFunc<DbDataReader, TResult> mapper\n)\n\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n##### *mapper*  [Func][6]&lt;[DbDataReader][7], **TResult**>\nThe delegate for creating TResult objects from an [DbDataReader][7] object.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[IAsyncEnumerable][8]&lt;**TResult**>  \nThe results of the query as TResult objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AsyncMap.md\n[3]: AsyncMap_1.md\n[4]: AsyncMap__1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.func-2\n[7]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[8]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Configuration.md",
    "content": "Database.Configuration Property\n===============================\nProvides access to configuration options for this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic DatabaseConfiguration Configuration { get; }\n```\n\n#### Property Value\n[DatabaseConfiguration][2]\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../DatabaseConfiguration/README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Connection.md",
    "content": "Database.Connection Property\n============================\nGets the connection to associate with new commands.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic DbConnection Connection { get; }\n```\n\n#### Property Value\n[DbConnection][2]\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.data.common.dbconnection\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/CreateCommand.md",
    "content": "Database.CreateCommand Method\n=============================\nCreates and returns a [DbCommand][1] object from the specified *sqlBuilder*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic virtual DbCommand CreateCommand(\n\tSqlBuilder sqlBuilder\n)\n```\n\n#### Parameters\n\n##### *sqlBuilder*  [SqlBuilder][3]\nThe [SqlBuilder][3] that provides the command's text and parameters.\n\n#### Return Value\n[DbCommand][1]  \n A new [DbCommand][1] object with its [CommandText][4] property initialized with the *sqlBuilder*'s string representation, and its [Parameters][5] property is initialized with the values from the [ParameterValues][6] property of the *sqlBuilder* parameter.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.data.common.dbcommand\n[2]: ../README.md\n[3]: ../SqlBuilder/README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbcommand.commandtext\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbcommand.parameters\n[6]: ../SqlBuilder/ParameterValues.md\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Dispose.md",
    "content": "Database.Dispose Method\n=======================\nReleases all resources used by the current instance of the [Database][1] class.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                  | Description                                                                     |\n| --------------------- | ------------------------------------------------------------------------------- |\n| **Dispose()**         | Releases all resources used by the current instance of the [Database][1] class. |\n| [Dispose(Boolean)][3] | Releases the resources used by this [Database][1] instance.                     |\n\n\nSyntax\n------\n\n```csharp\npublic void Dispose()\n```\n\n#### Implements\n[IDisposable.Dispose()][4]  \n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md\n[3]: Dispose_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.idisposable.dispose"
  },
  {
    "path": "docs/api/DbExtensions/Database/Dispose_1.md",
    "content": "Database.Dispose(Boolean) Method\n================================\nReleases the resources used by this [Database][1] instance.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                 | Description                                                                     |\n| -------------------- | ------------------------------------------------------------------------------- |\n| [Dispose()][3]       | Releases all resources used by the current instance of the [Database][1] class. |\n| **Dispose(Boolean)** | Releases the resources used by this [Database][1] instance.                     |\n\n\nSyntax\n------\n\n```csharp\nprotected virtual void Dispose(\n\tbool disposing\n)\n```\n\n#### Parameters\n\n##### *disposing*  [Boolean][4]\n`true` if this method is being called due to a call to [Dispose()][3]; otherwise, `false`.\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md\n[3]: Dispose.md\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureConnectionOpen.md",
    "content": "Database.EnsureConnectionOpen Method\n====================================\nOpens [Connection][1] (if it's not open) and returns an [IDisposable][2] object you can use to close it (if it wasn't open).\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IDisposable EnsureConnectionOpen()\n```\n\n#### Return Value\n[IDisposable][2]  \nAn [IDisposable][2] object to close the connection.\n\nRemarks\n-------\nUse this method with the `using` statement in C# or Visual Basic to ensure that a block of code is always executed with an open connection.\n\nExample\n-------\n\n```csharp\nusing (db.EnsureConnectionOpen()) {\n  // Execute commands.\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][4]  \n[DbExtensions Namespace][3]  \n\n[1]: Connection.md\n[2]: https://learn.microsoft.com/dotnet/api/system.idisposable\n[3]: ../README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureConnectionOpenAsync.md",
    "content": "Database.EnsureConnectionOpenAsync Method\n=========================================\nOpens [Connection][1] (if it's not open) and returns an [IAsyncDisposable][2] object you can use to close it (if it wasn't open).\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<IAsyncDisposable> EnsureConnectionOpenAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[IAsyncDisposable][2]>  \nAn [IAsyncDisposable][2] object to close the connection.\n\nRemarks\n-------\nUse this method with the `using` statement in C# or Visual Basic to ensure that a block of code is always executed with an open connection.\n\nExample\n-------\n\n```csharp\nawait using (await db.EnsureConnectionOpenAsync()) {\n  // Execute commands.\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][3]  \n\n[1]: Connection.md\n[2]: https://learn.microsoft.com/dotnet/api/system.iasyncdisposable\n[3]: ../README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureInTransaction.md",
    "content": "Database.EnsureInTransaction Method\n===================================\nReturns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                                                                                                 |\n| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| **EnsureInTransaction()**                | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n| [EnsureInTransaction(IsolationLevel)][2] | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n\n\nSyntax\n------\n\n```csharp\npublic DbTransaction EnsureInTransaction()\n```\n\n#### Return Value\n[DbTransaction][3]  \n A virtual transaction you can use to ensure a code block is always executed in a transaction, new or existing.\n\nRemarks\n-------\nThis method returns a virtual transaction that wraps an existing or new transaction. By calling [Commit()][4] on the returned object, this object will then call [Commit()][4] on the wrapped transaction if the transaction was just created, or do nothing if it was previously created.\n\nExample\n-------\n\nCalls to this method can be nested, like in the following example:\n\n```csharp\nvoid DoSomething() {\n\n   using (var tx = this.db.EnsureInTransaction()) {\n\n      // Execute commands\n\n      DoSomethingElse();\n\n      tx.Commit();\n   }\n}\n\nvoid DoSomethingElse() { \n\n   using (var tx = this.db.EnsureInTransaction()) {\n\n      // Execute commands\n\n      tx.Commit();\n   }\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: EnsureInTransaction_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction.commit\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureInTransactionAsync.md",
    "content": "Database.EnsureInTransactionAsync(IsolationLevel, CancellationToken) Method\n===========================================================================\nReturns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                                                                 |\n| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [EnsureInTransactionAsync(CancellationToken)][2]                | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n| **EnsureInTransactionAsync(IsolationLevel, CancellationToken)** | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n\n\nSyntax\n------\n\n```csharp\npublic virtual ValueTask<DbTransaction> EnsureInTransactionAsync(\n\tIsolationLevel isolationLevel,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *isolationLevel*  [IsolationLevel][3]\nSpecifies the isolation level for the transaction. This parameter is ignored when using an existing transaction.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[DbTransaction][7]>  \n A virtual transaction you can use to ensure a code block is always executed in a transaction, new or existing.\n\nRemarks\n-------\nThis method returns a virtual transaction that wraps an existing or new transaction. By calling [Commit()][8] on the returned object, this object will then call [Commit()][8] on the wrapped transaction if the transaction was just created, or do nothing if it was previously created.\n\nExample\n-------\n\nCalls to this method can be nested, like in the following example:\n\n```csharp\nasync Task DoSomething() {\n\n   await using (var tx = await this.db.EnsureInTransactionAsync()) {\n\n      // Execute commands\n\n      await DoSomethingElse();\n\n      await tx.CommitAsync();\n   }\n}\n\nasync Task DoSomethingElse() {\n\n   await using (var tx = await this.db.EnsureInTransactionAsync()) {\n\n      // Execute commands\n\n      await tx.CommitAsync();\n   }\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: EnsureInTransactionAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.isolationlevel\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction\n[8]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction.commit\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureInTransactionAsync_1.md",
    "content": "Database.EnsureInTransactionAsync(CancellationToken) Method\n===========================================================\nReturns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                 |\n| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| **EnsureInTransactionAsync(CancellationToken)**                  | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n| [EnsureInTransactionAsync(IsolationLevel, CancellationToken)][2] | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<DbTransaction> EnsureInTransactionAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[DbTransaction][6]>  \n A virtual transaction you can use to ensure a code block is always executed in a transaction, new or existing.\n\nRemarks\n-------\nThis method returns a virtual transaction that wraps an existing or new transaction. By calling [Commit()][7] on the returned object, this object will then call [Commit()][7] on the wrapped transaction if the transaction was just created, or do nothing if it was previously created.\n\nExample\n-------\n\nCalls to this method can be nested, like in the following example:\n\n```csharp\nasync Task DoSomething() {\n\n   await using (var tx = await this.db.EnsureInTransactionAsync()) {\n\n      // Execute commands\n\n      await DoSomethingElse();\n\n      await tx.CommitAsync();\n   }\n}\n\nasync Task DoSomethingElse() {\n\n   await using (var tx = await this.db.EnsureInTransactionAsync()) {\n\n      // Execute commands\n\n      await tx.CommitAsync();\n   }\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: EnsureInTransactionAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction\n[7]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction.commit\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/EnsureInTransaction_1.md",
    "content": "Database.EnsureInTransaction(IsolationLevel) Method\n===================================================\nReturns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                    | Description                                                                                                                 |\n| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [EnsureInTransaction()][2]              | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n| **EnsureInTransaction(IsolationLevel)** | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing. |\n\n\nSyntax\n------\n\n```csharp\npublic virtual DbTransaction EnsureInTransaction(\n\tIsolationLevel isolationLevel\n)\n```\n\n#### Parameters\n\n##### *isolationLevel*  [IsolationLevel][3]\nSpecifies the isolation level for the transaction. This parameter is ignored when using an existing transaction.\n\n#### Return Value\n[DbTransaction][4]  \n A virtual transaction you can use to ensure a code block is always executed in a transaction, new or existing.\n\nRemarks\n-------\nThis method returns a virtual transaction that wraps an existing or new transaction. By calling [Commit()][5] on the returned object, this object will then call [Commit()][5] on the wrapped transaction if the transaction was just created, or do nothing if it was previously created.\n\nExample\n-------\n\nCalls to this method can be nested, like in the following example:\n\n```csharp\nvoid DoSomething() {\n\n   using (var tx = this.db.EnsureInTransaction()) {\n\n      // Execute commands\n\n      DoSomethingElse();\n\n      tx.Commit();\n   }\n}\n\nvoid DoSomethingElse() { \n\n   using (var tx = this.db.EnsureInTransaction()) {\n\n      // Execute commands\n\n      tx.Commit();\n   }\n}\n```\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: EnsureInTransaction.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.isolationlevel\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction.commit\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Execute.md",
    "content": "Database.Execute Method\n=======================\nExecutes the *nonQuery* command. Optionally uses a transaction and validates affected records value before committing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic int Execute(\n\tSqlBuilder nonQuery,\n\tint affect = -1,\n\tbool exact = false\n)\n```\n\n#### Parameters\n\n##### *nonQuery*  [SqlBuilder][2]\nThe non-query command to execute.\n\n##### *affect*  [Int32][3]  (Optional)\nThe number of records the command should affect. This value is ignored if less or equal to -1.\n\n##### *exact*  [Boolean][4]  (Optional)\n`true` if the number of affected records should exactly match *affect*; `false` if a lower number is acceptable.\n\n#### Return Value\n[Int32][3]  \nThe number of affected records.\n\nExceptions\n----------\n\n| Exception                    | Condition                                                |\n| ---------------------------- | -------------------------------------------------------- |\n| [ChangeConflictException][5] | The number of affected records is not equal to *affect*. |\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlBuilder/README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.int32\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: ../ChangeConflictException/README.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/ExecuteAsync.md",
    "content": "Database.ExecuteAsync Method\n============================\nExecutes the *nonQuery* command. Optionally uses a transaction and validates affected records value before committing.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<int> ExecuteAsync(\n\tSqlBuilder nonQuery,\n\tint affect = -1,\n\tbool exact = false,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *nonQuery*  [SqlBuilder][2]\nThe non-query command to execute.\n\n##### *affect*  [Int32][3]  (Optional)\nThe number of records the command should affect. This value is ignored if less or equal to -1.\n\n##### *exact*  [Boolean][4]  (Optional)\n`true` if the number of affected records should exactly match *affect*; `false` if a lower number is acceptable.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Int32][3]>  \nThe number of affected records.\n\nExceptions\n----------\n\n| Exception                    | Condition                                                |\n| ---------------------------- | -------------------------------------------------------- |\n| [ChangeConflictException][8] | The number of affected records is not equal to *affect*. |\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlBuilder/README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.int32\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: ../ChangeConflictException/README.md\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/FindAsync__1.md",
    "content": "Database.FindAsync&lt;TEntity> Method\n=====================================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TEntity> FindAsync<TEntity>(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\nwhere TEntity : class\n\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Type Parameters\n\n##### *TEntity*\nThe type of the entity.\n\n#### Return Value\n[ValueTask][5]&lt;**TEntity**>  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nRemarks\n-------\nThis method is a shortcut for `await db.Table<TEntity>().FindAsync(id, cancellationToken)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Find__1.md",
    "content": "Database.Find&lt;TEntity> Method\n================================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic TEntity Find<TEntity>(\n\tObject id\n)\nwhere TEntity : class\n\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Type Parameters\n\n##### *TEntity*\nThe type of the entity.\n\n#### Return Value\n**TEntity**  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nRemarks\n-------\nThis method is a shortcut for `db.Table<TEntity>().Find(id)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n[SqlSet&lt;TResult>.Find(Object)][4]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md\n[4]: ../SqlSet_1/Find.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/From.md",
    "content": "Database.From(String) Method\n============================\nCreates and returns a new [SqlSet][1] using the provided table name.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                          | Description                                                                      |\n| ----------------------------- | -------------------------------------------------------------------------------- |\n| **From(String)**              | Creates and returns a new [SqlSet][1] using the provided table name.             |\n| [From(String, Type)][3]       | Creates and returns a new [SqlSet][1] using the provided table name.             |\n| [From&lt;TResult>(String)][4] | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided table name. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet From(\n\tstring tableName\n)\n```\n\n#### Parameters\n\n##### *tableName*  [String][6]\nThe name of the table that will be the source of data for the set.\n\n#### Return Value\n[SqlSet][1]  \nA new [SqlSet][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet/README.md\n[2]: ../README.md\n[3]: From_1.md\n[4]: From__1.md\n[5]: ../SqlSet_1/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/FromQuery.md",
    "content": "Database.FromQuery(SqlBuilder) Method\n=====================================\nCreates and returns a new [SqlSet][1] using the provided defining query.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                   | Description                                                                                     |\n| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |\n| **FromQuery(SqlBuilder)**                                              | Creates and returns a new [SqlSet][1] using the provided defining query.                        |\n| [FromQuery(SqlBuilder, Type)][3]                                       | Creates and returns a new [SqlSet][1] using the provided defining query.                        |\n| [FromQuery&lt;TResult>(SqlBuilder)][4]                                 | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided defining query.            |\n| [FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][6] | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided defining query and mapper. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet FromQuery(\n\tSqlBuilder definingQuery\n)\n```\n\n#### Parameters\n\n##### *definingQuery*  [SqlBuilder][7]\nThe SQL query that will be the source of data for the set.\n\n#### Return Value\n[SqlSet][1]  \nA new [SqlSet][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet/README.md\n[2]: ../README.md\n[3]: FromQuery_1.md\n[4]: FromQuery__1.md\n[5]: ../SqlSet_1/README.md\n[6]: FromQuery__1_1.md\n[7]: ../SqlBuilder/README.md\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/FromQuery_1.md",
    "content": "Database.FromQuery(SqlBuilder, Type) Method\n===========================================\nCreates and returns a new [SqlSet][1] using the provided defining query.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                   | Description                                                                                     |\n| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |\n| [FromQuery(SqlBuilder)][3]                                             | Creates and returns a new [SqlSet][1] using the provided defining query.                        |\n| **FromQuery(SqlBuilder, Type)**                                        | Creates and returns a new [SqlSet][1] using the provided defining query.                        |\n| [FromQuery&lt;TResult>(SqlBuilder)][4]                                 | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided defining query.            |\n| [FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][6] | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided defining query and mapper. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet FromQuery(\n\tSqlBuilder definingQuery,\n\tType? resultType\n)\n```\n\n#### Parameters\n\n##### *definingQuery*  [SqlBuilder][7]\nThe SQL query that will be the source of data for the set.\n\n##### *resultType*  [Type][8]\nThe type of objects to map the results to.\n\n#### Return Value\n[SqlSet][1]  \nA new [SqlSet][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet/README.md\n[2]: ../README.md\n[3]: FromQuery.md\n[4]: FromQuery__1.md\n[5]: ../SqlSet_1/README.md\n[6]: FromQuery__1_1.md\n[7]: ../SqlBuilder/README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.type\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/FromQuery__1.md",
    "content": "Database.FromQuery&lt;TResult>(SqlBuilder) Method\n=================================================\nCreates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                   | Description                                                                                     |\n| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |\n| [FromQuery(SqlBuilder)][3]                                             | Creates and returns a new [SqlSet][4] using the provided defining query.                        |\n| [FromQuery(SqlBuilder, Type)][5]                                       | Creates and returns a new [SqlSet][4] using the provided defining query.                        |\n| **FromQuery&lt;TResult>(SqlBuilder)**                                  | Creates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query.            |\n| [FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][6] | Creates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query and mapper. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> FromQuery<TResult>(\n\tSqlBuilder definingQuery\n)\n\n```\n\n#### Parameters\n\n##### *definingQuery*  [SqlBuilder][7]\nThe SQL query that will be the source of data for the set.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[SqlSet][1]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet_1/README.md\n[2]: ../README.md\n[3]: FromQuery.md\n[4]: ../SqlSet/README.md\n[5]: FromQuery_1.md\n[6]: FromQuery__1_1.md\n[7]: ../SqlBuilder/README.md\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/FromQuery__1_1.md",
    "content": "Database.FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>) Method\n=================================================================================\nCreates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query and mapper.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                  | Description                                                                                     |\n| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |\n| [FromQuery(SqlBuilder)][3]                                            | Creates and returns a new [SqlSet][4] using the provided defining query.                        |\n| [FromQuery(SqlBuilder, Type)][5]                                      | Creates and returns a new [SqlSet][4] using the provided defining query.                        |\n| [FromQuery&lt;TResult>(SqlBuilder)][6]                                | Creates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query.            |\n| **FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)** | Creates and returns a new [SqlSet&lt;TResult>][1] using the provided defining query and mapper. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> FromQuery<TResult>(\n\tSqlBuilder definingQuery,\n\tFunc<DbDataReader, TResult> mapper\n)\n\n```\n\n#### Parameters\n\n##### *definingQuery*  [SqlBuilder][7]\nThe SQL query that will be the source of data for the set.\n\n##### *mapper*  [Func][8]&lt;[DbDataReader][9], **TResult**>\nA custom mapper function that creates TResult instances from the rows in the set.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[SqlSet][1]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][10]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet_1/README.md\n[2]: ../README.md\n[3]: FromQuery.md\n[4]: ../SqlSet/README.md\n[5]: FromQuery_1.md\n[6]: FromQuery__1.md\n[7]: ../SqlBuilder/README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.func-2\n[9]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/From_1.md",
    "content": "Database.From(String, Type) Method\n==================================\nCreates and returns a new [SqlSet][1] using the provided table name.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                          | Description                                                                      |\n| ----------------------------- | -------------------------------------------------------------------------------- |\n| [From(String)][3]             | Creates and returns a new [SqlSet][1] using the provided table name.             |\n| **From(String, Type)**        | Creates and returns a new [SqlSet][1] using the provided table name.             |\n| [From&lt;TResult>(String)][4] | Creates and returns a new [SqlSet&lt;TResult>][5] using the provided table name. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet From(\n\tstring tableName,\n\tType? resultType\n)\n```\n\n#### Parameters\n\n##### *tableName*  [String][6]\nThe name of the table that will be the source of data for the set.\n\n##### *resultType*  [Type][7]\nThe type of objects to map the results to.\n\n#### Return Value\n[SqlSet][1]  \nA new [SqlSet][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet/README.md\n[2]: ../README.md\n[3]: From.md\n[4]: From__1.md\n[5]: ../SqlSet_1/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://learn.microsoft.com/dotnet/api/system.type\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/From__1.md",
    "content": "Database.From&lt;TResult>(String) Method\n========================================\nCreates and returns a new [SqlSet&lt;TResult>][1] using the provided table name.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                         | Description                                                                      |\n| ---------------------------- | -------------------------------------------------------------------------------- |\n| [From(String)][3]            | Creates and returns a new [SqlSet][4] using the provided table name.             |\n| [From(String, Type)][5]      | Creates and returns a new [SqlSet][4] using the provided table name.             |\n| **From&lt;TResult>(String)** | Creates and returns a new [SqlSet&lt;TResult>][1] using the provided table name. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> From<TResult>(\n\tstring tableName\n)\n\n```\n\n#### Parameters\n\n##### *tableName*  [String][6]\nThe name of the table that will be the source of data for the set.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[SqlSet][1]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][1] object.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlSet_1/README.md\n[2]: ../README.md\n[3]: From.md\n[4]: ../SqlSet/README.md\n[5]: From_1.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/LastInsertId.md",
    "content": "Database.LastInsertId Method\n============================\nGets the identity value of the last inserted record.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic virtual Object? LastInsertId()\n```\n\n#### Return Value\n[Object][2]  \nThe identity value of the last inserted record.\n\nRemarks\n-------\nIt is very important to keep the connection open between the last command and this one, or else you might get the wrong value.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/LastInsertIdAsync.md",
    "content": "Database.LastInsertIdAsync Method\n=================================\nGets the identity value of the last inserted record.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic virtual ValueTask<Object> LastInsertIdAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[ValueTask][4]&lt;[Object][5]>  \nThe identity value of the last inserted record.\n\nRemarks\n-------\nIt is very important to keep the connection open between the last command and this one, or else you might get the wrong value.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Map.md",
    "content": "Database.Map(SqlBuilder) Method\n===============================\nMaps the results of the *query* to dynamic objects. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                 |\n| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| **Map(SqlBuilder)**                                              | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [Map(SqlBuilder, Type)][2]                                       | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [Map&lt;TResult>(SqlBuilder)][3]                                 | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<Object> Map(\n\tSqlBuilder query\n)\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n#### Return Value\n[IEnumerable][6]&lt;[Object][7]>  \nThe results of the query as dynamic objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Map_1.md\n[3]: Map__1.md\n[4]: Map__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Map_1.md",
    "content": "Database.Map(SqlBuilder, Type) Method\n=====================================\nMaps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                 |\n| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [Map(SqlBuilder)][2]                                             | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| **Map(SqlBuilder, Type)**                                        | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [Map&lt;TResult>(SqlBuilder)][3]                                 | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<Object> Map(\n\tSqlBuilder query,\n\tType resultType\n)\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n##### *resultType*  [Type][6]\nThe type of objects to map the results to.\n\n#### Return Value\n[IEnumerable][7]&lt;[Object][8]>  \nThe results of the query as objects of type specified by the *resultType* parameter.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Map.md\n[3]: Map__1.md\n[4]: Map__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.type\n[7]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Map__1.md",
    "content": "Database.Map&lt;TResult>(SqlBuilder) Method\n===========================================\nMaps the results of the *query* to TResult objects. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                 |\n| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [Map(SqlBuilder)][2]                                             | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [Map(SqlBuilder, Type)][3]                                       | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| **Map&lt;TResult>(SqlBuilder)**                                  | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| [Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][4] | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<TResult> Map<TResult>(\n\tSqlBuilder query\n)\n\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[IEnumerable][6]&lt;**TResult**>  \nThe results of the query as TResult objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Map.md\n[3]: Map_1.md\n[4]: Map__1_1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Map__1_1.md",
    "content": "Database.Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>) Method\n===========================================================================\nMaps the results of the *query* to TResult objects, using the provided *mapper* delegate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                                                                 |\n| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| [Map(SqlBuilder)][2]                                            | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                         |\n| [Map(SqlBuilder, Type)][3]                                      | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed. |\n| [Map&lt;TResult>(SqlBuilder)][4]                                | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                         |\n| **Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)** | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                   |\n\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<TResult> Map<TResult>(\n\tSqlBuilder query,\n\tFunc<DbDataReader, TResult> mapper\n)\n\n```\n\n#### Parameters\n\n##### *query*  [SqlBuilder][5]\nThe query.\n\n##### *mapper*  [Func][6]&lt;[DbDataReader][7], **TResult**>\nThe delegate for creating TResult objects from an [DbDataReader][7] object.\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\n#### Return Value\n[IEnumerable][8]&lt;**TResult**>  \nThe results of the query as TResult objects.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Map.md\n[3]: Map_1.md\n[4]: Map__1.md\n[5]: ../SqlBuilder/README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.func-2\n[7]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[8]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/QuoteIdentifier.md",
    "content": "Database.QuoteIdentifier Method\n===============================\nGiven an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string QuoteIdentifier(\n\tstring identifier\n)\n```\n\n#### Parameters\n\n##### *identifier*  [String][2]\nThe original identifier.\n\n#### Return Value\n[String][2]  \nThe quoted version of the identifier. If the indentifier is already quoted it's returned unchanged.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/README.md",
    "content": "Database Class\n==============\nProvides simple data access using [SqlSet][1], [SqlBuilder][2] and [SqlTable&lt;TEntity>][3].\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][4]  \n  **DbExtensions.Database**  \n  \n**Namespace:** [DbExtensions][5]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic class Database : IDisposable\n```\n\nThe **Database** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                          | Description                                                                                                              |\n| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| [Database(DbConnection)][6]   | Initializes a new instance of the **Database** class using the provided connection.                                      |\n| [Database(String, String)][7] | Initializes a new instance of the **Database** class using the provided connection string and provider's invariant name. |\n\n\nProperties\n----------\n\n| Name               | Description                                                 |\n| ------------------ | ----------------------------------------------------------- |\n| [Configuration][8] | Provides access to configuration options for this instance. |\n| [Connection][9]    | Gets the connection to associate with new commands.         |\n| [Transaction][10]  | Gets or sets a transaction to associate with new commands.  |\n\n\nMethods\n-------\n\n| Name                                                                    | Description                                                                                                                        |\n| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| [Add][11]                                                               | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.               |\n| [AddAsync][12]                                                          | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.               |\n| [AsyncMap(SqlBuilder)][13]                                              | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                                |\n| [AsyncMap(SqlBuilder, Type)][14]                                        | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed.        |\n| [AsyncMap&lt;TResult>(SqlBuilder)][15]                                  | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                                |\n| [AsyncMap&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][16]  | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                          |\n| [CreateCommand][17]                                                     | Creates and returns a [DbCommand][18] object from the specified *sqlBuilder*.                                                      |\n| [Dispose()][19]                                                         | Releases all resources used by the current instance of the **Database** class.                                                     |\n| [Dispose(Boolean)][20]                                                  | Releases the resources used by this **Database** instance.                                                                         |\n| [EnsureConnectionOpen][21]                                              | Opens [Connection][9] (if it's not open) and returns an [IDisposable][22] object you can use to close it (if it wasn't open).      |\n| [EnsureConnectionOpenAsync][23]                                         | Opens [Connection][9] (if it's not open) and returns an [IAsyncDisposable][24] object you can use to close it (if it wasn't open). |\n| [EnsureInTransaction()][25]                                             | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.        |\n| [EnsureInTransaction(IsolationLevel)][26]                               | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.        |\n| [EnsureInTransactionAsync(CancellationToken)][27]                       | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.        |\n| [EnsureInTransactionAsync(IsolationLevel, CancellationToken)][28]       | Returns a virtual transaction that you can use to ensure a code block is always executed in a transaction, new or existing.        |\n| [Execute][29]                                                           | Executes the *nonQuery* command. Optionally uses a transaction and validates affected records value before committing.             |\n| [ExecuteAsync][30]                                                      | Executes the *nonQuery* command. Optionally uses a transaction and validates affected records value before committing.             |\n| [Find&lt;TEntity>][31]                                                  | Gets the entity whose primary key matches the *id* parameter.                                                                      |\n| [FindAsync&lt;TEntity>][32]                                             | Gets the entity whose primary key matches the *id* parameter.                                                                      |\n| [From(String)][33]                                                      | Creates and returns a new [SqlSet][1] using the provided table name.                                                               |\n| [From(String, Type)][34]                                                | Creates and returns a new [SqlSet][1] using the provided table name.                                                               |\n| [From&lt;TResult>(String)][35]                                          | Creates and returns a new [SqlSet&lt;TResult>][36] using the provided table name.                                                  |\n| [FromQuery(SqlBuilder)][37]                                             | Creates and returns a new [SqlSet][1] using the provided defining query.                                                           |\n| [FromQuery(SqlBuilder, Type)][38]                                       | Creates and returns a new [SqlSet][1] using the provided defining query.                                                           |\n| [FromQuery&lt;TResult>(SqlBuilder)][39]                                 | Creates and returns a new [SqlSet&lt;TResult>][36] using the provided defining query.                                              |\n| [FromQuery&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][40] | Creates and returns a new [SqlSet&lt;TResult>][36] using the provided defining query and mapper.                                   |\n| [LastInsertId][41]                                                      | Gets the identity value of the last inserted record.                                                                               |\n| [LastInsertIdAsync][42]                                                 | Gets the identity value of the last inserted record.                                                                               |\n| [Map(SqlBuilder)][43]                                                   | Maps the results of the *query* to dynamic objects. The query is deferred-executed.                                                |\n| [Map(SqlBuilder, Type)][44]                                             | Maps the results of the *query* to objects of type specified by the *resultType* parameter. The query is deferred-executed.        |\n| [Map&lt;TResult>(SqlBuilder)][45]                                       | Maps the results of the *query* to TResult objects. The query is deferred-executed.                                                |\n| [Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)][46]       | Maps the results of the *query* to TResult objects, using the provided *mapper* delegate.                                          |\n| [QuoteIdentifier][47]                                                   | Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier.                      |\n| [Remove][48]                                                            | Executes a DELETE command for the specified *entity*.                                                                              |\n| [RemoveAsync][49]                                                       | Executes a DELETE command for the specified *entity*.                                                                              |\n| [Table(Type)][50]                                                       | Returns the [SqlTable][51] instance for the specified *entityType*.                                                                |\n| [Table&lt;TEntity>()][52]                                               | Returns the [SqlTable&lt;TEntity>][3] instance for the specified TEntity.                                                          |\n| [Update(Object)][53]                                                    | Executes an UPDATE command for the specified *entity*.                                                                             |\n| [Update(Object, Object)][54]                                            | Executes an UPDATE command for the specified *entity*.                                                                             |\n| [UpdateAsync(Object, CancellationToken)][55]                            | Executes an UPDATE command for the specified *entity*.                                                                             |\n| [UpdateAsync(Object, Object, CancellationToken)][56]                    | Executes an UPDATE command for the specified *entity*.                                                                             |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][5]  \n\n[1]: ../SqlSet/README.md\n[2]: ../SqlBuilder/README.md\n[3]: ../SqlTable_1/README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: ../README.md\n[6]: _ctor.md\n[7]: _ctor_1.md\n[8]: Configuration.md\n[9]: Connection.md\n[10]: Transaction.md\n[11]: Add.md\n[12]: AddAsync.md\n[13]: AsyncMap.md\n[14]: AsyncMap_1.md\n[15]: AsyncMap__1.md\n[16]: AsyncMap__1_1.md\n[17]: CreateCommand.md\n[18]: https://learn.microsoft.com/dotnet/api/system.data.common.dbcommand\n[19]: Dispose.md\n[20]: Dispose_1.md\n[21]: EnsureConnectionOpen.md\n[22]: https://learn.microsoft.com/dotnet/api/system.idisposable\n[23]: EnsureConnectionOpenAsync.md\n[24]: https://learn.microsoft.com/dotnet/api/system.iasyncdisposable\n[25]: EnsureInTransaction.md\n[26]: EnsureInTransaction_1.md\n[27]: EnsureInTransactionAsync_1.md\n[28]: EnsureInTransactionAsync.md\n[29]: Execute.md\n[30]: ExecuteAsync.md\n[31]: Find__1.md\n[32]: FindAsync__1.md\n[33]: From.md\n[34]: From_1.md\n[35]: From__1.md\n[36]: ../SqlSet_1/README.md\n[37]: FromQuery.md\n[38]: FromQuery_1.md\n[39]: FromQuery__1.md\n[40]: FromQuery__1_1.md\n[41]: LastInsertId.md\n[42]: LastInsertIdAsync.md\n[43]: Map.md\n[44]: Map_1.md\n[45]: Map__1.md\n[46]: Map__1_1.md\n[47]: QuoteIdentifier.md\n[48]: Remove.md\n[49]: RemoveAsync.md\n[50]: Table.md\n[51]: ../SqlTable/README.md\n[52]: Table__1.md\n[53]: Update.md\n[54]: Update_1.md\n[55]: UpdateAsync_1.md\n[56]: UpdateAsync.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Remove.md",
    "content": "Database.Remove Method\n======================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool Remove(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose DELETE command is to be executed.\n\n#### Return Value\n[Boolean][3]  \n`true` if *entity* is deleted; otherwise, `false`.\n\nRemarks\n-------\nThis method is a shortcut for `db.Table(entity.GetType()).Remove(entity)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][4]  \n[DbExtensions Namespace][1]  \n[SqlTable.Remove(Object)][5]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md\n[5]: ../SqlTable/Remove.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/RemoveAsync.md",
    "content": "Database.RemoveAsync Method\n===========================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> RemoveAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose DELETE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if *entity* is deleted; otherwise, `false`.\n\nRemarks\n-------\nThis method is a shortcut for `await db.Table(entity.GetType()).RemoveAsync(entity, cancellationToken)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][1]  \n[SqlTable.RemoveAsync(Object, CancellationToken)][8]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: README.md\n[8]: ../SqlTable/RemoveAsync.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Table.md",
    "content": "Database.Table(Type) Method\n===========================\nReturns the [SqlTable][1] instance for the specified *entityType*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                     | Description                                                               |\n| ------------------------ | ------------------------------------------------------------------------- |\n| **Table(Type)**          | Returns the [SqlTable][1] instance for the specified *entityType*.        |\n| [Table&lt;TEntity>()][3] | Returns the [SqlTable&lt;TEntity>][4] instance for the specified TEntity. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlTable Table(\n\tType entityType\n)\n```\n\n#### Parameters\n\n##### *entityType*  [Type][5]\nThe type of the entity.\n\n#### Return Value\n[SqlTable][1]  \nThe [SqlTable][1] instance for *entityType*.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlTable/README.md\n[2]: ../README.md\n[3]: Table__1.md\n[4]: ../SqlTable_1/README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.type\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Table__1.md",
    "content": "Database.Table&lt;TEntity> Method\n=================================\nReturns the [SqlTable&lt;TEntity>][1] instance for the specified TEntity.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                    | Description                                                               |\n| ----------------------- | ------------------------------------------------------------------------- |\n| [Table(Type)][3]        | Returns the [SqlTable][4] instance for the specified *entityType*.        |\n| **Table&lt;TEntity>()** | Returns the [SqlTable&lt;TEntity>][1] instance for the specified TEntity. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlTable<TEntity> Table<TEntity>()\nwhere TEntity : class\n\n```\n\n#### Type Parameters\n\n##### *TEntity*\nThe type of the entity.\n\n#### Return Value\n[SqlTable][1]&lt;**TEntity**>  \nThe [SqlTable&lt;TEntity>][1] instance for TEntity.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlTable_1/README.md\n[2]: ../README.md\n[3]: Table.md\n[4]: ../SqlTable/README.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Transaction.md",
    "content": "Database.Transaction Property\n=============================\nGets or sets a transaction to associate with new commands.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic DbTransaction? Transaction { get; set; }\n```\n\n#### Property Value\n[DbTransaction][2]\n\nSee Also\n--------\n\n#### Reference\n[Database Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.data.common.dbtransaction\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Update.md",
    "content": "Database.Update(Object) Method\n==============================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                        | Description                                            |\n| --------------------------- | ------------------------------------------------------ |\n| **Update(Object)**          | Executes an UPDATE command for the specified *entity*. |\n| [Update(Object, Object)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n\nRemarks\n-------\nThis method is a shortcut for `db.Table(entity.GetType()).Update(entity)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][4]  \n[DbExtensions Namespace][1]  \n[SqlTable.Update(Object)][5]  \n\n[1]: ../README.md\n[2]: Update_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md\n[5]: ../SqlTable/Update.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/UpdateAsync.md",
    "content": "Database.UpdateAsync(Object, Object, CancellationToken) Method\n==============================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                            |\n| -------------------------------------------------- | ------------------------------------------------------ |\n| [UpdateAsync(Object, CancellationToken)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **UpdateAsync(Object, Object, CancellationToken)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tObject entity,\n\tObject? originalId,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][3]\nThe original primary key value.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]\n\nRemarks\n-------\nThis method is a shortcut for `await db.Table(entity.GetType()).UpdateAsync(entity, originalId, cancellationToken)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][1]  \n[SqlTable.UpdateAsync(Object, Object, CancellationToken)][8]  \n\n[1]: ../README.md\n[2]: UpdateAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[7]: README.md\n[8]: ../SqlTable/UpdateAsync.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/UpdateAsync_1.md",
    "content": "Database.UpdateAsync(Object, CancellationToken) Method\n======================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                | Description                                            |\n| --------------------------------------------------- | ------------------------------------------------------ |\n| **UpdateAsync(Object, CancellationToken)**          | Executes an UPDATE command for the specified *entity*. |\n| [UpdateAsync(Object, Object, CancellationToken)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]\n\nRemarks\n-------\nThis method is a shortcut for `await db.Table(entity.GetType()).UpdateAsync(entity, cancellationToken)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][7]  \n[DbExtensions Namespace][1]  \n[SqlTable.UpdateAsync(Object, CancellationToken)][8]  \n\n[1]: ../README.md\n[2]: UpdateAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[7]: README.md\n[8]: ../SqlTable/UpdateAsync_1.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/Update_1.md",
    "content": "Database.Update(Object, Object) Method\n======================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                       | Description                                            |\n| -------------------------- | ------------------------------------------------------ |\n| [Update(Object)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **Update(Object, Object)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tObject entity,\n\tObject? originalId\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][3]\nThe original primary key value.\n\n\nRemarks\n-------\nThis method is a shortcut for `db.Table(entity.GetType()).Update(entity, originalId)`.\n\nSee Also\n--------\n\n#### Reference\n[Database Class][4]  \n[DbExtensions Namespace][1]  \n[SqlTable.Update(Object, Object)][5]  \n\n[1]: ../README.md\n[2]: Update.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md\n[5]: ../SqlTable/Update_1.md"
  },
  {
    "path": "docs/api/DbExtensions/Database/_ctor.md",
    "content": "Database(DbConnection) Constructor\n==================================\nInitializes a new instance of the [Database][1] class using the provided connection.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                          | Description                                                                                                               |\n| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| **Database(DbConnection)**    | Initializes a new instance of the [Database][1] class using the provided connection.                                      |\n| [Database(String, String)][3] | Initializes a new instance of the [Database][1] class using the provided connection string and provider's invariant name. |\n\n\nSyntax\n------\n\n```csharp\npublic Database(\n\tDbConnection connection\n)\n```\n\n#### Parameters\n\n##### *connection*  [DbConnection][4]\nThe connection.\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md\n[3]: _ctor_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbconnection"
  },
  {
    "path": "docs/api/DbExtensions/Database/_ctor_1.md",
    "content": "Database(String, String) Constructor\n====================================\nInitializes a new instance of the [Database][1] class using the provided connection string and provider's invariant name.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                         | Description                                                                                                               |\n| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- |\n| [Database(DbConnection)][3]  | Initializes a new instance of the [Database][1] class using the provided connection.                                      |\n| **Database(String, String)** | Initializes a new instance of the [Database][1] class using the provided connection string and provider's invariant name. |\n\n\nSyntax\n------\n\n```csharp\npublic Database(\n\tstring connectionString,\n\tstring providerInvariantName\n)\n```\n\n#### Parameters\n\n##### *connectionString*  [String][4]\nThe connection string.\n\n##### *providerInvariantName*  [String][4]\nThe provider's invariant name.\n\n\nSee Also\n--------\n\n#### Reference\n[Database Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md\n[3]: _ctor.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/CommandTimeout.md",
    "content": "DatabaseConfiguration.CommandTimeout Property\n=============================================\nSpecifies a timeout to assign to commands. This setting is ignored if less or equal to -1. The default is -1.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic int CommandTimeout { get; set; }\n```\n\n#### Property Value\n[Int32][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/DefaultComplexPropertySeparator.md",
    "content": "DatabaseConfiguration.DefaultComplexPropertySeparator Property\n==============================================================\nThe default separator to use when mapping complex properties. The default value is null, which means no separator is used, unless an explicit separator is specified on [ComplexPropertyAttribute.Separator][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? DefaultComplexPropertySeparator { get; set; }\n```\n\n#### Property Value\n[String][3]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][4]  \n[DbExtensions Namespace][2]  \n\n[1]: ../ComplexPropertyAttribute/Separator.md\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/EnableBatchCommands.md",
    "content": "DatabaseConfiguration.EnableBatchCommands Property\n==================================================\n`true` to execute batch commands when possible; otherwise, `false`. The default is `true`.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool EnableBatchCommands { get; set; }\n```\n\n#### Property Value\n[Boolean][2]\n\nRemarks\n-------\nThis setting affects the behavior of [AddRange(TEntity[])][3], [UpdateRange(TEntity[])][4] and [RemoveRange(TEntity[])][5].\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: ../SqlTable_1/AddRange_1.md\n[4]: ../SqlTable_1/UpdateRange_1.md\n[5]: ../SqlTable_1/RemoveRange_1.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/LastInsertIdCommand.md",
    "content": "DatabaseConfiguration.LastInsertIdCommand Property\n==================================================\nGets or sets the SQL command that returns the last identity value generated on the database.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string LastInsertIdCommand { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/Log.md",
    "content": "DatabaseConfiguration.Log Property\n==================================\nSpecifies the destination to write the SQL query or command.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic TextWriter? Log { get; set; }\n```\n\n#### Property Value\n[TextWriter][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.io.textwriter\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/ParameterNameBuilder.md",
    "content": "DatabaseConfiguration.ParameterNameBuilder Property\n===================================================\nSpecifies a function that prepares a parameter name to be used on [DbParameter.ParameterName][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Func<string, string> ParameterNameBuilder { get; set; }\n```\n\n#### Property Value\n[Func][3]&lt;[String][4], [String][4]>\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.parametername\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.func-2\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/ParameterPlaceholderBuilder.md",
    "content": "DatabaseConfiguration.ParameterPlaceholderBuilder Property\n==========================================================\nSpecifies a function that builds a parameter placeholder to be used in SQL statements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Func<string, string> ParameterPlaceholderBuilder { get; set; }\n```\n\n#### Property Value\n[Func][2]&lt;[String][3], [String][3]>\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.func-2\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/QuotePrefix.md",
    "content": "DatabaseConfiguration.QuotePrefix Property\n==========================================\nGets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string QuotePrefix { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/QuoteSuffix.md",
    "content": "DatabaseConfiguration.QuoteSuffix Property\n==========================================\nGets or sets the ending character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string QuoteSuffix { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/README.md",
    "content": "DatabaseConfiguration Class\n===========================\nHolds configuration options that customize the behavior of [Database][1]. This class cannot be instantiated, to get an instance use the [Configuration][2] property.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][3]  \n  **DbExtensions.DatabaseConfiguration**  \n  \n**Namespace:** [DbExtensions][4]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class DatabaseConfiguration\n```\n\nThe **DatabaseConfiguration** type exposes the following members.\n\n\nProperties\n----------\n\n| Name                                 | Description                                                                                                                                                                                                      |\n| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [CommandTimeout][5]                  | Specifies a timeout to assign to commands. This setting is ignored if less or equal to -1. The default is -1.                                                                                                    |\n| [DefaultComplexPropertySeparator][6] | The default separator to use when mapping complex properties. The default value is null, which means no separator is used, unless an explicit separator is specified on [ComplexPropertyAttribute.Separator][7]. |\n| [EnableBatchCommands][8]             | `true` to execute batch commands when possible; otherwise, `false`. The default is `true`.                                                                                                                       |\n| [LastInsertIdCommand][9]             | Gets or sets the SQL command that returns the last identity value generated on the database.                                                                                                                     |\n| [Log][10]                            | Specifies the destination to write the SQL query or command.                                                                                                                                                     |\n| [ParameterNameBuilder][11]           | Specifies a function that prepares a parameter name to be used on [DbParameter.ParameterName][12].                                                                                                               |\n| [ParameterPlaceholderBuilder][13]    | Specifies a function that builds a parameter placeholder to be used in SQL statements.                                                                                                                           |\n| [QuotePrefix][14]                    | Gets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.                    |\n| [QuoteSuffix][15]                    | Gets or sets the ending character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.                       |\n| [UseVersionMember][16]               | `true` to include version column check in SQL statements' predicates; otherwise, `false`. The default is `true`.                                                                                                 |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][4]  \n\n[1]: ../Database/README.md\n[2]: ../Database/Configuration.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: ../README.md\n[5]: CommandTimeout.md\n[6]: DefaultComplexPropertySeparator.md\n[7]: ../ComplexPropertyAttribute/Separator.md\n[8]: EnableBatchCommands.md\n[9]: LastInsertIdCommand.md\n[10]: Log.md\n[11]: ParameterNameBuilder.md\n[12]: https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.parametername\n[13]: ParameterPlaceholderBuilder.md\n[14]: QuotePrefix.md\n[15]: QuoteSuffix.md\n[16]: UseVersionMember.md"
  },
  {
    "path": "docs/api/DbExtensions/DatabaseConfiguration/UseVersionMember.md",
    "content": "DatabaseConfiguration.UseVersionMember Property\n===============================================\n`true` to include version column check in SQL statements' predicates; otherwise, `false`. The default is `true`.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool UseVersionMember { get; set; }\n```\n\n#### Property Value\n[Boolean][2]\n\nSee Also\n--------\n\n#### Reference\n[DatabaseConfiguration Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetBoolean.md",
    "content": "Extensions.GetBoolean Method\n============================\nGets the value of the specified column as a [Boolean][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static bool GetBoolean(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Boolean][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.boolean\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetByte.md",
    "content": "Extensions.GetByte Method\n=========================\nGets the value of the specified column as a [Byte][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static byte GetByte(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Byte][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.byte\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetChar.md",
    "content": "Extensions.GetChar Method\n=========================\nGets the value of the specified column as a [Char][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static char GetChar(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Char][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.char\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetDateTime.md",
    "content": "Extensions.GetDateTime Method\n=============================\nGets the value of the specified column as a [DateTime][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static DateTime GetDateTime(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[DateTime][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.datetime\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetDecimal.md",
    "content": "Extensions.GetDecimal Method\n============================\nGets the value of the specified column as a [Decimal][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static decimal GetDecimal(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Decimal][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.decimal\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetDouble.md",
    "content": "Extensions.GetDouble Method\n===========================\nGets the value of the specified column as a [Double][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static double GetDouble(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Double][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.double\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetFloat.md",
    "content": "Extensions.GetFloat Method\n==========================\nGets the value of the specified column as a [Single][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static float GetFloat(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Single][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.single\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetInt16.md",
    "content": "Extensions.GetInt16 Method\n==========================\nGets the value of the specified column as an [Int16][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static short GetInt16(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Int16][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int16\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetInt32.md",
    "content": "Extensions.GetInt32 Method\n==========================\nGets the value of the specified column as an [Int32][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static int GetInt32(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Int32][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int32\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetInt64.md",
    "content": "Extensions.GetInt64 Method\n==========================\nGets the value of the specified column as an [Int64][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static long GetInt64(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][4]\nThe name of the column to find.\n\n#### Return Value\n[Int64][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableBoolean.md",
    "content": "Extensions.GetNullableBoolean(DbDataReader, Int32) Method\n=========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                          | Description                                                                      |\n| --------------------------------------------- | -------------------------------------------------------------------------------- |\n| **GetNullableBoolean(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2]. |\n| [GetNullableBoolean(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static bool? GetNullableBoolean(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Boolean][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: ../README.md\n[4]: GetNullableBoolean_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableBoolean_1.md",
    "content": "Extensions.GetNullableBoolean(DbDataReader, String) Method\n==========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                         | Description                                                                      |\n| -------------------------------------------- | -------------------------------------------------------------------------------- |\n| [GetNullableBoolean(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2]. |\n| **GetNullableBoolean(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Boolean][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static bool? GetNullableBoolean(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Boolean][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: ../README.md\n[4]: GetNullableBoolean.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableByte.md",
    "content": "Extensions.GetNullableByte(DbDataReader, Int32) Method\n======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                   |\n| ------------------------------------------ | ----------------------------------------------------------------------------- |\n| **GetNullableByte(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2]. |\n| [GetNullableByte(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static byte? GetNullableByte(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Byte][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.byte\n[3]: ../README.md\n[4]: GetNullableByte_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableByte_1.md",
    "content": "Extensions.GetNullableByte(DbDataReader, String) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                   |\n| ----------------------------------------- | ----------------------------------------------------------------------------- |\n| [GetNullableByte(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2]. |\n| **GetNullableByte(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Byte][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static byte? GetNullableByte(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Byte][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.byte\n[3]: ../README.md\n[4]: GetNullableByte.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableChar.md",
    "content": "Extensions.GetNullableChar(DbDataReader, Int32) Method\n======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                   |\n| ------------------------------------------ | ----------------------------------------------------------------------------- |\n| **GetNullableChar(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2]. |\n| [GetNullableChar(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static char? GetNullableChar(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Char][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.char\n[3]: ../README.md\n[4]: GetNullableChar_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableChar_1.md",
    "content": "Extensions.GetNullableChar(DbDataReader, String) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                   |\n| ----------------------------------------- | ----------------------------------------------------------------------------- |\n| [GetNullableChar(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2]. |\n| **GetNullableChar(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Char][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static char? GetNullableChar(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Char][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.char\n[3]: ../README.md\n[4]: GetNullableChar.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDateTime.md",
    "content": "Extensions.GetNullableDateTime(DbDataReader, Int32) Method\n==========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                           | Description                                                                       |\n| ---------------------------------------------- | --------------------------------------------------------------------------------- |\n| **GetNullableDateTime(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2]. |\n| [GetNullableDateTime(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static DateTime? GetNullableDateTime(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[DateTime][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.datetime\n[3]: ../README.md\n[4]: GetNullableDateTime_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDateTime_1.md",
    "content": "Extensions.GetNullableDateTime(DbDataReader, String) Method\n===========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                          | Description                                                                       |\n| --------------------------------------------- | --------------------------------------------------------------------------------- |\n| [GetNullableDateTime(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2]. |\n| **GetNullableDateTime(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [DateTime][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static DateTime? GetNullableDateTime(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[DateTime][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.datetime\n[3]: ../README.md\n[4]: GetNullableDateTime.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDecimal.md",
    "content": "Extensions.GetNullableDecimal(DbDataReader, Int32) Method\n=========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                          | Description                                                                      |\n| --------------------------------------------- | -------------------------------------------------------------------------------- |\n| **GetNullableDecimal(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2]. |\n| [GetNullableDecimal(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static decimal? GetNullableDecimal(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Decimal][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.decimal\n[3]: ../README.md\n[4]: GetNullableDecimal_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDecimal_1.md",
    "content": "Extensions.GetNullableDecimal(DbDataReader, String) Method\n==========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                         | Description                                                                      |\n| -------------------------------------------- | -------------------------------------------------------------------------------- |\n| [GetNullableDecimal(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2]. |\n| **GetNullableDecimal(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Decimal][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static decimal? GetNullableDecimal(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Decimal][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.decimal\n[3]: ../README.md\n[4]: GetNullableDecimal.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDouble.md",
    "content": "Extensions.GetNullableDouble(DbDataReader, Int32) Method\n========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                         | Description                                                                     |\n| -------------------------------------------- | ------------------------------------------------------------------------------- |\n| **GetNullableDouble(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2]. |\n| [GetNullableDouble(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static double? GetNullableDouble(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Double][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.double\n[3]: ../README.md\n[4]: GetNullableDouble_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableDouble_1.md",
    "content": "Extensions.GetNullableDouble(DbDataReader, String) Method\n=========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                     |\n| ------------------------------------------- | ------------------------------------------------------------------------------- |\n| [GetNullableDouble(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2]. |\n| **GetNullableDouble(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Double][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static double? GetNullableDouble(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Double][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.double\n[3]: ../README.md\n[4]: GetNullableDouble.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableFloat.md",
    "content": "Extensions.GetNullableFloat(DbDataReader, Int32) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                     |\n| ------------------------------------------- | ------------------------------------------------------------------------------- |\n| **GetNullableFloat(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2]. |\n| [GetNullableFloat(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static float? GetNullableFloat(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Single][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.single\n[3]: ../README.md\n[4]: GetNullableFloat_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableFloat_1.md",
    "content": "Extensions.GetNullableFloat(DbDataReader, String) Method\n========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                     |\n| ------------------------------------------ | ------------------------------------------------------------------------------- |\n| [GetNullableFloat(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2]. |\n| **GetNullableFloat(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Single][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static float? GetNullableFloat(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Single][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.single\n[3]: ../README.md\n[4]: GetNullableFloat.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableGuid.md",
    "content": "Extensions.GetNullableGuid(DbDataReader, Int32) Method\n======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                   |\n| ------------------------------------------ | ----------------------------------------------------------------------------- |\n| **GetNullableGuid(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2]. |\n| [GetNullableGuid(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static Guid? GetNullableGuid(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Guid][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.guid\n[3]: ../README.md\n[4]: GetNullableGuid_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableGuid_1.md",
    "content": "Extensions.GetNullableGuid(DbDataReader, String) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                   |\n| ----------------------------------------- | ----------------------------------------------------------------------------- |\n| [GetNullableGuid(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2]. |\n| **GetNullableGuid(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Guid][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static Guid? GetNullableGuid(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Guid][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.guid\n[3]: ../README.md\n[4]: GetNullableGuid.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt16.md",
    "content": "Extensions.GetNullableInt16(DbDataReader, Int32) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                    |\n| ------------------------------------------- | ------------------------------------------------------------------------------ |\n| **GetNullableInt16(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2]. |\n| [GetNullableInt16(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static short? GetNullableInt16(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Int16][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int16\n[3]: ../README.md\n[4]: GetNullableInt16_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt16_1.md",
    "content": "Extensions.GetNullableInt16(DbDataReader, String) Method\n========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                    |\n| ------------------------------------------ | ------------------------------------------------------------------------------ |\n| [GetNullableInt16(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2]. |\n| **GetNullableInt16(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int16][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static short? GetNullableInt16(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Int16][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int16\n[3]: ../README.md\n[4]: GetNullableInt16.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt32.md",
    "content": "Extensions.GetNullableInt32(DbDataReader, Int32) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                    |\n| ------------------------------------------- | ------------------------------------------------------------------------------ |\n| **GetNullableInt32(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2]. |\n| [GetNullableInt32(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static int? GetNullableInt32(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][2]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Int32][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][6] or [Extension Methods (C# Programming Guide)][7].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][8]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: ../README.md\n[4]: GetNullableInt32_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[7]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt32_1.md",
    "content": "Extensions.GetNullableInt32(DbDataReader, String) Method\n========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                    |\n| ------------------------------------------ | ------------------------------------------------------------------------------ |\n| [GetNullableInt32(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2]. |\n| **GetNullableInt32(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int32][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static int? GetNullableInt32(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Int32][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: ../README.md\n[4]: GetNullableInt32.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt64.md",
    "content": "Extensions.GetNullableInt64(DbDataReader, Int32) Method\n=======================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                    |\n| ------------------------------------------- | ------------------------------------------------------------------------------ |\n| **GetNullableInt64(DbDataReader, Int32)**   | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2]. |\n| [GetNullableInt64(DbDataReader, String)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static long? GetNullableInt64(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *i*  [Int32][6]\nThe zero-based column ordinal.\n\n#### Return Value\n[Nullable][1]&lt;[Int64][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int64\n[3]: ../README.md\n[4]: GetNullableInt64_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetNullableInt64_1.md",
    "content": "Extensions.GetNullableInt64(DbDataReader, String) Method\n========================================================\nGets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                    |\n| ------------------------------------------ | ------------------------------------------------------------------------------ |\n| [GetNullableInt64(DbDataReader, Int32)][4] | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2]. |\n| **GetNullableInt64(DbDataReader, String)** | Gets the value of the specified column as a [Nullable&lt;T>][1] of [Int64][2]. |\n\n\nSyntax\n------\n\n```csharp\npublic static long? GetNullableInt64(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][5]\nThe data reader.\n\n##### *name*  [String][6]\nThe name of the column to find.\n\n#### Return Value\n[Nullable][1]&lt;[Int64][2]>  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][5]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][7] or [Extension Methods (C# Programming Guide)][8].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][9]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[2]: https://learn.microsoft.com/dotnet/api/system.int64\n[3]: ../README.md\n[4]: GetNullableInt64.md\n[5]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[8]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetString.md",
    "content": "Extensions.GetString Method\n===========================\nGets the value of the specified column as a [String][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static string GetString(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][3]\nThe data reader.\n\n##### *name*  [String][1]\nThe name of the column to find.\n\n#### Return Value\n[String][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][3]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][4] or [Extension Methods (C# Programming Guide)][5].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.string\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[4]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[5]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetStringOrNull.md",
    "content": "Extensions.GetStringOrNull(DbDataReader, Int32) Method\n======================================================\nGets the value of the specified column as a [String][1], or null (Nothing in Visual Basic).\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                 |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------- |\n| **GetStringOrNull(DbDataReader, Int32)**   | Gets the value of the specified column as a [String][1], or null (Nothing in Visual Basic). |\n| [GetStringOrNull(DbDataReader, String)][3] | Gets the value of the specified column as a [String][1], or null (Nothing in Visual Basic). |\n\n\nSyntax\n------\n\n```csharp\npublic static string? GetStringOrNull(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][4]\nThe data reader.\n\n##### *i*  [Int32][5]\nThe zero-based column ordinal.\n\n#### Return Value\n[String][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][4]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][6] or [Extension Methods (C# Programming Guide)][7].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.string\n[2]: ../README.md\n[3]: GetStringOrNull_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[5]: https://learn.microsoft.com/dotnet/api/system.int32\n[6]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[7]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetStringOrNull_1.md",
    "content": "Extensions.GetStringOrNull(DbDataReader, String) Method\n=======================================================\nGets the value of the specified column as a [String][1], or null (Nothing in Visual Basic).\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                                 |\n| ----------------------------------------- | ------------------------------------------------------------------------------------------- |\n| [GetStringOrNull(DbDataReader, Int32)][3] | Gets the value of the specified column as a [String][1], or null (Nothing in Visual Basic). |\n| **GetStringOrNull(DbDataReader, String)** | Gets the value of the specified column as a [String][1], or null (Nothing in Visual Basic). |\n\n\nSyntax\n------\n\n```csharp\npublic static string? GetStringOrNull(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][4]\nThe data reader.\n\n##### *name*  [String][1]\nThe name of the column to find.\n\n#### Return Value\n[String][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][4]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.string\n[2]: ../README.md\n[3]: GetStringOrNull.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetValue.md",
    "content": "Extensions.GetValue Method\n==========================\nGets the value of the specified column.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static Object GetValue(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][2]\nThe data reader.\n\n##### *name*  [String][3]\nThe name of the column to find.\n\n#### Return Value\n[Object][4]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][2]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][5] or [Extension Methods (C# Programming Guide)][6].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[6]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetValueOrNull.md",
    "content": "Extensions.GetValueOrNull(DbDataReader, Int32) Method\n=====================================================\nGets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic).\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                                  |\n| ----------------------------------------- | -------------------------------------------------------------------------------------------- |\n| **GetValueOrNull(DbDataReader, Int32)**   | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n| [GetValueOrNull(DbDataReader, String)][3] | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n\n\nSyntax\n------\n\n```csharp\npublic static Object? GetValueOrNull(\n\tthis DbDataReader reader,\n\tint i\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][4]\nThe data reader.\n\n##### *i*  [Int32][5]\nThe zero-based column ordinal.\n\n#### Return Value\n[Object][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][4]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][6] or [Extension Methods (C# Programming Guide)][7].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: ../README.md\n[3]: GetValueOrNull_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[5]: https://learn.microsoft.com/dotnet/api/system.int32\n[6]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[7]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/GetValueOrNull_1.md",
    "content": "Extensions.GetValueOrNull(DbDataReader, String) Method\n======================================================\nGets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic).\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                                                                  |\n| ---------------------------------------- | -------------------------------------------------------------------------------------------- |\n| [GetValueOrNull(DbDataReader, Int32)][3] | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n| **GetValueOrNull(DbDataReader, String)** | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n\n\nSyntax\n------\n\n```csharp\npublic static Object? GetValueOrNull(\n\tthis DbDataReader reader,\n\tstring name\n)\n```\n\n#### Parameters\n\n##### *reader*  [DbDataReader][4]\nThe data reader.\n\n##### *name*  [String][5]\nThe name of the column to find.\n\n#### Return Value\n[Object][1]  \nThe value of the column.\n#### Usage Note\nIn Visual Basic and C#, you can call this method as an instance method on any object of type [DbDataReader][4]. When you use instance method syntax to call this method, omit the first parameter. For more information, see [Extension Methods (Visual Basic)][6] or [Extension Methods (C# Programming Guide)][7].\n\nSee Also\n--------\n\n#### Reference\n[Extensions Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: ../README.md\n[3]: GetValueOrNull.md\n[4]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/procedures/extension-methods\n[7]: https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/extension-methods\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/Extensions/README.md",
    "content": "Extensions Class\n================\nProvides extension methods for common ADO.NET objects.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  **DbExtensions.Extensions**  \n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static class Extensions\n```\n\nThe **Extensions** type exposes the following members.\n\n\nMethods\n-------\n\n| Name                                            | Description                                                                                  |\n| ----------------------------------------------- | -------------------------------------------------------------------------------------------- |\n| [GetBoolean][3]                                 | Gets the value of the specified column as a [Boolean][4].                                    |\n| [GetByte][5]                                    | Gets the value of the specified column as a [Byte][6].                                       |\n| [GetChar][7]                                    | Gets the value of the specified column as a [Char][8].                                       |\n| [GetDateTime][9]                                | Gets the value of the specified column as a [DateTime][10].                                  |\n| [GetDecimal][11]                                | Gets the value of the specified column as a [Decimal][12].                                   |\n| [GetDouble][13]                                 | Gets the value of the specified column as a [Double][14].                                    |\n| [GetFloat][15]                                  | Gets the value of the specified column as a [Single][16].                                    |\n| [GetInt16][17]                                  | Gets the value of the specified column as an [Int16][18].                                    |\n| [GetInt32][19]                                  | Gets the value of the specified column as an [Int32][20].                                    |\n| [GetInt64][21]                                  | Gets the value of the specified column as an [Int64][22].                                    |\n| [GetNullableBoolean(DbDataReader, Int32)][23]   | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Boolean][4].            |\n| [GetNullableBoolean(DbDataReader, String)][25]  | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Boolean][4].            |\n| [GetNullableByte(DbDataReader, Int32)][26]      | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Byte][6].               |\n| [GetNullableByte(DbDataReader, String)][27]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Byte][6].               |\n| [GetNullableChar(DbDataReader, Int32)][28]      | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Char][8].               |\n| [GetNullableChar(DbDataReader, String)][29]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Char][8].               |\n| [GetNullableDateTime(DbDataReader, Int32)][30]  | Gets the value of the specified column as a [Nullable&lt;T>][24] of [DateTime][10].          |\n| [GetNullableDateTime(DbDataReader, String)][31] | Gets the value of the specified column as a [Nullable&lt;T>][24] of [DateTime][10].          |\n| [GetNullableDecimal(DbDataReader, Int32)][32]   | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Decimal][12].           |\n| [GetNullableDecimal(DbDataReader, String)][33]  | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Decimal][12].           |\n| [GetNullableDouble(DbDataReader, Int32)][34]    | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Double][14].            |\n| [GetNullableDouble(DbDataReader, String)][35]   | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Double][14].            |\n| [GetNullableFloat(DbDataReader, Int32)][36]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Single][16].            |\n| [GetNullableFloat(DbDataReader, String)][37]    | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Single][16].            |\n| [GetNullableGuid(DbDataReader, Int32)][38]      | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Guid][39].              |\n| [GetNullableGuid(DbDataReader, String)][40]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Guid][39].              |\n| [GetNullableInt16(DbDataReader, Int32)][41]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int16][18].             |\n| [GetNullableInt16(DbDataReader, String)][42]    | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int16][18].             |\n| [GetNullableInt32(DbDataReader, Int32)][43]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int32][20].             |\n| [GetNullableInt32(DbDataReader, String)][44]    | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int32][20].             |\n| [GetNullableInt64(DbDataReader, Int32)][45]     | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int64][22].             |\n| [GetNullableInt64(DbDataReader, String)][46]    | Gets the value of the specified column as a [Nullable&lt;T>][24] of [Int64][22].             |\n| [GetString][47]                                 | Gets the value of the specified column as a [String][48].                                    |\n| [GetStringOrNull(DbDataReader, Int32)][49]      | Gets the value of the specified column as a [String][48], or null (Nothing in Visual Basic). |\n| [GetStringOrNull(DbDataReader, String)][50]     | Gets the value of the specified column as a [String][48], or null (Nothing in Visual Basic). |\n| [GetValue][51]                                  | Gets the value of the specified column.                                                      |\n| [GetValueOrNull(DbDataReader, Int32)][52]       | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n| [GetValueOrNull(DbDataReader, String)][53]      | Gets the value of the specified column as an [Object][1], or null (Nothing in Visual Basic). |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: ../README.md\n[3]: GetBoolean.md\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: GetByte.md\n[6]: https://learn.microsoft.com/dotnet/api/system.byte\n[7]: GetChar.md\n[8]: https://learn.microsoft.com/dotnet/api/system.char\n[9]: GetDateTime.md\n[10]: https://learn.microsoft.com/dotnet/api/system.datetime\n[11]: GetDecimal.md\n[12]: https://learn.microsoft.com/dotnet/api/system.decimal\n[13]: GetDouble.md\n[14]: https://learn.microsoft.com/dotnet/api/system.double\n[15]: GetFloat.md\n[16]: https://learn.microsoft.com/dotnet/api/system.single\n[17]: GetInt16.md\n[18]: https://learn.microsoft.com/dotnet/api/system.int16\n[19]: GetInt32.md\n[20]: https://learn.microsoft.com/dotnet/api/system.int32\n[21]: GetInt64.md\n[22]: https://learn.microsoft.com/dotnet/api/system.int64\n[23]: GetNullableBoolean.md\n[24]: https://learn.microsoft.com/dotnet/api/system.nullable-1\n[25]: GetNullableBoolean_1.md\n[26]: GetNullableByte.md\n[27]: GetNullableByte_1.md\n[28]: GetNullableChar.md\n[29]: GetNullableChar_1.md\n[30]: GetNullableDateTime.md\n[31]: GetNullableDateTime_1.md\n[32]: GetNullableDecimal.md\n[33]: GetNullableDecimal_1.md\n[34]: GetNullableDouble.md\n[35]: GetNullableDouble_1.md\n[36]: GetNullableFloat.md\n[37]: GetNullableFloat_1.md\n[38]: GetNullableGuid.md\n[39]: https://learn.microsoft.com/dotnet/api/system.guid\n[40]: GetNullableGuid_1.md\n[41]: GetNullableInt16.md\n[42]: GetNullableInt16_1.md\n[43]: GetNullableInt32.md\n[44]: GetNullableInt32_1.md\n[45]: GetNullableInt64.md\n[46]: GetNullableInt64_1.md\n[47]: GetString.md\n[48]: https://learn.microsoft.com/dotnet/api/system.string\n[49]: GetStringOrNull.md\n[50]: GetStringOrNull_1.md\n[51]: GetValue.md\n[52]: GetValueOrNull.md\n[53]: GetValueOrNull_1.md"
  },
  {
    "path": "docs/api/DbExtensions/README.md",
    "content": "DbExtensions Namespace\n======================\nDbExtensions is a data-access framework with a strong focus on query composition, granularity and code aesthetics. [Database][1] is the entry point of the **DbExtensions** API.\n\n\nClasses\n-------\n\n| Class                         | Description                                                                                                                                                                                                                                                                                          |\n| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [AssociationAttribute][2]     | Designates a property to represent a database association, such as a foreign key relationship.                                                                                                                                                                                                       |\n| [ChangeConflictException][3]  | An exception that is thrown when a concurrency violation is encountered while saving to the database. A concurrency violation occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has been modified since it was loaded into memory. |\n| [ColumnAttribute][4]          | Associates a property with a column in a database table.                                                                                                                                                                                                                                             |\n| [ComplexPropertyAttribute][5] | Designates a property as a complex property that groups columns of a table that share the same base name.                                                                                                                                                                                            |\n| [Database][1]                 | Provides simple data access using [SqlSet][6], [SqlBuilder][7] and [SqlTable&lt;TEntity>][8].                                                                                                                                                                                                        |\n| [DatabaseConfiguration][9]    | Holds configuration options that customize the behavior of [Database][1]. This class cannot be instantiated, to get an instance use the [Configuration][10] property.                                                                                                                                |\n| [Extensions][11]              | Provides extension methods for common ADO.NET objects.                                                                                                                                                                                                                                               |\n| [SQL][12]                     | Provides a set of static (Shared in Visual Basic) methods to create [SqlBuilder][7] instances.                                                                                                                                                                                                       |\n| [SqlBuilder][7]               | Represents a mutable SQL string.                                                                                                                                                                                                                                                                     |\n| [SqlClause][13]               | Provides information about a SQL clause. Used by [SqlBuilder][7].                                                                                                                                                                                                                                    |\n| [SqlSet][6]                   | Represents an immutable, connected SQL query. This class cannot be instantiated, to get an instance use one of the [Database.From][14] or [Database.FromQuery][15] overloads.                                                                                                                        |\n| [SqlSet&lt;TResult>][16]      | Represents an immutable, connected SQL query that maps to TResult objects. This class cannot be instantiated, to get an instance use one of the [Database.From&lt;TResult>(String)][17] or [Database.FromQuery&lt;TResult>(SqlBuilder)][18] overloads.                                               |\n| [SqlTable][19]                | A non-generic version of [SqlTable&lt;TEntity>][8] which can be used when the type of the entity is not known at build time. This class cannot be instantiated, to get an instance use the [Database.Table(Type)][20] method.                                                                        |\n| [SqlTable&lt;TEntity>][8]     | A [SqlSet&lt;TResult>][16] that provides CRUD (Create, Read, Update, Delete) operations for annotated classes. This class cannot be instantiated, to get an instance use the [Database.Table&lt;TEntity>()][21] method.                                                                              |\n| [TableAttribute][22]          | Designates a class as an entity class that is associated with a database table.                                                                                                                                                                                                                      |\n\n\nEnumerations\n------------\n\n| Enumeration    | Description                                                                                                                   |\n| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| [AutoSync][23] | Used to specify for during INSERT and UPDATE operations when a data member should be read back after the operation completes. |\n\n[1]: Database/README.md\n[2]: AssociationAttribute/README.md\n[3]: ChangeConflictException/README.md\n[4]: ColumnAttribute/README.md\n[5]: ComplexPropertyAttribute/README.md\n[6]: SqlSet/README.md\n[7]: SqlBuilder/README.md\n[8]: SqlTable_1/README.md\n[9]: DatabaseConfiguration/README.md\n[10]: Database/Configuration.md\n[11]: Extensions/README.md\n[12]: SQL/README.md\n[13]: SqlClause/README.md\n[14]: Database/From.md\n[15]: Database/FromQuery.md\n[16]: SqlSet_1/README.md\n[17]: Database/From__1.md\n[18]: Database/FromQuery__1.md\n[19]: SqlTable/README.md\n[20]: Database/Table.md\n[21]: Database/Table__1.md\n[22]: TableAttribute/README.md\n[23]: AutoSync/README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/DELETE_FROM.md",
    "content": "SQL.DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;SqlClause.DELETE_FROM>) Method\n================================================================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided string interpolated *handler*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                                                                                 |\n| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| **DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)** | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided string interpolated *handler*. |\n| [DELETE_FROM(String)][3]                                        | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder DELETE_FROM(\n\tref ClauseStringHandler<DELETE_FROM> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;DELETE_FROM>\nThe body of the DELETE FROM clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)][4].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: DELETE_FROM_1.md\n[4]: ../SqlBuilder/DELETE_FROM.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/DELETE_FROM_1.md",
    "content": "SQL.DELETE_FROM(String) Method\n==============================\nCreates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                                 |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| [DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided string interpolated *handler*. |\n| **DELETE_FROM(String)**                                          | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder DELETE_FROM(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][4]\nThe body of the DELETE FROM clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [DELETE_FROM(String)][5].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: DELETE_FROM.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: ../SqlBuilder/DELETE_FROM_1.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/INSERT_INTO.md",
    "content": "SQL.INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;SqlClause.INSERT_INTO>) Method\n================================================================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided string interpolated *handler*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                                                                                 |\n| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| **INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)** | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided string interpolated *handler*. |\n| [INSERT_INTO(String)][3]                                        | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder INSERT_INTO(\n\tref ClauseStringHandler<INSERT_INTO> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;INSERT_INTO>\nThe body of the INSERT INTO clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)][4].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: INSERT_INTO_1.md\n[4]: ../SqlBuilder/INSERT_INTO.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/INSERT_INTO_1.md",
    "content": "SQL.INSERT_INTO(String) Method\n==============================\nCreates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                                                                                 |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| [INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided string interpolated *handler*. |\n| **INSERT_INTO(String)**                                          | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder INSERT_INTO(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][4]\nThe body of the INSERT INTO clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [INSERT_INTO(String)][5].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: INSERT_INTO.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: ../SqlBuilder/INSERT_INTO_1.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/README.md",
    "content": "SQL Class\n=========\nProvides a set of static (Shared in Visual Basic) methods to create [SqlBuilder][1] instances.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][2]  \n  **DbExtensions.SQL**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static class SQL\n```\n\nThe **SQL** type exposes the following members.\n\n\nMethods\n-------\n\n| Name                                                             | Description                                                                                                                                 |\n| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| [DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)][4] | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided string interpolated *handler*. |\n| [DELETE_FROM(String)][5]                                         | Creates and returns a new [SqlBuilder][1] initialized by appending the DELETE FROM clause using the provided *text*.                        |\n| [INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)][6] | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided string interpolated *handler*. |\n| [INSERT_INTO(String)][7]                                         | Creates and returns a new [SqlBuilder][1] initialized by appending the INSERT INTO clause using the provided *text*.                        |\n| [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][8]           | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided string interpolated *handler*.      |\n| [SELECT(String)][9]                                              | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided *text*.                             |\n| [UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)][10]          | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided string interpolated *handler*.      |\n| [UPDATE(String)][11]                                             | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided *text*.                             |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][12]              | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*.        |\n| [WITH(String)][13]                                               | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.                               |\n| [WITH(String, SqlBuilder)][14]                                   | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.               |\n| [WITH(String, SqlSet)][15]                                       | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.               |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: ../SqlBuilder/README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: ../README.md\n[4]: DELETE_FROM.md\n[5]: DELETE_FROM_1.md\n[6]: INSERT_INTO.md\n[7]: INSERT_INTO_1.md\n[8]: SELECT.md\n[9]: SELECT_1.md\n[10]: UPDATE.md\n[11]: UPDATE_1.md\n[12]: WITH.md\n[13]: WITH_1.md\n[14]: WITH_2.md\n[15]: WITH_3.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/SELECT.md",
    "content": "SQL.SELECT(SqlBuilder.ClauseStringHandler&lt;SqlClause.SELECT>) Method\n======================================================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided string interpolated *handler*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                                                                            |\n| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |\n| **SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)** | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided string interpolated *handler*. |\n| [SELECT(String)][3]                                   | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder SELECT(\n\tref ClauseStringHandler<SELECT> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;SELECT>\nThe body of the SELECT clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][4].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: SELECT_1.md\n[4]: ../SqlBuilder/SELECT_1.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/SELECT_1.md",
    "content": "SQL.SELECT(String) Method\n=========================\nCreates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                            |\n| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |\n| [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided string interpolated *handler*. |\n| **SELECT(String)**                                     | Creates and returns a new [SqlBuilder][1] initialized by appending the SELECT clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder SELECT(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][4]\nThe body of the SELECT clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [SELECT(String)][5].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: SELECT.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: ../SqlBuilder/SELECT_2.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/UPDATE.md",
    "content": "SQL.UPDATE(SqlBuilder.ClauseStringHandler&lt;SqlClause.UPDATE>) Method\n======================================================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided string interpolated *handler*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                                                                            |\n| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |\n| **UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)** | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided string interpolated *handler*. |\n| [UPDATE(String)][3]                                   | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder UPDATE(\n\tref ClauseStringHandler<UPDATE> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;UPDATE>\nThe body of the UPDATE clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)][4].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: UPDATE_1.md\n[4]: ../SqlBuilder/UPDATE.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/UPDATE_1.md",
    "content": "SQL.UPDATE(String) Method\n=========================\nCreates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                            |\n| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |\n| [UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided string interpolated *handler*. |\n| **UPDATE(String)**                                     | Creates and returns a new [SqlBuilder][1] initialized by appending the UPDATE clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder UPDATE(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][4]\nThe body of the UPDATE clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [UPDATE(String)][5].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: UPDATE.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: ../SqlBuilder/UPDATE_1.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/WITH.md",
    "content": "SQL.WITH(SqlBuilder.ClauseStringHandler&lt;SqlClause.WITH>) Method\n==================================================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                              | Description                                                                                                                          |\n| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| **WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)** | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*. |\n| [WITH(String)][3]                                 | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.                        |\n| [WITH(String, SqlBuilder)][4]                     | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n| [WITH(String, SqlSet)][5]                         | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder WITH(\n\tref ClauseStringHandler<WITH> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;WITH>\nThe body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][6].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: WITH_1.md\n[4]: WITH_2.md\n[5]: WITH_3.md\n[6]: ../SqlBuilder/WITH.md\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/WITH_1.md",
    "content": "SQL.WITH(String) Method\n=======================\nCreates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                          |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*. |\n| **WITH(String)**                                   | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.                        |\n| [WITH(String, SqlBuilder)][4]                      | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n| [WITH(String, SqlSet)][5]                          | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder WITH(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][6]\nThe body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [WITH(String)][7].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: WITH.md\n[4]: WITH_2.md\n[5]: WITH_3.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: ../SqlBuilder/WITH_1.md\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/WITH_2.md",
    "content": "SQL.WITH(String, SqlBuilder) Method\n===================================\nCreates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                          |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*. |\n| [WITH(String)][4]                                  | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.                        |\n| **WITH(String, SqlBuilder)**                       | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n| [WITH(String, SqlSet)][5]                          | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder WITH(\n\tstring alias,\n\tSqlBuilder subQuery\n)\n```\n\n#### Parameters\n\n##### *alias*  [String][6]\nThe alias of the sub-query.\n\n##### *subQuery*  [SqlBuilder][1]\nThe sub-query to use as the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [WITH(String, SqlBuilder)][7].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: WITH.md\n[4]: WITH_1.md\n[5]: WITH_3.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: ../SqlBuilder/WITH_2.md\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SQL/WITH_3.md",
    "content": "SQL.WITH(String, SqlSet) Method\n===============================\nCreates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                          |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][3] | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided string interpolated *handler*. |\n| [WITH(String)][4]                                  | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *text*.                        |\n| [WITH(String, SqlBuilder)][5]                      | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n| **WITH(String, SqlSet)**                           | Creates and returns a new [SqlBuilder][1] initialized by appending the WITH clause using the provided *subQuery* and *alias*.        |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder WITH(\n\tstring alias,\n\tSqlSet subQuery\n)\n```\n\n#### Parameters\n\n##### *alias*  [String][6]\nThe alias of the sub-query.\n\n##### *subQuery*  [SqlSet][7]\nThe sub-query to use as the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][1]  \n A new [SqlBuilder][1] after calling [WITH(String, SqlSet)][8].\n\nSee Also\n--------\n\n#### Reference\n[SQL Class][9]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: WITH.md\n[4]: WITH_1.md\n[5]: WITH_2.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: ../SqlSet/README.md\n[8]: ../SqlBuilder/WITH_3.md\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/Append.md",
    "content": "SqlBuilder.Append(SqlBuilder.AppendStringHandler) Method\n========================================================\nAppends the interpolated string *handler* to this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                                 |\n| ------------------------------- | ----------------------------------------------------------- |\n| **Append(AppendStringHandler)** | Appends the interpolated string *handler* to this instance. |\n| [Append(String)][2]             | Appends *text* to this instance.                            |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder Append(\n\tref AppendStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *handler*  AppendStringHandler\nThe interpolated string.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Append_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendClause.md",
    "content": "SqlBuilder.AppendClause(SqlClause) Method\n=========================================\nAppends the SQL *clause*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                   |\n| ------------------------------- | --------------------------------------------- |\n| **AppendClause(SqlClause)**     | Appends the SQL *clause*.                     |\n| [AppendClause&lt;TClause>()][2] | Appends the SQL clause identified by TClause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendClause(\n\tSqlClause clause\n)\n```\n\n#### Parameters\n\n##### *clause*  [SqlClause][3]\nThe clause to append.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AppendClause__1.md\n[3]: ../SqlClause/README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendClause__1.md",
    "content": "SqlBuilder.AppendClause&lt;TClause> Method\n==========================================\nAppends the SQL clause identified by TClause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                           | Description                                   |\n| ------------------------------ | --------------------------------------------- |\n| [AppendClause(SqlClause)][2]   | Appends the SQL *clause*.                     |\n| **AppendClause&lt;TClause>()** | Appends the SQL clause identified by TClause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendClause<TClause>()\nwhere TClause : new(), SqlClause\n\n```\n\n#### Type Parameters\n\n##### *TClause*\nThe type of the SQL clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AppendClause.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendElse.md",
    "content": "SqlBuilder.AppendElse Method\n============================\nAppends the interpolated string *handler* if an antecedent call to [AppendIf(Boolean, AppendStringHandler)][1] or [AppendElseIf(Boolean, AppendElseStringHandler)][2] used a `false` condition\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendElse(\n\tref AppendElseStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *handler*  AppendElseStringHandler\nThe interpolated string to append.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][3]  \n\n[1]: AppendIf.md\n[2]: AppendElseIf.md\n[3]: ../README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendElseIf.md",
    "content": "SqlBuilder.AppendElseIf Method\n==============================\nAppends the interpolated string *handler* if *condition* is `true` and an antecedent call to [AppendIf(Boolean, AppendStringHandler)][1] or **AppendElseIf(Boolean, AppendElseStringHandler)** used a `false` condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendElseIf(\n\tbool condition,\n\tref AppendElseStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *condition*  [Boolean][3]\n`true` to append *handler*; otherwise, `false`.\n\n##### *handler*  AppendElseStringHandler\nThe interpolated string to append.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][2]  \n\n[1]: AppendIf.md\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendIf.md",
    "content": "SqlBuilder.AppendIf Method\n==========================\nAppends the interpolated string *handler* if *condition* is `true`.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendIf(\n\tbool condition,\n\tref AppendStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *condition*  [Boolean][2]\n`true` to append *handler*; otherwise, `false`.\n\n##### *handler*  AppendStringHandler\nThe interpolated string to append.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendLine.md",
    "content": "SqlBuilder.AppendLine Method\n============================\nAppends the default line terminator to this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendLine()\n```\n\n#### Return Value\n[SqlBuilder][2]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/AppendSql.md",
    "content": "SqlBuilder.AppendSql Method\n===========================\nAppends *sql* to this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder AppendSql(\n\tSqlBuilder sql\n)\n```\n\n#### Parameters\n\n##### *sql*  [SqlBuilder][2]\nA [SqlBuilder][2].\n\n#### Return Value\n[SqlBuilder][2]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/Append_1.md",
    "content": "SqlBuilder.Append(String) Method\n================================\nAppends *text* to this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                                                 |\n| -------------------------------- | ----------------------------------------------------------- |\n| [Append(AppendStringHandler)][2] | Appends the interpolated string *handler* to this instance. |\n| **Append(String)**               | Appends *text* to this instance.                            |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder Append(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe string.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Append.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/Buffer.md",
    "content": "SqlBuilder.Buffer Property\n==========================\nThe underlying [StringBuilder][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic StringBuilder Buffer { get; }\n```\n\n#### Property Value\n[StringBuilder][1]\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.text.stringbuilder\n[2]: ../README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/CROSS_JOIN.md",
    "content": "SqlBuilder.CROSS_JOIN Method\n============================\nSets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **CROSS_JOIN()**                                               | Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [CROSS_JOIN(SqlBuilder.ClauseStringHandler&lt;CROSS_JOIN>)][3] | Appends the CROSS JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [CROSS_JOIN(String)][4]                                        | Appends the CROSS JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder CROSS_JOIN()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: CROSS_JOIN_1.md\n[4]: CROSS_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/CROSS_JOIN_1.md",
    "content": "SqlBuilder.CROSS_JOIN(SqlBuilder.ClauseStringHandler&lt;SqlClause.CROSS_JOIN>) Method\n=====================================================================================\nAppends the CROSS JOIN clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                                                                                             |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [CROSS_JOIN()][2]                                             | Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **CROSS_JOIN(SqlBuilder.ClauseStringHandler&lt;CROSS_JOIN>)** | Appends the CROSS JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [CROSS_JOIN(String)][4]                                       | Appends the CROSS JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder CROSS_JOIN(\n\tref ClauseStringHandler<CROSS_JOIN> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;CROSS_JOIN>\nThe interpolated string that represents the body of the CROSS JOIN clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: CROSS_JOIN.md\n[3]: _If.md\n[4]: CROSS_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/CROSS_JOIN_2.md",
    "content": "SqlBuilder.CROSS_JOIN(String) Method\n====================================\nAppends the CROSS JOIN clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [CROSS_JOIN()][2]                                              | Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [CROSS_JOIN(SqlBuilder.ClauseStringHandler&lt;CROSS_JOIN>)][4] | Appends the CROSS JOIN clause using the provided interpolated string *handler*.                                                                         |\n| **CROSS_JOIN(String)**                                         | Appends the CROSS JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder CROSS_JOIN(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the CROSS JOIN clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: CROSS_JOIN.md\n[3]: _If.md\n[4]: CROSS_JOIN_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/Clone.md",
    "content": "SqlBuilder.Clone Method\n=======================\nCreates and returns a copy of this instance.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder Clone()\n```\n\n#### Return Value\n[SqlBuilder][2]  \nA new [SqlBuilder][2] that is equivalent to this instance.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/CurrentClause.md",
    "content": "SqlBuilder.CurrentClause Property\n=================================\nGets or sets the current SQL clause, used to identify consecutive appends to the same clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlClause? CurrentClause { get; set; }\n```\n\n#### Property Value\n[SqlClause][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlClause/README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/DELETE_FROM.md",
    "content": "SqlBuilder.DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;SqlClause.DELETE_FROM>) Method\n=======================================================================================\nAppends the DELETE FROM clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                      |\n| --------------------------------------------------------------- | -------------------------------------------------------------------------------- |\n| **DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)** | Appends the DELETE FROM clause using the provided interpolated string *handler*. |\n| [DELETE_FROM(String)][2]                                        | Appends the DELETE FROM clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder DELETE_FROM(\n\tref ClauseStringHandler<DELETE_FROM> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;DELETE_FROM>\nThe interpolated string that represents the body of the DELETE FROM clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: DELETE_FROM_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/DELETE_FROM_1.md",
    "content": "SqlBuilder.DELETE_FROM(String) Method\n=====================================\nAppends the DELETE FROM clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                      |\n| ---------------------------------------------------------------- | -------------------------------------------------------------------------------- |\n| [DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)][2] | Appends the DELETE FROM clause using the provided interpolated string *handler*. |\n| **DELETE_FROM(String)**                                          | Appends the DELETE FROM clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder DELETE_FROM(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe text that represents the body of the DELETE FROM clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: DELETE_FROM.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/FROM.md",
    "content": "SqlBuilder.FROM Method\n======================\nSets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **FROM()**                                         | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)][3] | Appends the FROM clause using the provided interpolated string *handler*.                                                                         |\n| [FROM(String)][4]                                  | Appends the FROM clause using the provided *text*.                                                                                                |\n| [FROM(SqlBuilder, String)][5]                      | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n| [FROM(SqlSet, String)][6]                          | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder FROM()\n```\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: FROM_2.md\n[4]: FROM_4.md\n[5]: FROM_1.md\n[6]: FROM_3.md\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/FROM_1.md",
    "content": "SqlBuilder.FROM(SqlBuilder, String) Method\n==========================================\nAppends the FROM clause using the provided *subQuery* as body named after *alias*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [FROM()][2]                                        | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)][4] | Appends the FROM clause using the provided interpolated string *handler*.                                                                         |\n| [FROM(String)][5]                                  | Appends the FROM clause using the provided *text*.                                                                                                |\n| **FROM(SqlBuilder, String)**                       | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n| [FROM(SqlSet, String)][6]                          | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder FROM(\n\tSqlBuilder subQuery,\n\tstring alias\n)\n```\n\n#### Parameters\n\n##### *subQuery*  [SqlBuilder][7]\nThe sub-query to use as the body of the FROM clause.\n\n##### *alias*  [String][8]\nThe alias of the sub-query.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FROM.md\n[3]: _If.md\n[4]: FROM_2.md\n[5]: FROM_4.md\n[6]: FROM_3.md\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.string"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/FROM_2.md",
    "content": "SqlBuilder.FROM(SqlBuilder.ClauseStringHandler&lt;SqlClause.FROM>) Method\n=========================================================================\nAppends the FROM clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                              | Description                                                                                                                                       |\n| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [FROM()][2]                                       | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)** | Appends the FROM clause using the provided interpolated string *handler*.                                                                         |\n| [FROM(String)][4]                                 | Appends the FROM clause using the provided *text*.                                                                                                |\n| [FROM(SqlBuilder, String)][5]                     | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n| [FROM(SqlSet, String)][6]                         | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder FROM(\n\tref ClauseStringHandler<FROM> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;FROM>\nThe interpolated string that represents the body of the FROM clause.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FROM.md\n[3]: _If.md\n[4]: FROM_4.md\n[5]: FROM_1.md\n[6]: FROM_3.md\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/FROM_3.md",
    "content": "SqlBuilder.FROM(SqlSet, String) Method\n======================================\nAppends the FROM clause using the provided *subQuery* as body named after *alias*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [FROM()][2]                                        | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)][4] | Appends the FROM clause using the provided interpolated string *handler*.                                                                         |\n| [FROM(String)][5]                                  | Appends the FROM clause using the provided *text*.                                                                                                |\n| [FROM(SqlBuilder, String)][6]                      | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n| **FROM(SqlSet, String)**                           | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder FROM(\n\tSqlSet subQuery,\n\tstring alias\n)\n```\n\n#### Parameters\n\n##### *subQuery*  [SqlSet][7]\nThe sub-query to use as the body of the FROM clause.\n\n##### *alias*  [String][8]\nThe alias of the sub-query.\n\n#### Return Value\n[SqlBuilder][9]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FROM.md\n[3]: _If.md\n[4]: FROM_2.md\n[5]: FROM_4.md\n[6]: FROM_1.md\n[7]: ../SqlSet/README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.string\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/FROM_4.md",
    "content": "SqlBuilder.FROM(String) Method\n==============================\nAppends the FROM clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [FROM()][2]                                        | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)][4] | Appends the FROM clause using the provided interpolated string *handler*.                                                                         |\n| **FROM(String)**                                   | Appends the FROM clause using the provided *text*.                                                                                                |\n| [FROM(SqlBuilder, String)][5]                      | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n| [FROM(SqlSet, String)][6]                          | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder FROM(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][7]\nThe text that represents the body of the FROM clause.\n\n#### Return Value\n[SqlBuilder][8]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FROM.md\n[3]: _If.md\n[4]: FROM_2.md\n[5]: FROM_1.md\n[6]: FROM_3.md\n[7]: https://learn.microsoft.com/dotnet/api/system.string\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/GROUP_BY.md",
    "content": "SqlBuilder.GROUP_BY Method\n==========================\nSets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                                           |\n| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **GROUP_BY()**                                             | Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [GROUP_BY(SqlBuilder.ClauseStringHandler&lt;GROUP_BY>)][3] | Appends the GROUP BY clause using the provided interpolated string *handler*.                                                                         |\n| [GROUP_BY(String)][4]                                      | Appends the GROUP BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder GROUP_BY()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: GROUP_BY_1.md\n[4]: GROUP_BY_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/GROUP_BY_1.md",
    "content": "SqlBuilder.GROUP_BY(SqlBuilder.ClauseStringHandler&lt;SqlClause.GROUP_BY>) Method\n=================================================================================\nAppends the GROUP BY clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                                                                                           |\n| --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [GROUP_BY()][2]                                           | Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **GROUP_BY(SqlBuilder.ClauseStringHandler&lt;GROUP_BY>)** | Appends the GROUP BY clause using the provided interpolated string *handler*.                                                                         |\n| [GROUP_BY(String)][4]                                     | Appends the GROUP BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder GROUP_BY(\n\tref ClauseStringHandler<GROUP_BY> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;GROUP_BY>\nThe interpolated string that represents the body of the GROUP BY clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: GROUP_BY.md\n[3]: _If.md\n[4]: GROUP_BY_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/GROUP_BY_2.md",
    "content": "SqlBuilder.GROUP_BY(String) Method\n==================================\nAppends the GROUP BY clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                                           |\n| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [GROUP_BY()][2]                                            | Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [GROUP_BY(SqlBuilder.ClauseStringHandler&lt;GROUP_BY>)][4] | Appends the GROUP BY clause using the provided interpolated string *handler*.                                                                         |\n| **GROUP_BY(String)**                                       | Appends the GROUP BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder GROUP_BY(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the GROUP BY clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: GROUP_BY.md\n[3]: _If.md\n[4]: GROUP_BY_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/HAVING.md",
    "content": "SqlBuilder.HAVING Method\n========================\nSets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **HAVING()**                                           | Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [HAVING(SqlBuilder.ClauseStringHandler&lt;HAVING>)][3] | Appends the HAVING clause using the provided interpolated string *handler*.                                                                         |\n| [HAVING(String)][4]                                    | Appends the HAVING clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder HAVING()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: HAVING_1.md\n[4]: HAVING_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/HAVING_1.md",
    "content": "SqlBuilder.HAVING(SqlBuilder.ClauseStringHandler&lt;SqlClause.HAVING>) Method\n=============================================================================\nAppends the HAVING clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                                                                                         |\n| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [HAVING()][2]                                         | Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **HAVING(SqlBuilder.ClauseStringHandler&lt;HAVING>)** | Appends the HAVING clause using the provided interpolated string *handler*.                                                                         |\n| [HAVING(String)][4]                                   | Appends the HAVING clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder HAVING(\n\tref ClauseStringHandler<HAVING> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;HAVING>\nThe interpolated string that represents the body of the HAVING clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: HAVING.md\n[3]: _If.md\n[4]: HAVING_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/HAVING_2.md",
    "content": "SqlBuilder.HAVING(String) Method\n================================\nAppends the HAVING clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [HAVING()][2]                                          | Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [HAVING(SqlBuilder.ClauseStringHandler&lt;HAVING>)][4] | Appends the HAVING clause using the provided interpolated string *handler*.                                                                         |\n| **HAVING(String)**                                     | Appends the HAVING clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder HAVING(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the HAVING clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: HAVING.md\n[3]: _If.md\n[4]: HAVING_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/INNER_JOIN.md",
    "content": "SqlBuilder.INNER_JOIN Method\n============================\nSets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **INNER_JOIN()**                                               | Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [INNER_JOIN(SqlBuilder.ClauseStringHandler&lt;INNER_JOIN>)][3] | Appends the INNER JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [INNER_JOIN(String)][4]                                        | Appends the INNER JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder INNER_JOIN()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: INNER_JOIN_1.md\n[4]: INNER_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/INNER_JOIN_1.md",
    "content": "SqlBuilder.INNER_JOIN(SqlBuilder.ClauseStringHandler&lt;SqlClause.INNER_JOIN>) Method\n=====================================================================================\nAppends the INNER JOIN clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                                                                                             |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [INNER_JOIN()][2]                                             | Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **INNER_JOIN(SqlBuilder.ClauseStringHandler&lt;INNER_JOIN>)** | Appends the INNER JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [INNER_JOIN(String)][4]                                       | Appends the INNER JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder INNER_JOIN(\n\tref ClauseStringHandler<INNER_JOIN> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;INNER_JOIN>\nThe interpolated string that represents the body of the INNER JOIN clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: INNER_JOIN.md\n[3]: _If.md\n[4]: INNER_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/INNER_JOIN_2.md",
    "content": "SqlBuilder.INNER_JOIN(String) Method\n====================================\nAppends the INNER JOIN clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [INNER_JOIN()][2]                                              | Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [INNER_JOIN(SqlBuilder.ClauseStringHandler&lt;INNER_JOIN>)][4] | Appends the INNER JOIN clause using the provided interpolated string *handler*.                                                                         |\n| **INNER_JOIN(String)**                                         | Appends the INNER JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder INNER_JOIN(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the INNER JOIN clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: INNER_JOIN.md\n[3]: _If.md\n[4]: INNER_JOIN_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/INSERT_INTO.md",
    "content": "SqlBuilder.INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;SqlClause.INSERT_INTO>) Method\n=======================================================================================\nAppends the INSERT INTO clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                                                      |\n| --------------------------------------------------------------- | -------------------------------------------------------------------------------- |\n| **INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)** | Appends the INSERT INTO clause using the provided interpolated string *handler*. |\n| [INSERT_INTO(String)][2]                                        | Appends the INSERT INTO clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder INSERT_INTO(\n\tref ClauseStringHandler<INSERT_INTO> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;INSERT_INTO>\nThe interpolated string that represents the body of the INSERT INTO clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: INSERT_INTO_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/INSERT_INTO_1.md",
    "content": "SqlBuilder.INSERT_INTO(String) Method\n=====================================\nAppends the INSERT INTO clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                                                      |\n| ---------------------------------------------------------------- | -------------------------------------------------------------------------------- |\n| [INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)][2] | Appends the INSERT INTO clause using the provided interpolated string *handler*. |\n| **INSERT_INTO(String)**                                          | Appends the INSERT INTO clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder INSERT_INTO(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe text that represents the body of the INSERT INTO clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: INSERT_INTO.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/InsertText.md",
    "content": "SqlBuilder.InsertText Method\n============================\nInserts a string into this instance at the specified character position.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder InsertText(\n\tint index,\n\tstring? value\n)\n```\n\n#### Parameters\n\n##### *index*  [Int32][2]\nThe position in this instance where insertion begins.\n\n##### *value*  [String][3]\nThe string to insert.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the insert operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/IsEmpty.md",
    "content": "SqlBuilder.IsEmpty Property\n===========================\nReturns `true` if the buffer is empty.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool IsEmpty { get; }\n```\n\n#### Property Value\n[Boolean][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/JOIN.md",
    "content": "SqlBuilder.JOIN Method\n======================\nSets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **JOIN()**                                         | Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [JOIN(SqlBuilder.ClauseStringHandler&lt;JOIN>)][3] | Appends the JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [JOIN(String)][4]                                  | Appends the JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder JOIN()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: JOIN_1.md\n[4]: JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/JOIN_1.md",
    "content": "SqlBuilder.JOIN(SqlBuilder.ClauseStringHandler&lt;SqlClause.JOIN>) Method\n=========================================================================\nAppends the JOIN clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                              | Description                                                                                                                                       |\n| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [JOIN()][2]                                       | Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **JOIN(SqlBuilder.ClauseStringHandler&lt;JOIN>)** | Appends the JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [JOIN(String)][4]                                 | Appends the JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder JOIN(\n\tref ClauseStringHandler<JOIN> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;JOIN>\nThe interpolated string that represents the body of the JOIN clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: JOIN.md\n[3]: _If.md\n[4]: JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/JOIN_2.md",
    "content": "SqlBuilder.JOIN(String) Method\n==============================\nAppends the JOIN clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                                                                                       |\n| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [JOIN()][2]                                        | Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [JOIN(SqlBuilder.ClauseStringHandler&lt;JOIN>)][4] | Appends the JOIN clause using the provided interpolated string *handler*.                                                                         |\n| **JOIN(String)**                                   | Appends the JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder JOIN(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the JOIN clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: JOIN.md\n[3]: _If.md\n[4]: JOIN_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/JoinSql.md",
    "content": "SqlBuilder.JoinSql(String, SqlBuilder[]) Method\n===============================================\nConcatenates a specified separator [String][1] between each element of a specified [SqlBuilder][2] array, yielding a single concatenated [SqlBuilder][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                             | Description                                                                                                                                               |\n| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **JoinSql(String, SqlBuilder[])**                | Concatenates a specified separator [String][1] between each element of a specified [SqlBuilder][2] array, yielding a single concatenated [SqlBuilder][2]. |\n| [JoinSql(String, IEnumerable&lt;SqlBuilder>)][4] | Concatenates the members of a constructed [IEnumerable&lt;T>][5] collection of type [SqlBuilder][2], using the specified *separator* between each member. |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder JoinSql(\n\tstring? separator,\n\tparams SqlBuilder?[] values\n)\n```\n\n#### Parameters\n\n##### *separator*  [String][1]\nThe string to use as a separator.\n\n##### *values*  [SqlBuilder][2][]\nAn array of [SqlBuilder][2].\n\n#### Return Value\n[SqlBuilder][2]  \n A [SqlBuilder][2] consisting of the elements of *values* interspersed with the *separator* string.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.string\n[2]: README.md\n[3]: ../README.md\n[4]: JoinSql_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/JoinSql_1.md",
    "content": "SqlBuilder.JoinSql(String, IEnumerable&lt;SqlBuilder>) Method\n=============================================================\nConcatenates the members of a constructed [IEnumerable&lt;T>][1] collection of type [SqlBuilder][2], using the specified *separator* between each member.\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                            | Description                                                                                                                                               |\n| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [JoinSql(String, SqlBuilder[])][4]              | Concatenates a specified separator [String][5] between each element of a specified [SqlBuilder][2] array, yielding a single concatenated [SqlBuilder][2]. |\n| **JoinSql(String, IEnumerable&lt;SqlBuilder>)** | Concatenates the members of a constructed [IEnumerable&lt;T>][1] collection of type [SqlBuilder][2], using the specified *separator* between each member. |\n\n\nSyntax\n------\n\n```csharp\npublic static SqlBuilder JoinSql(\n\tstring? separator,\n\tIEnumerable<SqlBuilder?> values\n)\n```\n\n#### Parameters\n\n##### *separator*  [String][5]\nThe string to use as a separator.\n\n##### *values*  [IEnumerable][1]&lt;[SqlBuilder][2]>\nA collection that contains the [SqlBuilder][2] objects to concatenate.\n\n#### Return Value\n[SqlBuilder][2]  \n A [SqlBuilder][2] that consists of the members of *values* delimited by the *separator* string. If *values* has no members, the method returns an empty [SqlBuilder][2].\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[2]: README.md\n[3]: ../README.md\n[4]: JoinSql.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LEFT_JOIN.md",
    "content": "SqlBuilder.LEFT_JOIN Method\n===========================\nSets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                         | Description                                                                                                                                            |\n| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **LEFT_JOIN()**                                              | Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [LEFT_JOIN(SqlBuilder.ClauseStringHandler&lt;LEFT_JOIN>)][3] | Appends the LEFT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [LEFT_JOIN(String)][4]                                       | Appends the LEFT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LEFT_JOIN()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: LEFT_JOIN_1.md\n[4]: LEFT_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LEFT_JOIN_1.md",
    "content": "SqlBuilder.LEFT_JOIN(SqlBuilder.ClauseStringHandler&lt;SqlClause.LEFT_JOIN>) Method\n===================================================================================\nAppends the LEFT JOIN clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                        | Description                                                                                                                                            |\n| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [LEFT_JOIN()][2]                                            | Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **LEFT_JOIN(SqlBuilder.ClauseStringHandler&lt;LEFT_JOIN>)** | Appends the LEFT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [LEFT_JOIN(String)][4]                                      | Appends the LEFT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LEFT_JOIN(\n\tref ClauseStringHandler<LEFT_JOIN> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;LEFT_JOIN>\nThe interpolated string that represents the body of the LEFT JOIN clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: LEFT_JOIN.md\n[3]: _If.md\n[4]: LEFT_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LEFT_JOIN_2.md",
    "content": "SqlBuilder.LEFT_JOIN(String) Method\n===================================\nAppends the LEFT JOIN clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                         | Description                                                                                                                                            |\n| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [LEFT_JOIN()][2]                                             | Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [LEFT_JOIN(SqlBuilder.ClauseStringHandler&lt;LEFT_JOIN>)][4] | Appends the LEFT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| **LEFT_JOIN(String)**                                        | Appends the LEFT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LEFT_JOIN(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the LEFT JOIN clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: LEFT_JOIN.md\n[3]: _If.md\n[4]: LEFT_JOIN_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LIMIT.md",
    "content": "SqlBuilder.LIMIT Method\n=======================\nSets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                                                                                                                        |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **LIMIT()**                                          | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [LIMIT(SqlBuilder.ClauseStringHandler&lt;LIMIT>)][3] | Appends the LIMIT clause using the provided interpolated string *handler*.                                                                         |\n| [LIMIT(Int32)][4]                                    | Appends the LIMIT clause using the provided *maxRecords* parameter.                                                                                |\n| [LIMIT(String)][5]                                   | Appends the LIMIT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LIMIT()\n```\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: LIMIT_1.md\n[4]: LIMIT_2.md\n[5]: LIMIT_3.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LIMIT_1.md",
    "content": "SqlBuilder.LIMIT(SqlBuilder.ClauseStringHandler&lt;SqlClause.LIMIT>) Method\n===========================================================================\nAppends the LIMIT clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                | Description                                                                                                                                        |\n| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [LIMIT()][2]                                        | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **LIMIT(SqlBuilder.ClauseStringHandler&lt;LIMIT>)** | Appends the LIMIT clause using the provided interpolated string *handler*.                                                                         |\n| [LIMIT(Int32)][4]                                   | Appends the LIMIT clause using the provided *maxRecords* parameter.                                                                                |\n| [LIMIT(String)][5]                                  | Appends the LIMIT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LIMIT(\n\tref ClauseStringHandler<LIMIT> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;LIMIT>\nThe interpolated string that represents the body of the LIMIT clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: LIMIT.md\n[3]: _If.md\n[4]: LIMIT_2.md\n[5]: LIMIT_3.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LIMIT_2.md",
    "content": "SqlBuilder.LIMIT(Int32) Method\n==============================\nAppends the LIMIT clause using the provided *maxRecords* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                                                                                                                        |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [LIMIT()][2]                                         | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [LIMIT(SqlBuilder.ClauseStringHandler&lt;LIMIT>)][4] | Appends the LIMIT clause using the provided interpolated string *handler*.                                                                         |\n| **LIMIT(Int32)**                                     | Appends the LIMIT clause using the provided *maxRecords* parameter.                                                                                |\n| [LIMIT(String)][5]                                   | Appends the LIMIT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LIMIT(\n\tint maxRecords\n)\n```\n\n#### Parameters\n\n##### *maxRecords*  [Int32][6]\nThe value to use as parameter.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: LIMIT.md\n[3]: _If.md\n[4]: LIMIT_1.md\n[5]: LIMIT_3.md\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/LIMIT_3.md",
    "content": "SqlBuilder.LIMIT(String) Method\n===============================\nAppends the LIMIT clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                                                                                                                        |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [LIMIT()][2]                                         | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [LIMIT(SqlBuilder.ClauseStringHandler&lt;LIMIT>)][4] | Appends the LIMIT clause using the provided interpolated string *handler*.                                                                         |\n| [LIMIT(Int32)][5]                                    | Appends the LIMIT clause using the provided *maxRecords* parameter.                                                                                |\n| **LIMIT(String)**                                    | Appends the LIMIT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder LIMIT(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][6]\nThe text that represents the body of the LIMIT clause.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: LIMIT.md\n[3]: _If.md\n[4]: LIMIT_1.md\n[5]: LIMIT_2.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/NextClause.md",
    "content": "SqlBuilder.NextClause Property\n==============================\nGets or sets the next SQL clause. Used by clause continuation methods, such as [_(String)][1] and [_If(Boolean, ConditionalStringHandler)][2].\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlClause? NextClause { get; set; }\n```\n\n#### Property Value\n[SqlClause][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][3]  \n\n[1]: __1.md\n[2]: _If.md\n[3]: ../README.md\n[4]: ../SqlClause/README.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/OFFSET.md",
    "content": "SqlBuilder.OFFSET Method\n========================\nSets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **OFFSET()**                                           | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [OFFSET(SqlBuilder.ClauseStringHandler&lt;OFFSET>)][3] | Appends the OFFSET clause using the provided interpolated string *handler*.                                                                         |\n| [OFFSET(Int32)][4]                                     | Appends the OFFSET clause using the provided *startIndex* parameter.                                                                                |\n| [OFFSET(String)][5]                                    | Appends the OFFSET clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder OFFSET()\n```\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: OFFSET_1.md\n[4]: OFFSET_2.md\n[5]: OFFSET_3.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/OFFSET_1.md",
    "content": "SqlBuilder.OFFSET(SqlBuilder.ClauseStringHandler&lt;SqlClause.OFFSET>) Method\n=============================================================================\nAppends the OFFSET clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                                                                                         |\n| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [OFFSET()][2]                                         | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **OFFSET(SqlBuilder.ClauseStringHandler&lt;OFFSET>)** | Appends the OFFSET clause using the provided interpolated string *handler*.                                                                         |\n| [OFFSET(Int32)][4]                                    | Appends the OFFSET clause using the provided *startIndex* parameter.                                                                                |\n| [OFFSET(String)][5]                                   | Appends the OFFSET clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder OFFSET(\n\tref ClauseStringHandler<OFFSET> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;OFFSET>\nThe interpolated string that represents the body of the OFFSET clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OFFSET.md\n[3]: _If.md\n[4]: OFFSET_2.md\n[5]: OFFSET_3.md\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/OFFSET_2.md",
    "content": "SqlBuilder.OFFSET(Int32) Method\n===============================\nAppends the OFFSET clause using the provided *startIndex* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [OFFSET()][2]                                          | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [OFFSET(SqlBuilder.ClauseStringHandler&lt;OFFSET>)][4] | Appends the OFFSET clause using the provided interpolated string *handler*.                                                                         |\n| **OFFSET(Int32)**                                      | Appends the OFFSET clause using the provided *startIndex* parameter.                                                                                |\n| [OFFSET(String)][5]                                    | Appends the OFFSET clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder OFFSET(\n\tint startIndex\n)\n```\n\n#### Parameters\n\n##### *startIndex*  [Int32][6]\nThe value to use as parameter.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OFFSET.md\n[3]: _If.md\n[4]: OFFSET_1.md\n[5]: OFFSET_3.md\n[6]: https://learn.microsoft.com/dotnet/api/system.int32\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/OFFSET_3.md",
    "content": "SqlBuilder.OFFSET(String) Method\n================================\nAppends the OFFSET clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [OFFSET()][2]                                          | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [OFFSET(SqlBuilder.ClauseStringHandler&lt;OFFSET>)][4] | Appends the OFFSET clause using the provided interpolated string *handler*.                                                                         |\n| [OFFSET(Int32)][5]                                     | Appends the OFFSET clause using the provided *startIndex* parameter.                                                                                |\n| **OFFSET(String)**                                     | Appends the OFFSET clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder OFFSET(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][6]\nThe text that represents the body of the OFFSET clause.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OFFSET.md\n[3]: _If.md\n[4]: OFFSET_1.md\n[5]: OFFSET_2.md\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/ORDER_BY.md",
    "content": "SqlBuilder.ORDER_BY Method\n==========================\nSets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                                           |\n| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **ORDER_BY()**                                             | Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [ORDER_BY(SqlBuilder.ClauseStringHandler&lt;ORDER_BY>)][3] | Appends the ORDER BY clause using the provided interpolated string *handler*.                                                                         |\n| [ORDER_BY(String)][4]                                      | Appends the ORDER BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder ORDER_BY()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: ORDER_BY_1.md\n[4]: ORDER_BY_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/ORDER_BY_1.md",
    "content": "SqlBuilder.ORDER_BY(SqlBuilder.ClauseStringHandler&lt;SqlClause.ORDER_BY>) Method\n=================================================================================\nAppends the ORDER BY clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                                                                                           |\n| --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [ORDER_BY()][2]                                           | Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **ORDER_BY(SqlBuilder.ClauseStringHandler&lt;ORDER_BY>)** | Appends the ORDER BY clause using the provided interpolated string *handler*.                                                                         |\n| [ORDER_BY(String)][4]                                     | Appends the ORDER BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder ORDER_BY(\n\tref ClauseStringHandler<ORDER_BY> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;ORDER_BY>\nThe interpolated string that represents the body of the ORDER BY clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ORDER_BY.md\n[3]: _If.md\n[4]: ORDER_BY_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/ORDER_BY_2.md",
    "content": "SqlBuilder.ORDER_BY(String) Method\n==================================\nAppends the ORDER BY clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                                           |\n| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [ORDER_BY()][2]                                            | Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [ORDER_BY(SqlBuilder.ClauseStringHandler&lt;ORDER_BY>)][4] | Appends the ORDER BY clause using the provided interpolated string *handler*.                                                                         |\n| **ORDER_BY(String)**                                       | Appends the ORDER BY clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder ORDER_BY(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the ORDER BY clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ORDER_BY.md\n[3]: _If.md\n[4]: ORDER_BY_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/ParameterValues.md",
    "content": "SqlBuilder.ParameterValues Property\n===================================\nThe parameter objects to be included in the database command.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Collection<Object?> ParameterValues { get; }\n```\n\n#### Property Value\n[Collection][2]&lt;[Object][3]>\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/README.md",
    "content": "SqlBuilder Class\n================\nRepresents a mutable SQL string.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  **DbExtensions.SqlBuilder**  \n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class SqlBuilder\n```\n\nThe **SqlBuilder** type exposes the following members.\n\n\nProperties\n----------\n\n| Name                  | Description                                                                                                                                    |\n| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Buffer][3]           | The underlying [StringBuilder][4].                                                                                                             |\n| [CurrentClause][5]    | Gets or sets the current SQL clause, used to identify consecutive appends to the same clause.                                                  |\n| [IsEmpty][6]          | Returns `true` if the buffer is empty.                                                                                                         |\n| [NextClause][7]       | Gets or sets the next SQL clause. Used by clause continuation methods, such as [_(String)][8] and [_If(Boolean, ConditionalStringHandler)][9]. |\n| [ParameterValues][10] | The parameter objects to be included in the database command.                                                                                  |\n\n\nMethods\n-------\n\n| Name                                                              | Description                                                                                                                                                                                                                 |\n| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [_(SqlBuilder.ClauseStringHandler&lt;Current>)][11]               | Appends the interpolated string *handler* to the current clause.                                                                                                                                                            |\n| [_(String)][8]                                                    | Appends the *text* to the current clause.                                                                                                                                                                                   |\n| [_Else][12]                                                       | Appends *handler* to the current clause if an antecedent call to [_If(Boolean, ConditionalStringHandler)][9] or [_ElseIf(Boolean, ConditionalElseStringHandler)][13] used a `false` condition                               |\n| [_ElseIf][13]                                                     | Appends *handler* to the current clause if *condition* is `true` and an antecedent call to [_If(Boolean, ConditionalStringHandler)][9] or [_ElseIf(Boolean, ConditionalElseStringHandler)][13] used a `false` condition.    |\n| [_If][9]                                                          | Appends the interpolated string *handler* to the current clause if *condition* is `true`.                                                                                                                                   |\n| [Append(AppendStringHandler)][14]                                 | Appends the interpolated string *handler* to this instance.                                                                                                                                                                 |\n| [Append(String)][15]                                              | Appends *text* to this instance.                                                                                                                                                                                            |\n| [AppendClause(SqlClause)][16]                                     | Appends the SQL *clause*.                                                                                                                                                                                                   |\n| [AppendClause&lt;TClause>()][17]                                  | Appends the SQL clause identified by TClause.                                                                                                                                                                               |\n| [AppendElse][18]                                                  | Appends the interpolated string *handler* if an antecedent call to [AppendIf(Boolean, AppendStringHandler)][19] or [AppendElseIf(Boolean, AppendElseStringHandler)][20] used a `false` condition                            |\n| [AppendElseIf][20]                                                | Appends the interpolated string *handler* if *condition* is `true` and an antecedent call to [AppendIf(Boolean, AppendStringHandler)][19] or [AppendElseIf(Boolean, AppendElseStringHandler)][20] used a `false` condition. |\n| [AppendIf][19]                                                    | Appends the interpolated string *handler* if *condition* is `true`.                                                                                                                                                         |\n| [AppendLine][21]                                                  | Appends the default line terminator to this instance.                                                                                                                                                                       |\n| [AppendSql][22]                                                   | Appends *sql* to this instance.                                                                                                                                                                                             |\n| [Clone][23]                                                       | Creates and returns a copy of this instance.                                                                                                                                                                                |\n| [CROSS_JOIN()][24]                                                | Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                     |\n| [CROSS_JOIN(SqlBuilder.ClauseStringHandler&lt;CROSS_JOIN>)][25]   | Appends the CROSS JOIN clause using the provided interpolated string *handler*.                                                                                                                                             |\n| [CROSS_JOIN(String)][26]                                          | Appends the CROSS JOIN clause using the provided *text*.                                                                                                                                                                    |\n| [DELETE_FROM(SqlBuilder.ClauseStringHandler&lt;DELETE_FROM>)][27] | Appends the DELETE FROM clause using the provided interpolated string *handler*.                                                                                                                                            |\n| [DELETE_FROM(String)][28]                                         | Appends the DELETE FROM clause using the provided *text*.                                                                                                                                                                   |\n| [FROM()][29]                                                      | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                           |\n| [FROM(SqlBuilder.ClauseStringHandler&lt;FROM>)][30]               | Appends the FROM clause using the provided interpolated string *handler*.                                                                                                                                                   |\n| [FROM(String)][31]                                                | Appends the FROM clause using the provided *text*.                                                                                                                                                                          |\n| [FROM(SqlBuilder, String)][32]                                    | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                                                                                          |\n| [FROM(SqlSet, String)][33]                                        | Appends the FROM clause using the provided *subQuery* as body named after *alias*.                                                                                                                                          |\n| [GROUP_BY()][34]                                                  | Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                       |\n| [GROUP_BY(SqlBuilder.ClauseStringHandler&lt;GROUP_BY>)][35]       | Appends the GROUP BY clause using the provided interpolated string *handler*.                                                                                                                                               |\n| [GROUP_BY(String)][36]                                            | Appends the GROUP BY clause using the provided *text*.                                                                                                                                                                      |\n| [HAVING()][37]                                                    | Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                         |\n| [HAVING(SqlBuilder.ClauseStringHandler&lt;HAVING>)][38]           | Appends the HAVING clause using the provided interpolated string *handler*.                                                                                                                                                 |\n| [HAVING(String)][39]                                              | Appends the HAVING clause using the provided *text*.                                                                                                                                                                        |\n| [INNER_JOIN()][40]                                                | Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                     |\n| [INNER_JOIN(SqlBuilder.ClauseStringHandler&lt;INNER_JOIN>)][41]   | Appends the INNER JOIN clause using the provided interpolated string *handler*.                                                                                                                                             |\n| [INNER_JOIN(String)][42]                                          | Appends the INNER JOIN clause using the provided *text*.                                                                                                                                                                    |\n| [INSERT_INTO(SqlBuilder.ClauseStringHandler&lt;INSERT_INTO>)][43] | Appends the INSERT INTO clause using the provided interpolated string *handler*.                                                                                                                                            |\n| [INSERT_INTO(String)][44]                                         | Appends the INSERT INTO clause using the provided *text*.                                                                                                                                                                   |\n| [InsertText][45]                                                  | Inserts a string into this instance at the specified character position.                                                                                                                                                    |\n| [JOIN()][46]                                                      | Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                           |\n| [JOIN(SqlBuilder.ClauseStringHandler&lt;JOIN>)][47]               | Appends the JOIN clause using the provided interpolated string *handler*.                                                                                                                                                   |\n| [JOIN(String)][48]                                                | Appends the JOIN clause using the provided *text*.                                                                                                                                                                          |\n| [JoinSql(String, SqlBuilder[])][49]                               | Concatenates a specified separator [String][50] between each element of a specified **SqlBuilder** array, yielding a single concatenated **SqlBuilder**.                                                                    |\n| [JoinSql(String, IEnumerable&lt;SqlBuilder>)][51]                 | Concatenates the members of a constructed [IEnumerable&lt;T>][52] collection of type **SqlBuilder**, using the specified *separator* between each member.                                                                   |\n| [LEFT_JOIN()][53]                                                 | Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                      |\n| [LEFT_JOIN(SqlBuilder.ClauseStringHandler&lt;LEFT_JOIN>)][54]     | Appends the LEFT JOIN clause using the provided interpolated string *handler*.                                                                                                                                              |\n| [LEFT_JOIN(String)][55]                                           | Appends the LEFT JOIN clause using the provided *text*.                                                                                                                                                                     |\n| [LIMIT()][56]                                                     | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                          |\n| [LIMIT(SqlBuilder.ClauseStringHandler&lt;LIMIT>)][57]             | Appends the LIMIT clause using the provided interpolated string *handler*.                                                                                                                                                  |\n| [LIMIT(Int32)][58]                                                | Appends the LIMIT clause using the provided *maxRecords* parameter.                                                                                                                                                         |\n| [LIMIT(String)][59]                                               | Appends the LIMIT clause using the provided *text*.                                                                                                                                                                         |\n| [OFFSET()][60]                                                    | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                         |\n| [OFFSET(SqlBuilder.ClauseStringHandler&lt;OFFSET>)][61]           | Appends the OFFSET clause using the provided interpolated string *handler*.                                                                                                                                                 |\n| [OFFSET(Int32)][62]                                               | Appends the OFFSET clause using the provided *startIndex* parameter.                                                                                                                                                        |\n| [OFFSET(String)][63]                                              | Appends the OFFSET clause using the provided *text*.                                                                                                                                                                        |\n| [ORDER_BY()][64]                                                  | Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                       |\n| [ORDER_BY(SqlBuilder.ClauseStringHandler&lt;ORDER_BY>)][65]       | Appends the ORDER BY clause using the provided interpolated string *handler*.                                                                                                                                               |\n| [ORDER_BY(String)][66]                                            | Appends the ORDER BY clause using the provided *text*.                                                                                                                                                                      |\n| [RIGHT_JOIN()][67]                                                | Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                     |\n| [RIGHT_JOIN(SqlBuilder.ClauseStringHandler&lt;RIGHT_JOIN>)][68]   | Appends the RIGHT JOIN clause using the provided interpolated string *handler*.                                                                                                                                             |\n| [RIGHT_JOIN(String)][69]                                          | Appends the RIGHT JOIN clause using the provided *text*.                                                                                                                                                                    |\n| [SELECT()][70]                                                    | Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                         |\n| [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][71]           | Appends the SELECT clause using the provided interpolated string *handler*.                                                                                                                                                 |\n| [SELECT(String)][72]                                              | Appends the SELECT clause using the provided *text*.                                                                                                                                                                        |\n| [SET(SqlBuilder.ClauseStringHandler&lt;SET>)][73]                 | Appends the SET clause using the provided interpolated string *handler*.                                                                                                                                                    |\n| [SET(String)][74]                                                 | Appends the SET clause using the provided *text*.                                                                                                                                                                           |\n| [SetCurrentClause(SqlClause)][75]                                 | Sets *clause* as the current SQL clause.                                                                                                                                                                                    |\n| [SetCurrentClause&lt;TClause>()][76]                              | Sets the clause identified by TClause as the current SQL clause.                                                                                                                                                            |\n| [SetNextClause(SqlClause)][77]                                    | Sets *clause* as the next SQL clause.                                                                                                                                                                                       |\n| [SetNextClause&lt;TClause>()][78]                                 | Sets the clause identified by TClause as the next SQL clause.                                                                                                                                                               |\n| [ToString][79]                                                    | Converts the value of this instance to a [String][50]. <br/>(Overrides [Object.ToString()][80])                                                                                                                             |\n| [UNION][81]                                                       | Appends the UNION clause.                                                                                                                                                                                                   |\n| [UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)][82]           | Appends the UPDATE clause using the provided interpolated string *handler*.                                                                                                                                                 |\n| [UPDATE(String)][83]                                              | Appends the UPDATE clause using the provided *text*.                                                                                                                                                                        |\n| [VALUES(SqlBuilder.ClauseStringHandler&lt;VALUES>)][84]           | Appends the VALUES clause using the provided interpolated string *handler*.                                                                                                                                                 |\n| [VALUES(Object[])][85]                                            | Appends the VALUES clause using the provided parameters.                                                                                                                                                                    |\n| [WHERE()][86]                                                     | Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][9].                                                                          |\n| [WHERE(SqlBuilder.ClauseStringHandler&lt;WHERE>)][87]             | Appends the WHERE clause using the provided interpolated string *handler*.                                                                                                                                                  |\n| [WHERE(String)][88]                                               | Appends the WHERE clause using the provided *text*.                                                                                                                                                                         |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][89]               | Appends the WITH clause using the provided interpolated string *handler*.                                                                                                                                                   |\n| [WITH(String)][90]                                                | Appends the WITH clause using the provided *text*.                                                                                                                                                                          |\n| [WITH(String, SqlBuilder)][91]                                    | Appends the WITH clause using the provided *subQuery* as body named after *alias*.                                                                                                                                          |\n| [WITH(String, SqlSet)][92]                                        | Appends the WITH clause using the provided *subQuery* as body named after *alias*.                                                                                                                                          |\n\n\nRemarks\n-------\nFor information on how to use SqlBuilder see [SqlBuilder Tutorial][93].\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: ../README.md\n[3]: Buffer.md\n[4]: https://learn.microsoft.com/dotnet/api/system.text.stringbuilder\n[5]: CurrentClause.md\n[6]: IsEmpty.md\n[7]: NextClause.md\n[8]: __1.md\n[9]: _If.md\n[10]: ParameterValues.md\n[11]: _.md\n[12]: _Else.md\n[13]: _ElseIf.md\n[14]: Append.md\n[15]: Append_1.md\n[16]: AppendClause.md\n[17]: AppendClause__1.md\n[18]: AppendElse.md\n[19]: AppendIf.md\n[20]: AppendElseIf.md\n[21]: AppendLine.md\n[22]: AppendSql.md\n[23]: Clone.md\n[24]: CROSS_JOIN.md\n[25]: CROSS_JOIN_1.md\n[26]: CROSS_JOIN_2.md\n[27]: DELETE_FROM.md\n[28]: DELETE_FROM_1.md\n[29]: FROM.md\n[30]: FROM_2.md\n[31]: FROM_4.md\n[32]: FROM_1.md\n[33]: FROM_3.md\n[34]: GROUP_BY.md\n[35]: GROUP_BY_1.md\n[36]: GROUP_BY_2.md\n[37]: HAVING.md\n[38]: HAVING_1.md\n[39]: HAVING_2.md\n[40]: INNER_JOIN.md\n[41]: INNER_JOIN_1.md\n[42]: INNER_JOIN_2.md\n[43]: INSERT_INTO.md\n[44]: INSERT_INTO_1.md\n[45]: InsertText.md\n[46]: JOIN.md\n[47]: JOIN_1.md\n[48]: JOIN_2.md\n[49]: JoinSql.md\n[50]: https://learn.microsoft.com/dotnet/api/system.string\n[51]: JoinSql_1.md\n[52]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[53]: LEFT_JOIN.md\n[54]: LEFT_JOIN_1.md\n[55]: LEFT_JOIN_2.md\n[56]: LIMIT.md\n[57]: LIMIT_1.md\n[58]: LIMIT_2.md\n[59]: LIMIT_3.md\n[60]: OFFSET.md\n[61]: OFFSET_1.md\n[62]: OFFSET_2.md\n[63]: OFFSET_3.md\n[64]: ORDER_BY.md\n[65]: ORDER_BY_1.md\n[66]: ORDER_BY_2.md\n[67]: RIGHT_JOIN.md\n[68]: RIGHT_JOIN_1.md\n[69]: RIGHT_JOIN_2.md\n[70]: SELECT.md\n[71]: SELECT_1.md\n[72]: SELECT_2.md\n[73]: SET.md\n[74]: SET_1.md\n[75]: SetCurrentClause.md\n[76]: SetCurrentClause__1.md\n[77]: SetNextClause.md\n[78]: SetNextClause__1.md\n[79]: ToString.md\n[80]: https://learn.microsoft.com/dotnet/api/system.object.tostring\n[81]: UNION.md\n[82]: UPDATE.md\n[83]: UPDATE_1.md\n[84]: VALUES.md\n[85]: VALUES_1.md\n[86]: WHERE.md\n[87]: WHERE_1.md\n[88]: WHERE_2.md\n[89]: WITH.md\n[90]: WITH_1.md\n[91]: WITH_2.md\n[92]: WITH_3.md\n[93]: https://maxtoroq.github.io/DbExtensions/docs/7/SqlBuilder.html"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/RIGHT_JOIN.md",
    "content": "SqlBuilder.RIGHT_JOIN Method\n============================\nSets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **RIGHT_JOIN()**                                               | Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [RIGHT_JOIN(SqlBuilder.ClauseStringHandler&lt;RIGHT_JOIN>)][3] | Appends the RIGHT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [RIGHT_JOIN(String)][4]                                        | Appends the RIGHT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder RIGHT_JOIN()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: RIGHT_JOIN_1.md\n[4]: RIGHT_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/RIGHT_JOIN_1.md",
    "content": "SqlBuilder.RIGHT_JOIN(SqlBuilder.ClauseStringHandler&lt;SqlClause.RIGHT_JOIN>) Method\n=====================================================================================\nAppends the RIGHT JOIN clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                                                                                             |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [RIGHT_JOIN()][2]                                             | Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **RIGHT_JOIN(SqlBuilder.ClauseStringHandler&lt;RIGHT_JOIN>)** | Appends the RIGHT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| [RIGHT_JOIN(String)][4]                                       | Appends the RIGHT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder RIGHT_JOIN(\n\tref ClauseStringHandler<RIGHT_JOIN> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;RIGHT_JOIN>\nThe interpolated string that represents the body of the RIGHT JOIN clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RIGHT_JOIN.md\n[3]: _If.md\n[4]: RIGHT_JOIN_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/RIGHT_JOIN_2.md",
    "content": "SqlBuilder.RIGHT_JOIN(String) Method\n====================================\nAppends the RIGHT JOIN clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                                                             |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [RIGHT_JOIN()][2]                                              | Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [RIGHT_JOIN(SqlBuilder.ClauseStringHandler&lt;RIGHT_JOIN>)][4] | Appends the RIGHT JOIN clause using the provided interpolated string *handler*.                                                                         |\n| **RIGHT_JOIN(String)**                                         | Appends the RIGHT JOIN clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder RIGHT_JOIN(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the RIGHT JOIN clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RIGHT_JOIN.md\n[3]: _If.md\n[4]: RIGHT_JOIN_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SELECT.md",
    "content": "SqlBuilder.SELECT Method\n========================\nSets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **SELECT()**                                           | Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][3] | Appends the SELECT clause using the provided interpolated string *handler*.                                                                         |\n| [SELECT(String)][4]                                    | Appends the SELECT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SELECT()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: SELECT_1.md\n[4]: SELECT_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SELECT_1.md",
    "content": "SqlBuilder.SELECT(SqlBuilder.ClauseStringHandler&lt;SqlClause.SELECT>) Method\n=============================================================================\nAppends the SELECT clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                                                                                         |\n| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SELECT()][2]                                         | Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)** | Appends the SELECT clause using the provided interpolated string *handler*.                                                                         |\n| [SELECT(String)][4]                                   | Appends the SELECT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SELECT(\n\tref ClauseStringHandler<SELECT> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;SELECT>\nThe interpolated string that represents the body of the SELECT clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SELECT.md\n[3]: _If.md\n[4]: SELECT_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SELECT_2.md",
    "content": "SqlBuilder.SELECT(String) Method\n================================\nAppends the SELECT clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                                                                                         |\n| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SELECT()][2]                                          | Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [SELECT(SqlBuilder.ClauseStringHandler&lt;SELECT>)][4] | Appends the SELECT clause using the provided interpolated string *handler*.                                                                         |\n| **SELECT(String)**                                     | Appends the SELECT clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SELECT(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the SELECT clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SELECT.md\n[3]: _If.md\n[4]: SELECT_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SET.md",
    "content": "SqlBuilder.SET(SqlBuilder.ClauseStringHandler&lt;SqlClause.SET>) Method\n=======================================================================\nAppends the SET clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                            | Description                                                              |\n| ----------------------------------------------- | ------------------------------------------------------------------------ |\n| **SET(SqlBuilder.ClauseStringHandler&lt;SET>)** | Appends the SET clause using the provided interpolated string *handler*. |\n| [SET(String)][2]                                | Appends the SET clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SET(\n\tref ClauseStringHandler<SET> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;SET>\nThe interpolated string that represents the body of the SET clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SET_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SET_1.md",
    "content": "SqlBuilder.SET(String) Method\n=============================\nAppends the SET clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                             | Description                                                              |\n| ------------------------------------------------ | ------------------------------------------------------------------------ |\n| [SET(SqlBuilder.ClauseStringHandler&lt;SET>)][2] | Appends the SET clause using the provided interpolated string *handler*. |\n| **SET(String)**                                  | Appends the SET clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SET(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe text that represents the body of the SET clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SET.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SetCurrentClause.md",
    "content": "SqlBuilder.SetCurrentClause(SqlClause) Method\n=============================================\nSets *clause* as the current SQL clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                | Description                                                      |\n| ----------------------------------- | ---------------------------------------------------------------- |\n| **SetCurrentClause(SqlClause)**     | Sets *clause* as the current SQL clause.                         |\n| [SetCurrentClause&lt;TClause>()][2] | Sets the clause identified by TClause as the current SQL clause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SetCurrentClause(\n\tSqlClause? clause\n)\n```\n\n#### Parameters\n\n##### *clause*  [SqlClause][3]\nThe SQL clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n[CurrentClause][5]  \n\n[1]: ../README.md\n[2]: SetCurrentClause__1.md\n[3]: ../SqlClause/README.md\n[4]: README.md\n[5]: CurrentClause.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SetCurrentClause__1.md",
    "content": "SqlBuilder.SetCurrentClause&lt;TClause> Method\n==============================================\nSets the clause identified by TClause as the current SQL clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                      |\n| ---------------------------------- | ---------------------------------------------------------------- |\n| [SetCurrentClause(SqlClause)][2]   | Sets *clause* as the current SQL clause.                         |\n| **SetCurrentClause&lt;TClause>()** | Sets the clause identified by TClause as the current SQL clause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SetCurrentClause<TClause>()\nwhere TClause : new(), SqlClause\n\n```\n\n#### Type Parameters\n\n##### *TClause*\nThe type of the SQL clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n[CurrentClause][4]  \n\n[1]: ../README.md\n[2]: SetCurrentClause.md\n[3]: README.md\n[4]: CurrentClause.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SetNextClause.md",
    "content": "SqlBuilder.SetNextClause(SqlClause) Method\n==========================================\nSets *clause* as the next SQL clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                                                   |\n| -------------------------------- | ------------------------------------------------------------- |\n| **SetNextClause(SqlClause)**     | Sets *clause* as the next SQL clause.                         |\n| [SetNextClause&lt;TClause>()][2] | Sets the clause identified by TClause as the next SQL clause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SetNextClause(\n\tSqlClause? clause\n)\n```\n\n#### Parameters\n\n##### *clause*  [SqlClause][3]\nThe SQL clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n[NextClause][5]  \n\n[1]: ../README.md\n[2]: SetNextClause__1.md\n[3]: ../SqlClause/README.md\n[4]: README.md\n[5]: NextClause.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/SetNextClause__1.md",
    "content": "SqlBuilder.SetNextClause&lt;TClause> Method\n===========================================\nSets the clause identified by TClause as the next SQL clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                                   |\n| ------------------------------- | ------------------------------------------------------------- |\n| [SetNextClause(SqlClause)][2]   | Sets *clause* as the next SQL clause.                         |\n| **SetNextClause&lt;TClause>()** | Sets the clause identified by TClause as the next SQL clause. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder SetNextClause<TClause>()\nwhere TClause : new(), SqlClause\n\n```\n\n#### Type Parameters\n\n##### *TClause*\nThe type of the SQL clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n[NextClause][4]  \n\n[1]: ../README.md\n[2]: SetNextClause.md\n[3]: README.md\n[4]: NextClause.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/ToString.md",
    "content": "SqlBuilder.ToString Method\n==========================\nConverts the value of this instance to a [String][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic override string ToString()\n```\n\n#### Return Value\n[String][1]  \nA string whose value is the same as this instance.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.string\n[2]: ../README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/UNION.md",
    "content": "SqlBuilder.UNION Method\n=======================\nAppends the UNION clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder UNION()\n```\n\n#### Return Value\n[SqlBuilder][2]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/UPDATE.md",
    "content": "SqlBuilder.UPDATE(SqlBuilder.ClauseStringHandler&lt;SqlClause.UPDATE>) Method\n=============================================================================\nAppends the UPDATE clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                 |\n| ----------------------------------------------------- | --------------------------------------------------------------------------- |\n| **UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)** | Appends the UPDATE clause using the provided interpolated string *handler*. |\n| [UPDATE(String)][2]                                   | Appends the UPDATE clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder UPDATE(\n\tref ClauseStringHandler<UPDATE> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;UPDATE>\nThe interpolated string that represents the body of the UPDATE clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UPDATE_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/UPDATE_1.md",
    "content": "SqlBuilder.UPDATE(String) Method\n================================\nAppends the UPDATE clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                 |\n| ------------------------------------------------------ | --------------------------------------------------------------------------- |\n| [UPDATE(SqlBuilder.ClauseStringHandler&lt;UPDATE>)][2] | Appends the UPDATE clause using the provided interpolated string *handler*. |\n| **UPDATE(String)**                                     | Appends the UPDATE clause using the provided *text*.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder UPDATE(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe text that represents the body of the UPDATE clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UPDATE.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/VALUES.md",
    "content": "SqlBuilder.VALUES(SqlBuilder.ClauseStringHandler&lt;SqlClause.VALUES>) Method\n=============================================================================\nAppends the VALUES clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                  | Description                                                                 |\n| ----------------------------------------------------- | --------------------------------------------------------------------------- |\n| **VALUES(SqlBuilder.ClauseStringHandler&lt;VALUES>)** | Appends the VALUES clause using the provided interpolated string *handler*. |\n| [VALUES(Object[])][2]                                 | Appends the VALUES clause using the provided parameters.                    |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder VALUES(\n\tref ClauseStringHandler<VALUES> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;VALUES>\nThe interpolated string that represents the body of the VALUES clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: VALUES_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/VALUES_1.md",
    "content": "SqlBuilder.VALUES(Object[]) Method\n==================================\nAppends the VALUES clause using the provided parameters.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                                 |\n| ------------------------------------------------------ | --------------------------------------------------------------------------- |\n| [VALUES(SqlBuilder.ClauseStringHandler&lt;VALUES>)][2] | Appends the VALUES clause using the provided interpolated string *handler*. |\n| **VALUES(Object[])**                                   | Appends the VALUES clause using the provided parameters.                    |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder VALUES(\n\tparams Object?[] args\n)\n```\n\n#### Parameters\n\n##### *args*  [Object][3][]\nThe parameters of the clause body.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: VALUES.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WHERE.md",
    "content": "SqlBuilder.WHERE Method\n=======================\nSets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                                                                                                                        |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **WHERE()**                                          | Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][1]. |\n| [WHERE(SqlBuilder.ClauseStringHandler&lt;WHERE>)][3] | Appends the WHERE clause using the provided interpolated string *handler*.                                                                         |\n| [WHERE(String)][4]                                   | Appends the WHERE clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WHERE()\n```\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: WHERE_1.md\n[4]: WHERE_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WHERE_1.md",
    "content": "SqlBuilder.WHERE(SqlBuilder.ClauseStringHandler&lt;SqlClause.WHERE>) Method\n===========================================================================\nAppends the WHERE clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                | Description                                                                                                                                        |\n| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [WHERE()][2]                                        | Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| **WHERE(SqlBuilder.ClauseStringHandler&lt;WHERE>)** | Appends the WHERE clause using the provided interpolated string *handler*.                                                                         |\n| [WHERE(String)][4]                                  | Appends the WHERE clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WHERE(\n\tref ClauseStringHandler<WHERE> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;WHERE>\nThe interpolated string that represents the body of the WHERE clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WHERE.md\n[3]: _If.md\n[4]: WHERE_2.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WHERE_2.md",
    "content": "SqlBuilder.WHERE(String) Method\n===============================\nAppends the WHERE clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                                                                                                                        |\n| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [WHERE()][2]                                         | Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as [_If(Boolean, ConditionalStringHandler)][3]. |\n| [WHERE(SqlBuilder.ClauseStringHandler&lt;WHERE>)][4] | Appends the WHERE clause using the provided interpolated string *handler*.                                                                         |\n| **WHERE(String)**                                    | Appends the WHERE clause using the provided *text*.                                                                                                |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WHERE(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the WHERE clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WHERE.md\n[3]: _If.md\n[4]: WHERE_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WITH.md",
    "content": "SqlBuilder.WITH(SqlBuilder.ClauseStringHandler&lt;SqlClause.WITH>) Method\n=========================================================================\nAppends the WITH clause using the provided interpolated string *handler*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                              | Description                                                                        |\n| ------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| **WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)** | Appends the WITH clause using the provided interpolated string *handler*.          |\n| [WITH(String)][2]                                 | Appends the WITH clause using the provided *text*.                                 |\n| [WITH(String, SqlBuilder)][3]                     | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n| [WITH(String, SqlSet)][4]                         | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WITH(\n\tref ClauseStringHandler<WITH> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;WITH>\nThe interpolated string that represents the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][5]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WITH_1.md\n[3]: WITH_2.md\n[4]: WITH_3.md\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WITH_1.md",
    "content": "SqlBuilder.WITH(String) Method\n==============================\nAppends the WITH clause using the provided *text*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                        |\n| -------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][2] | Appends the WITH clause using the provided interpolated string *handler*.          |\n| **WITH(String)**                                   | Appends the WITH clause using the provided *text*.                                 |\n| [WITH(String, SqlBuilder)][3]                      | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n| [WITH(String, SqlSet)][4]                          | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WITH(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][5]\nThe text that represents the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WITH.md\n[3]: WITH_2.md\n[4]: WITH_3.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WITH_2.md",
    "content": "SqlBuilder.WITH(String, SqlBuilder) Method\n==========================================\nAppends the WITH clause using the provided *subQuery* as body named after *alias*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                        |\n| -------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][2] | Appends the WITH clause using the provided interpolated string *handler*.          |\n| [WITH(String)][3]                                  | Appends the WITH clause using the provided *text*.                                 |\n| **WITH(String, SqlBuilder)**                       | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n| [WITH(String, SqlSet)][4]                          | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WITH(\n\tstring alias,\n\tSqlBuilder subQuery\n)\n```\n\n#### Parameters\n\n##### *alias*  [String][5]\nThe alias of the sub-query.\n\n##### *subQuery*  [SqlBuilder][6]\nThe sub-query to use as the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][6]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WITH.md\n[3]: WITH_1.md\n[4]: WITH_3.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/WITH_3.md",
    "content": "SqlBuilder.WITH(String, SqlSet) Method\n======================================\nAppends the WITH clause using the provided *subQuery* as body named after *alias*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                                        |\n| -------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| [WITH(SqlBuilder.ClauseStringHandler&lt;WITH>)][2] | Appends the WITH clause using the provided interpolated string *handler*.          |\n| [WITH(String)][3]                                  | Appends the WITH clause using the provided *text*.                                 |\n| [WITH(String, SqlBuilder)][4]                      | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n| **WITH(String, SqlSet)**                           | Appends the WITH clause using the provided *subQuery* as body named after *alias*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder WITH(\n\tstring alias,\n\tSqlSet subQuery\n)\n```\n\n#### Parameters\n\n##### *alias*  [String][5]\nThe alias of the sub-query.\n\n##### *subQuery*  [SqlSet][6]\nThe sub-query to use as the body of the WITH clause.\n\n#### Return Value\n[SqlBuilder][7]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: WITH.md\n[3]: WITH_1.md\n[4]: WITH_2.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: ../SqlSet/README.md\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/_.md",
    "content": "SqlBuilder._(SqlBuilder.ClauseStringHandler&lt;SqlClause.Current>) Method\n=========================================================================\nAppends the interpolated string *handler* to the current clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                              | Description                                                      |\n| ------------------------------------------------- | ---------------------------------------------------------------- |\n| **_(SqlBuilder.ClauseStringHandler&lt;Current>)** | Appends the interpolated string *handler* to the current clause. |\n| [_(String)][2]                                    | Appends the *text* to the current clause.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder _(\n\tref ClauseStringHandler<Current> handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ClauseStringHandler&lt;Current>\nThe interpolated string that represents the body of the current clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: __1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/_Else.md",
    "content": "SqlBuilder._Else Method\n=======================\nAppends *handler* to the current clause if an antecedent call to [_If(Boolean, ConditionalStringHandler)][1] or [_ElseIf(Boolean, ConditionalElseStringHandler)][2] used a `false` condition\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder _Else(\n\tref ConditionalElseStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *handler*  ConditionalElseStringHandler\nThe interpolated string that represents the body of the current clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][3]  \n\n[1]: _If.md\n[2]: _ElseIf.md\n[3]: ../README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/_ElseIf.md",
    "content": "SqlBuilder._ElseIf Method\n=========================\nAppends *handler* to the current clause if *condition* is `true` and an antecedent call to [_If(Boolean, ConditionalStringHandler)][1] or **_ElseIf(Boolean, ConditionalElseStringHandler)** used a `false` condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder _ElseIf(\n\tbool condition,\n\tref ConditionalElseStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *condition*  [Boolean][3]\n`true` to append *handler* to the current clause; otherwise, `false`.\n\n##### *handler*  ConditionalElseStringHandler\nThe interpolated string that represents the body of the current clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][2]  \n\n[1]: _If.md\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/_If.md",
    "content": "SqlBuilder._If Method\n=====================\nAppends the interpolated string *handler* to the current clause if *condition* is `true`.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder _If(\n\tbool condition,\n\tref ConditionalStringHandler handler\n)\n```\n\n#### Parameters\n\n##### *condition*  [Boolean][2]\n`true` to append *handler* to the current clause; otherwise, `false`.\n\n##### *handler*  ConditionalStringHandler\nThe interpolated string that represents the body of the current clause.\n\n#### Return Value\n[SqlBuilder][3]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.boolean\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlBuilder/__1.md",
    "content": "SqlBuilder._(String) Method\n===========================\nAppends the *text* to the current clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                                      |\n| -------------------------------------------------- | ---------------------------------------------------------------- |\n| [_(SqlBuilder.ClauseStringHandler&lt;Current>)][2] | Appends the interpolated string *handler* to the current clause. |\n| **_(String)**                                      | Appends the *text* to the current clause.                        |\n\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder _(\n\tstring? text\n)\n```\n\n#### Parameters\n\n##### *text*  [String][3]\nThe text that represents the body of the current clause.\n\n#### Return Value\n[SqlBuilder][4]  \nA reference to this instance after the append operation has completed.\n\nSee Also\n--------\n\n#### Reference\n[SqlBuilder Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: _.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlClause/Instance__1.md",
    "content": "SqlClause.Instance&lt;TClause> Method\n=====================================\nGets a singleton instance of the clause identified by TClause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic static TClause Instance<TClause>()\nwhere TClause : new(), SqlClause\n\n```\n\n#### Type Parameters\n\n##### *TClause*\nThe type of the clause.\n\n#### Return Value\n**TClause**  \nAn instance of TClause.\n\nSee Also\n--------\n\n#### Reference\n[SqlClause Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlClause/Name.md",
    "content": "SqlClause.Name Property\n=======================\nThe name of the clause.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Name { get; init; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlClause Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlClause/README.md",
    "content": "SqlClause Class\n===============\nProvides information about a SQL clause. Used by [SqlBuilder][1].\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][2]  \n  **DbExtensions.SqlClause**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic abstract class SqlClause : IEquatable<SqlClause>\n```\n\nThe **SqlClause** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name           | Description                                                       |\n| -------------- | ----------------------------------------------------------------- |\n| [SqlClause][4] | Provides information about a SQL clause. Used by [SqlBuilder][1]. |\n\n\nProperties\n----------\n\n| Name           | Description                              |\n| -------------- | ---------------------------------------- |\n| [Name][5]      | The name of the clause.                  |\n| [Separator][6] | The string to use for consecutive calls. |\n\n\nMethods\n-------\n\n| Name                      | Description                                                    |\n| ------------------------- | -------------------------------------------------------------- |\n| [Instance&lt;TClause>][7] | Gets a singleton instance of the clause identified by TClause. |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: ../SqlBuilder/README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: ../README.md\n[4]: _ctor.md\n[5]: Name.md\n[6]: Separator.md\n[7]: Instance__1.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlClause/Separator.md",
    "content": "SqlClause.Separator Property\n============================\nThe string to use for consecutive calls.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Separator { get; init; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlClause Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlClause/_ctor.md",
    "content": "SqlClause Constructor\n=====================\nProvides information about a SQL clause. Used by [SqlBuilder][1].\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\nprotected SqlClause(\n\tstring? Name,\n\tstring? Separator\n)\n```\n\n#### Parameters\n\n##### *Name*  [String][3]\nThe name of the clause.\n\n##### *Separator*  [String][3]\nThe string to use for consecutive calls.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlClause Class][4]  \n[DbExtensions Namespace][2]  \n\n[1]: ../SqlBuilder/README.md\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/All.md",
    "content": "SqlSet.All(SqlSet.OperatorStringHandler) Method\n===============================================\nDetermines whether all elements of the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                           | Description                                                     |\n| ------------------------------ | --------------------------------------------------------------- |\n| **All(OperatorStringHandler)** | Determines whether all elements of the set satisfy a condition. |\n| [All(String)][2]               | Determines whether all elements of the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic bool All(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Boolean][3]  \n`true` if every element of the set passes the test in the specified *predicate*, or if the set is empty; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: All_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AllAsync.md",
    "content": "SqlSet.AllAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=======================================================================\nDetermines whether all elements of the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                     |\n| ------------------------------------------------------ | --------------------------------------------------------------- |\n| **AllAsync(OperatorStringHandler, CancellationToken)** | Determines whether all elements of the set satisfy a condition. |\n| [AllAsync(String, CancellationToken)][2]               | Determines whether all elements of the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> AllAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if every element of the set passes the test in the specified *predicate*, or if the set is empty; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AllAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AllAsync_1.md",
    "content": "SqlSet.AllAsync(String, CancellationToken) Method\n=================================================\nDetermines whether all elements of the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                    | Description                                                     |\n| ------------------------------------------------------- | --------------------------------------------------------------- |\n| [AllAsync(OperatorStringHandler, CancellationToken)][2] | Determines whether all elements of the set satisfy a condition. |\n| **AllAsync(String, CancellationToken)**                 | Determines whether all elements of the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> AllAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][3]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Boolean][7]>  \n`true` if every element of the set passes the test in the specified *predicate*, or if the set is empty; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AllAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.boolean\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/All_1.md",
    "content": "SqlSet.All(String) Method\n=========================\nDetermines whether all elements of the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                                     |\n| ------------------------------- | --------------------------------------------------------------- |\n| [All(OperatorStringHandler)][2] | Determines whether all elements of the set satisfy a condition. |\n| **All(String)**                 | Determines whether all elements of the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic bool All(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][3]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Boolean][4]  \n`true` if every element of the set passes the test in the specified *predicate*, or if the set is empty; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: All.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Any.md",
    "content": "SqlSet.Any Method\n=================\nDetermines whether the set contains any elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                                      |\n| ------------------------------- | ---------------------------------------------------------------- |\n| **Any()**                       | Determines whether the set contains any elements.                |\n| [Any(OperatorStringHandler)][2] | Determines whether any element of the set satisfies a condition. |\n| [Any(String)][3]                | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic bool Any()\n```\n\n#### Return Value\n[Boolean][4]  \n`true` if the sequence contains any elements; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Any_1.md\n[3]: Any_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AnyAsync.md",
    "content": "SqlSet.AnyAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=======================================================================\nDetermines whether any element of the set satisfies a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                   | Description                                                      |\n| ------------------------------------------------------ | ---------------------------------------------------------------- |\n| [AnyAsync(CancellationToken)][2]                       | Determines whether the set contains any elements.                |\n| **AnyAsync(OperatorStringHandler, CancellationToken)** | Determines whether any element of the set satisfies a condition. |\n| [AnyAsync(String, CancellationToken)][3]               | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> AnyAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Boolean][7]>  \n`true` if any elements in the set pass the test in the specified *predicate*; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AnyAsync_2.md\n[3]: AnyAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.boolean\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AnyAsync_1.md",
    "content": "SqlSet.AnyAsync(String, CancellationToken) Method\n=================================================\nDetermines whether any element of the set satisfies a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                    | Description                                                      |\n| ------------------------------------------------------- | ---------------------------------------------------------------- |\n| [AnyAsync(CancellationToken)][2]                        | Determines whether the set contains any elements.                |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][3] | Determines whether any element of the set satisfies a condition. |\n| **AnyAsync(String, CancellationToken)**                 | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> AnyAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Boolean][8]>  \n`true` if any elements in the set pass the test in the specified *predicate*; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AnyAsync_2.md\n[3]: AnyAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.boolean\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AnyAsync_2.md",
    "content": "SqlSet.AnyAsync(CancellationToken) Method\n=========================================\nDetermines whether the set contains any elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                    | Description                                                      |\n| ------------------------------------------------------- | ---------------------------------------------------------------- |\n| **AnyAsync(CancellationToken)**                         | Determines whether the set contains any elements.                |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][2] | Determines whether any element of the set satisfies a condition. |\n| [AnyAsync(String, CancellationToken)][3]                | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> AnyAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Boolean][7]>  \n`true` if the sequence contains any elements; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AnyAsync.md\n[3]: AnyAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.boolean\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Any_1.md",
    "content": "SqlSet.Any(SqlSet.OperatorStringHandler) Method\n===============================================\nDetermines whether any element of the set satisfies a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                           | Description                                                      |\n| ------------------------------ | ---------------------------------------------------------------- |\n| [Any()][2]                     | Determines whether the set contains any elements.                |\n| **Any(OperatorStringHandler)** | Determines whether any element of the set satisfies a condition. |\n| [Any(String)][3]               | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic bool Any(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Boolean][4]  \n`true` if any elements in the set pass the test in the specified *predicate*; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Any.md\n[3]: Any_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Any_2.md",
    "content": "SqlSet.Any(String) Method\n=========================\nDetermines whether any element of the set satisfies a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                            | Description                                                      |\n| ------------------------------- | ---------------------------------------------------------------- |\n| [Any()][2]                      | Determines whether the set contains any elements.                |\n| [Any(OperatorStringHandler)][3] | Determines whether any element of the set satisfies a condition. |\n| **Any(String)**                 | Determines whether any element of the set satisfies a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic bool Any(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Boolean][5]  \n`true` if any elements in the set pass the test in the specified *predicate*; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Any.md\n[3]: Any_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.boolean\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AsAsyncEnumerable.md",
    "content": "SqlSet.AsAsyncEnumerable Method\n===============================\nGets all elements in the set. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<Object> AsAsyncEnumerable()\n```\n\n#### Return Value\n[IAsyncEnumerable][2]&lt;[Object][3]>  \nAll elements in the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/AsEnumerable.md",
    "content": "SqlSet.AsEnumerable Method\n==========================\nGets all elements in the set. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<Object> AsEnumerable()\n```\n\n#### Return Value\n[IEnumerable][2]&lt;[Object][3]>  \nAll elements in the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Cast.md",
    "content": "SqlSet.Cast(Type) Method\n========================\nCasts the elements of the set to the specified type.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                    | Description                                          |\n| ----------------------- | ---------------------------------------------------- |\n| **Cast(Type)**          | Casts the elements of the set to the specified type. |\n| [Cast&lt;TResult>()][2] | Casts the elements of the set to the specified type. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Cast(\n\tType resultType\n)\n```\n\n#### Parameters\n\n##### *resultType*  [Type][3]\nThe type to cast the elements of the set to.\n\n#### Return Value\n[SqlSet][4]  \nA new [SqlSet][4] that contains each element of the current set cast to the specified type.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Cast__1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.type\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Cast__1.md",
    "content": "SqlSet.Cast&lt;TResult> Method\n==============================\nCasts the elements of the set to the specified type.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                   | Description                                          |\n| ---------------------- | ---------------------------------------------------- |\n| [Cast(Type)][2]        | Casts the elements of the set to the specified type. |\n| **Cast&lt;TResult>()** | Casts the elements of the set to the specified type. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Cast<TResult>()\n\n```\n\n#### Type Parameters\n\n##### *TResult*\nThe type to cast the elements of the set to.\n\n#### Return Value\n[SqlSet][3]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][3] that contains each element of the current set cast to the specified type.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Cast.md\n[3]: ../SqlSet_1/README.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Contains.md",
    "content": "SqlSet.Contains Method\n======================\nChecks the existance of the *entity*, using the primary key value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool Contains(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose existance is to be checked.\n\n#### Return Value\n[Boolean][3]  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][4] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ContainsAsync.md",
    "content": "SqlSet.ContainsAsync Method\n===========================\nChecks the existance of the *entity*, using the primary key value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> ContainsAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose existance is to be checked.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ContainsKey.md",
    "content": "SqlSet.ContainsKey Method\n=========================\nChecks the existance of an entity whose primary matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool ContainsKey(\n\tObject id\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Return Value\n[Boolean][3]  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][4] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ContainsKeyAsync.md",
    "content": "SqlSet.ContainsKeyAsync Method\n==============================\nChecks the existance of an entity whose primary matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> ContainsKeyAsync(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Count.md",
    "content": "SqlSet.Count Method\n===================\nReturns the number of elements in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                        |\n| --------------------------------- | ---------------------------------------------------------------------------------- |\n| **Count()**                       | Returns the number of elements in the set.                                         |\n| [Count(OperatorStringHandler)][2] | Returns a number that represents how many elements in the set satisfy a condition. |\n| [Count(String)][3]                | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic int Count()\n```\n\n#### Return Value\n[Int32][4]  \nThe number of elements in the set.\n\nExceptions\n----------\n\n| Exception              | Condition                                            |\n| ---------------------- | ---------------------------------------------------- |\n| [OverflowException][5] | The number of elements is larger than [MaxValue][6]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Count_1.md\n[3]: Count_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.int32\n[5]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[6]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/CountAsync.md",
    "content": "SqlSet.CountAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=========================================================================\nReturns a number that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                     | Description                                                                        |\n| -------------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| [CountAsync(CancellationToken)][2]                       | Returns the number of elements in the set.                                         |\n| **CountAsync(OperatorStringHandler, CancellationToken)** | Returns a number that represents how many elements in the set satisfy a condition. |\n| [CountAsync(String, CancellationToken)][3]               | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<int> CountAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Int32][7]>  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][8] | The number of matching elements exceeds [MaxValue][9]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: CountAsync_2.md\n[3]: CountAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.int32\n[8]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[9]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/CountAsync_1.md",
    "content": "SqlSet.CountAsync(String, CancellationToken) Method\n===================================================\nReturns a number that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                        |\n| --------------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| [CountAsync(CancellationToken)][2]                        | Returns the number of elements in the set.                                         |\n| [CountAsync(OperatorStringHandler, CancellationToken)][3] | Returns a number that represents how many elements in the set satisfy a condition. |\n| **CountAsync(String, CancellationToken)**                 | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<int> CountAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Int32][8]>  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                               |\n| ---------------------- | ------------------------------------------------------- |\n| [OverflowException][9] | The number of matching elements exceeds [MaxValue][10]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][11]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: CountAsync_2.md\n[3]: CountAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.int32\n[9]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[10]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[11]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/CountAsync_2.md",
    "content": "SqlSet.CountAsync(CancellationToken) Method\n===========================================\nReturns the number of elements in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                        |\n| --------------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| **CountAsync(CancellationToken)**                         | Returns the number of elements in the set.                                         |\n| [CountAsync(OperatorStringHandler, CancellationToken)][2] | Returns a number that represents how many elements in the set satisfy a condition. |\n| [CountAsync(String, CancellationToken)][3]                | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<int> CountAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Int32][7]>  \nThe number of elements in the set.\n\nExceptions\n----------\n\n| Exception              | Condition                                            |\n| ---------------------- | ---------------------------------------------------- |\n| [OverflowException][8] | The number of elements is larger than [MaxValue][9]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: CountAsync.md\n[3]: CountAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.int32\n[8]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[9]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Count_1.md",
    "content": "SqlSet.Count(SqlSet.OperatorStringHandler) Method\n=================================================\nReturns a number that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                                                                        |\n| -------------------------------- | ---------------------------------------------------------------------------------- |\n| [Count()][2]                     | Returns the number of elements in the set.                                         |\n| **Count(OperatorStringHandler)** | Returns a number that represents how many elements in the set satisfy a condition. |\n| [Count(String)][3]               | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic int Count(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Int32][4]  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][5] | The number of matching elements exceeds [MaxValue][6]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Count.md\n[3]: Count_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.int32\n[5]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[6]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Count_2.md",
    "content": "SqlSet.Count(String) Method\n===========================\nReturns a number that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                        |\n| --------------------------------- | ---------------------------------------------------------------------------------- |\n| [Count()][2]                      | Returns the number of elements in the set.                                         |\n| [Count(OperatorStringHandler)][3] | Returns a number that represents how many elements in the set satisfy a condition. |\n| **Count(String)**                 | Returns a number that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic int Count(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Int32][5]  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][6] | The number of matching elements exceeds [MaxValue][7]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Count.md\n[3]: Count_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.int32\n[6]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[7]: https://learn.microsoft.com/dotnet/api/system.int32.maxvalue\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Database.md",
    "content": "SqlSet.Database Property\n========================\nThe [Database][1] this set is connected to.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Database Database { get; }\n```\n\n#### Property Value\n[Database][1]\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][2]  \n\n[1]: ../Database/README.md\n[2]: ../README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Find.md",
    "content": "SqlSet.Find Method\n==================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Object? Find(\n\tObject id\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Return Value\n[Object][2]  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][3] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FindAsync.md",
    "content": "SqlSet.FindAsync Method\n=======================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FindAsync(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Object][2]>  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][6] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/First.md",
    "content": "SqlSet.First Method\n===================\nReturns the first element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                |\n| --------------------------------- | -------------------------------------------------------------------------- |\n| **First()**                       | Returns the first element of the set.                                      |\n| [First(OperatorStringHandler)][2] | Returns the first element in the set that satisfies a specified condition. |\n| [First(String)][3]                | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object First()\n```\n\n#### Return Value\n[Object][4]  \nThe first element in the set.\n\nExceptions\n----------\n\n| Exception                      | Condition         |\n| ------------------------------ | ----------------- |\n| [InvalidOperationException][5] | The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First_1.md\n[3]: First_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstAsync.md",
    "content": "SqlSet.FirstAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=========================================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                     | Description                                                                |\n| -------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [FirstAsync(CancellationToken)][2]                       | Returns the first element of the set.                                      |\n| **FirstAsync(OperatorStringHandler, CancellationToken)** | Returns the first element in the set that satisfies a specified condition. |\n| [FirstAsync(String, CancellationToken)][3]               | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][8] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync_2.md\n[3]: FirstAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstAsync_1.md",
    "content": "SqlSet.FirstAsync(String, CancellationToken) Method\n===================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                |\n| --------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [FirstAsync(CancellationToken)][2]                        | Returns the first element of the set.                                      |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][3] | Returns the first element in the set that satisfies a specified condition. |\n| **FirstAsync(String, CancellationToken)**                 | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Object][8]>  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][9] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync_2.md\n[3]: FirstAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstAsync_2.md",
    "content": "SqlSet.FirstAsync(CancellationToken) Method\n===========================================\nReturns the first element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                |\n| --------------------------------------------------------- | -------------------------------------------------------------------------- |\n| **FirstAsync(CancellationToken)**                         | Returns the first element of the set.                                      |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][2] | Returns the first element in the set that satisfies a specified condition. |\n| [FirstAsync(String, CancellationToken)][3]                | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe first element in the set.\n\nExceptions\n----------\n\n| Exception                      | Condition         |\n| ------------------------------ | ----------------- |\n| [InvalidOperationException][8] | The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync.md\n[3]: FirstAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefault.md",
    "content": "SqlSet.FirstOrDefault Method\n============================\nReturns the first element of the set, or a default value if the set contains no elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                     |\n| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| **FirstOrDefault()**                       | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefault(OperatorStringHandler)][2] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefault(String)][3]                | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? FirstOrDefault()\n```\n\n#### Return Value\n[Object][4]  \nA default value if the set is empty; otherwise, the first element.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault_1.md\n[3]: FirstOrDefault_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefaultAsync.md",
    "content": "SqlSet.FirstOrDefaultAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n==================================================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                              | Description                                                                                                     |\n| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefaultAsync(CancellationToken)][2]                       | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| **FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)** | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefaultAsync(String, CancellationToken)][3]               | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstOrDefaultAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync_2.md\n[3]: FirstOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefaultAsync_1.md",
    "content": "SqlSet.FirstOrDefaultAsync(String, CancellationToken) Method\n============================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                     |\n| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefaultAsync(CancellationToken)][2]                        | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][3] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| **FirstOrDefaultAsync(String, CancellationToken)**                 | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstOrDefaultAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Object][8]>  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync_2.md\n[3]: FirstOrDefaultAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefaultAsync_2.md",
    "content": "SqlSet.FirstOrDefaultAsync(CancellationToken) Method\n====================================================\nReturns the first element of the set, or a default value if the set contains no elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                     |\n| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| **FirstOrDefaultAsync(CancellationToken)**                         | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][2] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefaultAsync(String, CancellationToken)][3]                | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> FirstOrDefaultAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nA default value if the set is empty; otherwise, the first element.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync.md\n[3]: FirstOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefault_1.md",
    "content": "SqlSet.FirstOrDefault(SqlSet.OperatorStringHandler) Method\n==========================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                                                     |\n| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefault()][2]                     | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| **FirstOrDefault(OperatorStringHandler)** | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefault(String)][3]               | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? FirstOrDefault(\n\tref OperatorStringHandler? predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][4]  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault.md\n[3]: FirstOrDefault_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/FirstOrDefault_2.md",
    "content": "SqlSet.FirstOrDefault(String) Method\n====================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                     |\n| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefault()][2]                      | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefault(OperatorStringHandler)][3] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| **FirstOrDefault(String)**                 | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? FirstOrDefault(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][5]  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault.md\n[3]: FirstOrDefault_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/First_1.md",
    "content": "SqlSet.First(SqlSet.OperatorStringHandler) Method\n=================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                                                                |\n| -------------------------------- | -------------------------------------------------------------------------- |\n| [First()][2]                     | Returns the first element of the set.                                      |\n| **First(OperatorStringHandler)** | Returns the first element in the set that satisfies a specified condition. |\n| [First(String)][3]               | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object First(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][4]  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][5] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First.md\n[3]: First_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/First_2.md",
    "content": "SqlSet.First(String) Method\n===========================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                |\n| --------------------------------- | -------------------------------------------------------------------------- |\n| [First()][2]                      | Returns the first element of the set.                                      |\n| [First(OperatorStringHandler)][3] | Returns the first element in the set that satisfies a specified condition. |\n| **First(String)**                 | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object First(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][5]  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][6] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First.md\n[3]: First_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/GetAsyncEnumerator.md",
    "content": "SqlSet.GetAsyncEnumerator Method\n================================\nReturns an async enumerator that iterates through the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerator<Object> GetAsyncEnumerator(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[IAsyncEnumerator][4]&lt;[Object][5]>  \nA [IAsyncEnumerator&lt;T>][4] for the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerator-1\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/GetDefiningQuery.md",
    "content": "SqlSet.GetDefiningQuery Method\n==============================\nReturns the SQL query that is the source of data for the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlBuilder GetDefiningQuery()\n```\n\n#### Return Value\n[SqlBuilder][2]  \nThe SQL query that is the source of data for the set\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlBuilder/README.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/GetEnumerator.md",
    "content": "SqlSet.GetEnumerator Method\n===========================\nReturns an enumerator that iterates through the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IEnumerator<Object> GetEnumerator()\n```\n\n#### Return Value\n[IEnumerator][2]&lt;[Object][3]>  \nA [IEnumerator&lt;T>][2] for the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Include.md",
    "content": "SqlSet.Include Method\n=====================\nSpecifies the related objects to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet Include(\n\tstring path\n)\n```\n\n#### Parameters\n\n##### *path*  [String][2]\nDot-separated list of related objects to return in the query results.\n\n#### Return Value\n[SqlSet][3]  \nA new [SqlSet][3] with the defined query path.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][4] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/IncludeMany.md",
    "content": "SqlSet.IncludeMany Method\n=========================\nSpecifies which collections to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet IncludeMany(\n\tstring path,\n\tFunc<SqlSet, SqlSet>? manySetup = null\n)\n```\n\n#### Parameters\n\n##### *path*  [String][2]\nDot-separated list of one or more related objects that ends with the collection to load.\n\n##### *manySetup*  [Func][3]&lt;[SqlSet][4], [SqlSet][4]>  (Optional)\nA function to customize how the collection is loaded.\n\n#### Return Value\n[SqlSet][4]  \nA new [SqlSet][4].\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][5] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: https://learn.microsoft.com/dotnet/api/system.func-2\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCount.md",
    "content": "SqlSet.LongCount Method\n=======================\nReturns an [Int64][1] that represents the total number of elements in the set.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                  | Description                                                                             |\n| ------------------------------------- | --------------------------------------------------------------------------------------- |\n| **LongCount()**                       | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| [LongCount(OperatorStringHandler)][3] | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| [LongCount(String)][4]                | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic long LongCount()\n```\n\n#### Return Value\n[Int64][1]  \nThe number of elements in the set.\n\nExceptions\n----------\n\n| Exception              | Condition                                            |\n| ---------------------- | ---------------------------------------------------- |\n| [OverflowException][5] | The number of elements is larger than [MaxValue][6]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCount_1.md\n[4]: LongCount_2.md\n[5]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[6]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCountAsync.md",
    "content": "SqlSet.LongCountAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=============================================================================\nReturns an [Int64][1] that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                         | Description                                                                             |\n| ------------------------------------------------------------ | --------------------------------------------------------------------------------------- |\n| [LongCountAsync(CancellationToken)][3]                       | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| **LongCountAsync(OperatorStringHandler, CancellationToken)** | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| [LongCountAsync(String, CancellationToken)][4]               | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<long> LongCountAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Int64][1]>  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][8] | The number of matching elements exceeds [MaxValue][9]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCountAsync_2.md\n[4]: LongCountAsync_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[9]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCountAsync_1.md",
    "content": "SqlSet.LongCountAsync(String, CancellationToken) Method\n=======================================================\nReturns an [Int64][1] that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                             |\n| ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |\n| [LongCountAsync(CancellationToken)][3]                        | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][4] | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| **LongCountAsync(String, CancellationToken)**                 | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<long> LongCountAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][5]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][6]  (Optional)\nThe [CancellationToken][6] to monitor for cancellation requests. The default is [None][7].\n\n#### Return Value\n[ValueTask][8]&lt;[Int64][1]>  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                               |\n| ---------------------- | ------------------------------------------------------- |\n| [OverflowException][9] | The number of matching elements exceeds [MaxValue][10]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][11]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCountAsync_2.md\n[4]: LongCountAsync.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[8]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[9]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[10]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[11]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCountAsync_2.md",
    "content": "SqlSet.LongCountAsync(CancellationToken) Method\n===============================================\nReturns an [Int64][1] that represents the total number of elements in the set.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                             |\n| ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |\n| **LongCountAsync(CancellationToken)**                         | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][3] | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| [LongCountAsync(String, CancellationToken)][4]                | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<long> LongCountAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Int64][1]>  \nThe number of elements in the set.\n\nExceptions\n----------\n\n| Exception              | Condition                                            |\n| ---------------------- | ---------------------------------------------------- |\n| [OverflowException][8] | The number of elements is larger than [MaxValue][9]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCountAsync.md\n[4]: LongCountAsync_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[9]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCount_1.md",
    "content": "SqlSet.LongCount(SqlSet.OperatorStringHandler) Method\n=====================================================\nReturns an [Int64][1] that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                 | Description                                                                             |\n| ------------------------------------ | --------------------------------------------------------------------------------------- |\n| [LongCount()][3]                     | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| **LongCount(OperatorStringHandler)** | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| [LongCount(String)][4]               | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic long LongCount(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Int64][1]  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][5] | The number of matching elements exceeds [MaxValue][6]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCount.md\n[4]: LongCount_2.md\n[5]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[6]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/LongCount_2.md",
    "content": "SqlSet.LongCount(String) Method\n===============================\nReturns an [Int64][1] that represents how many elements in the set satisfy a condition.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                  | Description                                                                             |\n| ------------------------------------- | --------------------------------------------------------------------------------------- |\n| [LongCount()][3]                      | Returns an [Int64][1] that represents the total number of elements in the set.          |\n| [LongCount(OperatorStringHandler)][4] | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n| **LongCount(String)**                 | Returns an [Int64][1] that represents how many elements in the set satisfy a condition. |\n\n\nSyntax\n------\n\n```csharp\npublic long LongCount(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][5]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Int64][1]  \nA number that represents how many elements in the set satisfy the condition in the *predicate*.\n\nExceptions\n----------\n\n| Exception              | Condition                                              |\n| ---------------------- | ------------------------------------------------------ |\n| [OverflowException][6] | The number of matching elements exceeds [MaxValue][7]. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.int64\n[2]: ../README.md\n[3]: LongCount.md\n[4]: LongCount_1.md\n[5]: https://learn.microsoft.com/dotnet/api/system.string\n[6]: https://learn.microsoft.com/dotnet/api/system.overflowexception\n[7]: https://learn.microsoft.com/dotnet/api/system.int64.maxvalue\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/OrderBy.md",
    "content": "SqlSet.OrderBy(SqlSet.OperatorStringHandler) Method\n===================================================\nSorts the elements of the set according to the *columnList*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                  |\n| ---------------------------------- | ------------------------------------------------------------ |\n| **OrderBy(OperatorStringHandler)** | Sorts the elements of the set according to the *columnList*. |\n| [OrderBy(String)][2]               | Sorts the elements of the set according to the *columnList*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet OrderBy(\n\tref OperatorStringHandler columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns to base the sort on.\n\n#### Return Value\n[SqlSet][3]  \nA new [SqlSet][3] whose elements are sorted according to *columnList*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OrderBy_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/OrderBy_1.md",
    "content": "SqlSet.OrderBy(String) Method\n=============================\nSorts the elements of the set according to the *columnList*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                | Description                                                  |\n| ----------------------------------- | ------------------------------------------------------------ |\n| [OrderBy(OperatorStringHandler)][2] | Sorts the elements of the set according to the *columnList*. |\n| **OrderBy(String)**                 | Sorts the elements of the set according to the *columnList*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet OrderBy(\n\tstring columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  [String][3]\nThe list of columns to base the sort on.\n\n#### Return Value\n[SqlSet][4]  \nA new [SqlSet][4] whose elements are sorted according to *columnList*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OrderBy.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/README.md",
    "content": "SqlSet Class\n============\nRepresents an immutable, connected SQL query. This class cannot be instantiated, to get an instance use one of the [Database.From][1] or [Database.FromQuery][2] overloads.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][3]  \n  **DbExtensions.SqlSet**  \n    [DbExtensions.SqlSet&lt;TResult>][4]  \n    [DbExtensions.SqlTable][5]  \n  \n**Namespace:** [DbExtensions][6]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic class SqlSet\n```\n\nThe **SqlSet** type exposes the following members.\n\n\nProperties\n----------\n\n| Name            | Description                                                      |\n| --------------- | ---------------------------------------------------------------- |\n| [Database][7]   | The [Database][8] this set is connected to.                      |\n| [ResultType][9] | The type of objects this set returns. This property can be null. |\n\n\nMethods\n-------\n\n| Name                                                                            | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [All(OperatorStringHandler)][10]                                                | Determines whether all elements of the set satisfy a condition.                                                                                                                                          |\n| [All(String)][11]                                                               | Determines whether all elements of the set satisfy a condition.                                                                                                                                          |\n| [AllAsync(OperatorStringHandler, CancellationToken)][12]                        | Determines whether all elements of the set satisfy a condition.                                                                                                                                          |\n| [AllAsync(String, CancellationToken)][13]                                       | Determines whether all elements of the set satisfy a condition.                                                                                                                                          |\n| [Any()][14]                                                                     | Determines whether the set contains any elements.                                                                                                                                                        |\n| [Any(OperatorStringHandler)][15]                                                | Determines whether any element of the set satisfies a condition.                                                                                                                                         |\n| [Any(String)][16]                                                               | Determines whether any element of the set satisfies a condition.                                                                                                                                         |\n| [AnyAsync(CancellationToken)][17]                                               | Determines whether the set contains any elements.                                                                                                                                                        |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][18]                        | Determines whether any element of the set satisfies a condition.                                                                                                                                         |\n| [AnyAsync(String, CancellationToken)][19]                                       | Determines whether any element of the set satisfies a condition.                                                                                                                                         |\n| [AsAsyncEnumerable][20]                                                         | Gets all elements in the set. The query is deferred-executed.                                                                                                                                            |\n| [AsEnumerable][21]                                                              | Gets all elements in the set. The query is deferred-executed.                                                                                                                                            |\n| [Cast(Type)][22]                                                                | Casts the elements of the set to the specified type.                                                                                                                                                     |\n| [Cast&lt;TResult>()][23]                                                        | Casts the elements of the set to the specified type.                                                                                                                                                     |\n| [Contains][24]                                                                  | Checks the existance of the *entity*, using the primary key value.                                                                                                                                       |\n| [ContainsAsync][25]                                                             | Checks the existance of the *entity*, using the primary key value.                                                                                                                                       |\n| [ContainsKey][26]                                                               | Checks the existance of an entity whose primary matches the *id* parameter.                                                                                                                              |\n| [ContainsKeyAsync][27]                                                          | Checks the existance of an entity whose primary matches the *id* parameter.                                                                                                                              |\n| [Count()][28]                                                                   | Returns the number of elements in the set.                                                                                                                                                               |\n| [Count(OperatorStringHandler)][29]                                              | Returns a number that represents how many elements in the set satisfy a condition.                                                                                                                       |\n| [Count(String)][30]                                                             | Returns a number that represents how many elements in the set satisfy a condition.                                                                                                                       |\n| [CountAsync(CancellationToken)][31]                                             | Returns the number of elements in the set.                                                                                                                                                               |\n| [CountAsync(OperatorStringHandler, CancellationToken)][32]                      | Returns a number that represents how many elements in the set satisfy a condition.                                                                                                                       |\n| [CountAsync(String, CancellationToken)][33]                                     | Returns a number that represents how many elements in the set satisfy a condition.                                                                                                                       |\n| [Find][34]                                                                      | Gets the entity whose primary key matches the *id* parameter.                                                                                                                                            |\n| [FindAsync][35]                                                                 | Gets the entity whose primary key matches the *id* parameter.                                                                                                                                            |\n| [First()][36]                                                                   | Returns the first element of the set.                                                                                                                                                                    |\n| [First(OperatorStringHandler)][37]                                              | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [First(String)][38]                                                             | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstAsync(CancellationToken)][39]                                             | Returns the first element of the set.                                                                                                                                                                    |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][40]                      | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstAsync(String, CancellationToken)][41]                                     | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstOrDefault()][42]                                                          | Returns the first element of the set, or a default value if the set contains no elements.                                                                                                                |\n| [FirstOrDefault(OperatorStringHandler)][43]                                     | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefault(String)][44]                                                    | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefaultAsync(CancellationToken)][45]                                    | Returns the first element of the set, or a default value if the set contains no elements.                                                                                                                |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][46]             | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefaultAsync(String, CancellationToken)][47]                            | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [GetAsyncEnumerator][48]                                                        | Returns an async enumerator that iterates through the set.                                                                                                                                               |\n| [GetDefiningQuery][49]                                                          | Returns the SQL query that is the source of data for the set.                                                                                                                                            |\n| [GetEnumerator][50]                                                             | Returns an enumerator that iterates through the set.                                                                                                                                                     |\n| [Include][51]                                                                   | Specifies the related objects to include in the query results.                                                                                                                                           |\n| [IncludeMany][52]                                                               | Specifies which collections to include in the query results.                                                                                                                                             |\n| [LongCount()][53]                                                               | Returns an [Int64][54] that represents the total number of elements in the set.                                                                                                                          |\n| [LongCount(OperatorStringHandler)][55]                                          | Returns an [Int64][54] that represents how many elements in the set satisfy a condition.                                                                                                                 |\n| [LongCount(String)][56]                                                         | Returns an [Int64][54] that represents how many elements in the set satisfy a condition.                                                                                                                 |\n| [LongCountAsync(CancellationToken)][57]                                         | Returns an [Int64][54] that represents the total number of elements in the set.                                                                                                                          |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][58]                  | Returns an [Int64][54] that represents how many elements in the set satisfy a condition.                                                                                                                 |\n| [LongCountAsync(String, CancellationToken)][59]                                 | Returns an [Int64][54] that represents how many elements in the set satisfy a condition.                                                                                                                 |\n| [OrderBy(OperatorStringHandler)][60]                                            | Sorts the elements of the set according to the *columnList*.                                                                                                                                             |\n| [OrderBy(String)][61]                                                           | Sorts the elements of the set according to the *columnList*.                                                                                                                                             |\n| [Select(OperatorStringHandler)][62]                                             | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select(String)][63]                                                            | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select(OperatorStringHandler, Type)][64]                                       | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select(String, Type)][65]                                                      | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select&lt;TResult>(OperatorStringHandler)][66]                                 | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select&lt;TResult>(String)][67]                                                | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][68] | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][69]                | Projects each element of the set into a new form.                                                                                                                                                        |\n| [Single()][70]                                                                  | The single element of the set.                                                                                                                                                                           |\n| [Single(OperatorStringHandler)][71]                                             | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [Single(String)][72]                                                            | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleAsync(CancellationToken)][73]                                            | The single element of the set.                                                                                                                                                                           |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][74]                     | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleAsync(String, CancellationToken)][75]                                    | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleOrDefault()][76]                                                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][77]                                    | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][78]                                                   | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(CancellationToken)][79]                                   | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][80]            | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][81]                           | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [Skip][82]                                                                      | Bypasses a specified number of elements in the set and then returns the remaining elements.                                                                                                              |\n| [Take][83]                                                                      | Returns a specified number of contiguous elements from the start of the set.                                                                                                                             |\n| [ToArray][84]                                                                   | Creates an array from the set.                                                                                                                                                                           |\n| [ToArrayAsync][85]                                                              | Creates an array from the set.                                                                                                                                                                           |\n| [ToList][86]                                                                    | Creates a [List&lt;T>][87] from the set.                                                                                                                                                                 |\n| [ToListAsync][88]                                                               | Creates a [List&lt;T>][87] from the set.                                                                                                                                                                 |\n| [ToString][89]                                                                  | Returns the SQL query of the set. <br/>(Overrides [Object.ToString()][90])                                                                                                                               |\n| [Where(OperatorStringHandler)][91]                                              | Filters the set based on a predicate.                                                                                                                                                                    |\n| [Where(String)][92]                                                             | Filters the set based on a predicate.                                                                                                                                                                    |\n\n\nRemarks\n-------\nFor information on how to use SqlSet see [SqlSet Tutorial][93].\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][6]  \n\n[1]: ../Database/From.md\n[2]: ../Database/FromQuery.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: ../SqlSet_1/README.md\n[5]: ../SqlTable/README.md\n[6]: ../README.md\n[7]: Database.md\n[8]: ../Database/README.md\n[9]: ResultType.md\n[10]: All.md\n[11]: All_1.md\n[12]: AllAsync.md\n[13]: AllAsync_1.md\n[14]: Any.md\n[15]: Any_1.md\n[16]: Any_2.md\n[17]: AnyAsync_2.md\n[18]: AnyAsync.md\n[19]: AnyAsync_1.md\n[20]: AsAsyncEnumerable.md\n[21]: AsEnumerable.md\n[22]: Cast.md\n[23]: Cast__1.md\n[24]: Contains.md\n[25]: ContainsAsync.md\n[26]: ContainsKey.md\n[27]: ContainsKeyAsync.md\n[28]: Count.md\n[29]: Count_1.md\n[30]: Count_2.md\n[31]: CountAsync_2.md\n[32]: CountAsync.md\n[33]: CountAsync_1.md\n[34]: Find.md\n[35]: FindAsync.md\n[36]: First.md\n[37]: First_1.md\n[38]: First_2.md\n[39]: FirstAsync_2.md\n[40]: FirstAsync.md\n[41]: FirstAsync_1.md\n[42]: FirstOrDefault.md\n[43]: FirstOrDefault_1.md\n[44]: FirstOrDefault_2.md\n[45]: FirstOrDefaultAsync_2.md\n[46]: FirstOrDefaultAsync.md\n[47]: FirstOrDefaultAsync_1.md\n[48]: GetAsyncEnumerator.md\n[49]: GetDefiningQuery.md\n[50]: GetEnumerator.md\n[51]: Include.md\n[52]: IncludeMany.md\n[53]: LongCount.md\n[54]: https://learn.microsoft.com/dotnet/api/system.int64\n[55]: LongCount_1.md\n[56]: LongCount_2.md\n[57]: LongCountAsync_2.md\n[58]: LongCountAsync.md\n[59]: LongCountAsync_1.md\n[60]: OrderBy.md\n[61]: OrderBy_1.md\n[62]: Select.md\n[63]: Select_2.md\n[64]: Select_1.md\n[65]: Select_3.md\n[66]: Select__1.md\n[67]: Select__1_2.md\n[68]: Select__1_1.md\n[69]: Select__1_3.md\n[70]: Single.md\n[71]: Single_1.md\n[72]: Single_2.md\n[73]: SingleAsync_2.md\n[74]: SingleAsync.md\n[75]: SingleAsync_1.md\n[76]: SingleOrDefault.md\n[77]: SingleOrDefault_1.md\n[78]: SingleOrDefault_2.md\n[79]: SingleOrDefaultAsync_2.md\n[80]: SingleOrDefaultAsync.md\n[81]: SingleOrDefaultAsync_1.md\n[82]: Skip.md\n[83]: Take.md\n[84]: ToArray.md\n[85]: ToArrayAsync.md\n[86]: ToList.md\n[87]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[88]: ToListAsync.md\n[89]: ToString.md\n[90]: https://learn.microsoft.com/dotnet/api/system.object.tostring\n[91]: Where.md\n[92]: Where_1.md\n[93]: https://maxtoroq.github.io/DbExtensions/docs/7/SqlSet.html"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ResultType.md",
    "content": "SqlSet.ResultType Property\n==========================\nThe type of objects this set returns. This property can be null.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Type? ResultType { get; }\n```\n\n#### Property Value\n[Type][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.type\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select.md",
    "content": "SqlSet.Select(SqlSet.OperatorStringHandler) Method\n==================================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| **Select(OperatorStringHandler)**                                              | Projects each element of the set into a new form. |\n| [Select(String)][2]                                                            | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][3]                                       | Projects each element of the set into a new form. |\n| [Select(String, Type)][4]                                                      | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][5]                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][6]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Select(\n\tref OperatorStringHandler columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns to select.\n\n#### Return Value\n[SqlSet][9]  \nA new [SqlSet][9].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select_2.md\n[3]: Select_1.md\n[4]: Select_3.md\n[5]: Select__1.md\n[6]: Select__1_2.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select_1.md",
    "content": "SqlSet.Select(SqlSet.OperatorStringHandler, Type) Method\n========================================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                            | Projects each element of the set into a new form. |\n| **Select(OperatorStringHandler, Type)**                                        | Projects each element of the set into a new form. |\n| [Select(String, Type)][4]                                                      | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][5]                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][6]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Select(\n\tref OperatorStringHandler columnList,\n\tType resultType\n)\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns that maps to properties on *resultType*.\n\n##### *resultType*  [Type][9]\nThe type that *columnList* maps to.\n\n#### Return Value\n[SqlSet][10]  \nA new [SqlSet][10].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_3.md\n[5]: Select__1.md\n[6]: Select__1_2.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: https://learn.microsoft.com/dotnet/api/system.type\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select_2.md",
    "content": "SqlSet.Select(String) Method\n============================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| **Select(String)**                                                             | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][3]                                       | Projects each element of the set into a new form. |\n| [Select(String, Type)][4]                                                      | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][5]                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][6]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Select(\n\tstring columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  [String][9]\nThe list of columns to select.\n\n#### Return Value\n[SqlSet][10]  \nA new [SqlSet][10].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_1.md\n[4]: Select_3.md\n[5]: Select__1.md\n[6]: Select__1_2.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: https://learn.microsoft.com/dotnet/api/system.string\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select_3.md",
    "content": "SqlSet.Select(String, Type) Method\n==================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                            | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][4]                                       | Projects each element of the set into a new form. |\n| **Select(String, Type)**                                                       | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][5]                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][6]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Select(\n\tstring columnList,\n\tType resultType\n)\n```\n\n#### Parameters\n\n##### *columnList*  [String][9]\nThe list of columns that maps to properties on *resultType*.\n\n##### *resultType*  [Type][10]\nThe type that *columnList* maps to.\n\n#### Return Value\n[SqlSet][11]  \nA new [SqlSet][11].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][11]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_1.md\n[5]: Select__1.md\n[6]: Select__1_2.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: https://learn.microsoft.com/dotnet/api/system.string\n[10]: https://learn.microsoft.com/dotnet/api/system.type\n[11]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select__1.md",
    "content": "SqlSet.Select&lt;TResult>(SqlSet.OperatorStringHandler) Method\n==============================================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                            | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][4]                                       | Projects each element of the set into a new form. |\n| [Select(String, Type)][5]                                                      | Projects each element of the set into a new form. |\n| **Select&lt;TResult>(OperatorStringHandler)**                                  | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][6]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Select<TResult>(\n\tref OperatorStringHandler columnList\n)\n\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns that maps to properties on TResult.\n\n#### Type Parameters\n\n##### *TResult*\nThe type that *columnList* maps to.\n\n#### Return Value\n[SqlSet][9]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][9].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_1.md\n[5]: Select_3.md\n[6]: Select__1_2.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: ../SqlSet_1/README.md\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select__1_1.md",
    "content": "SqlSet.Select&lt;TResult>(SqlSet.OperatorStringHandler, Func&lt;DbDataReader, TResult>) Method\n==============================================================================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                          | Description                                       |\n| ----------------------------------------------------------------------------- | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                            | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                           | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][4]                                      | Projects each element of the set into a new form. |\n| [Select(String, Type)][5]                                                     | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][6]                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][7]                                               | Projects each element of the set into a new form. |\n| **Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)** | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]               | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Select<TResult>(\n\tref OperatorStringHandler columnList,\n\tFunc<DbDataReader, TResult> mapper\n)\n\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns that are used by *mapper*.\n\n##### *mapper*  [Func][9]&lt;[DbDataReader][10], **TResult**>\nA custom mapper function that creates TResult instances from the rows in the set.\n\n#### Type Parameters\n\n##### *TResult*\nThe type that *mapper* returns.\n\n#### Return Value\n[SqlSet][11]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][11].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][12]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_1.md\n[5]: Select_3.md\n[6]: Select__1.md\n[7]: Select__1_2.md\n[8]: Select__1_3.md\n[9]: https://learn.microsoft.com/dotnet/api/system.func-2\n[10]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[11]: ../SqlSet_1/README.md\n[12]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select__1_2.md",
    "content": "SqlSet.Select&lt;TResult>(String) Method\n========================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                            | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][4]                                       | Projects each element of the set into a new form. |\n| [Select(String, Type)][5]                                                      | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][6]                                 | Projects each element of the set into a new form. |\n| **Select&lt;TResult>(String)**                                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][7] | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][8]                | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Select<TResult>(\n\tstring columnList\n)\n\n```\n\n#### Parameters\n\n##### *columnList*  [String][9]\nThe list of columns that maps to properties on TResult.\n\n#### Type Parameters\n\n##### *TResult*\nThe type that *columnList* maps to.\n\n#### Return Value\n[SqlSet][10]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][10].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][11]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_1.md\n[5]: Select_3.md\n[6]: Select__1.md\n[7]: Select__1_1.md\n[8]: Select__1_3.md\n[9]: https://learn.microsoft.com/dotnet/api/system.string\n[10]: ../SqlSet_1/README.md\n[11]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Select__1_3.md",
    "content": "SqlSet.Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>) Method\n========================================================================\nProjects each element of the set into a new form.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                           | Description                                       |\n| ------------------------------------------------------------------------------ | ------------------------------------------------- |\n| [Select(OperatorStringHandler)][2]                                             | Projects each element of the set into a new form. |\n| [Select(String)][3]                                                            | Projects each element of the set into a new form. |\n| [Select(OperatorStringHandler, Type)][4]                                       | Projects each element of the set into a new form. |\n| [Select(String, Type)][5]                                                      | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler)][6]                                 | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(String)][7]                                                | Projects each element of the set into a new form. |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][8] | Projects each element of the set into a new form. |\n| **Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)**                 | Projects each element of the set into a new form. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Select<TResult>(\n\tstring columnList,\n\tFunc<DbDataReader, TResult> mapper\n)\n\n```\n\n#### Parameters\n\n##### *columnList*  [String][9]\nThe list of columns that are used by *mapper*.\n\n##### *mapper*  [Func][10]&lt;[DbDataReader][11], **TResult**>\nA custom mapper function that creates TResult instances from the rows in the set.\n\n#### Type Parameters\n\n##### *TResult*\nThe type that *mapper* returns.\n\n#### Return Value\n[SqlSet][12]&lt;**TResult**>  \nA new [SqlSet&lt;TResult>][12].\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][13]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Select.md\n[3]: Select_2.md\n[4]: Select_1.md\n[5]: Select_3.md\n[6]: Select__1.md\n[7]: Select__1_2.md\n[8]: Select__1_1.md\n[9]: https://learn.microsoft.com/dotnet/api/system.string\n[10]: https://learn.microsoft.com/dotnet/api/system.func-2\n[11]: https://learn.microsoft.com/dotnet/api/system.data.common.dbdatareader\n[12]: ../SqlSet_1/README.md\n[13]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Single.md",
    "content": "SqlSet.Single Method\n====================\nThe single element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                                                                                             |\n| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| **Single()**                       | The single element of the set.                                                                                                          |\n| [Single(OperatorStringHandler)][2] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [Single(String)][3]                | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic Object Single()\n```\n\n#### Return Value\n[Object][4]  \nThe single element of the set.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                    |\n| ------------------------------ | ------------------------------------------------------------ |\n| [InvalidOperationException][5] | The set contains more than one element.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single_1.md\n[3]: Single_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleAsync.md",
    "content": "SqlSet.SingleAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n==========================================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                                                                             |\n| --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleAsync(CancellationToken)][2]                       | The single element of the set.                                                                                                          |\n| **SingleAsync(OperatorStringHandler, CancellationToken)** | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [SingleAsync(String, CancellationToken)][3]               | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][8] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync_2.md\n[3]: SingleAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleAsync_1.md",
    "content": "SqlSet.SingleAsync(String, CancellationToken) Method\n====================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                             |\n| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleAsync(CancellationToken)][2]                        | The single element of the set.                                                                                                          |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][3] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| **SingleAsync(String, CancellationToken)**                 | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Object][8]>  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][9] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][10]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync_2.md\n[3]: SingleAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[10]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleAsync_2.md",
    "content": "SqlSet.SingleAsync(CancellationToken) Method\n============================================\nThe single element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                             |\n| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleAsync(CancellationToken)**                         | The single element of the set.                                                                                                          |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][2] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [SingleAsync(String, CancellationToken)][3]                | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe single element of the set.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                    |\n| ------------------------------ | ------------------------------------------------------------ |\n| [InvalidOperationException][8] | The set contains more than one element.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync.md\n[3]: SingleAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefault.md",
    "content": "SqlSet.SingleOrDefault Method\n=============================\nReturns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                                                                                                                                              |\n| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleOrDefault()**                       | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][2] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][3]                | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? SingleOrDefault()\n```\n\n#### Return Value\n[Object][4]  \nThe single element of the set, or a default value if the set contains no elements.\n\nExceptions\n----------\n\n| Exception                      | Condition                               |\n| ------------------------------ | --------------------------------------- |\n| [InvalidOperationException][5] | The set contains more than one element. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault_1.md\n[3]: SingleOrDefault_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefaultAsync.md",
    "content": "SqlSet.SingleOrDefaultAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n===================================================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefaultAsync(CancellationToken)][2]                       | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| **SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)** | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][3]               | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleOrDefaultAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync_2.md\n[3]: SingleOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefaultAsync_1.md",
    "content": "SqlSet.SingleOrDefaultAsync(String, CancellationToken) Method\n=============================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefaultAsync(CancellationToken)][2]                        | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][3] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| **SingleOrDefaultAsync(String, CancellationToken)**                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleOrDefaultAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[Object][8]>  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync_2.md\n[3]: SingleOrDefaultAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: https://learn.microsoft.com/dotnet/api/system.object\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefaultAsync_2.md",
    "content": "SqlSet.SingleOrDefaultAsync(CancellationToken) Method\n=====================================================\nReturns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleOrDefaultAsync(CancellationToken)**                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][2] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][3]                | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object> SingleOrDefaultAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Object][7]>  \nThe single element of the set, or a default value if the set contains no elements.\n\nExceptions\n----------\n\n| Exception                      | Condition                               |\n| ------------------------------ | --------------------------------------- |\n| [InvalidOperationException][8] | The set contains more than one element. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][9]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync.md\n[3]: SingleOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.object\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[9]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefault_1.md",
    "content": "SqlSet.SingleOrDefault(SqlSet.OperatorStringHandler) Method\n===========================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                                                                                                              |\n| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefault()][2]                     | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| **SingleOrDefault(OperatorStringHandler)** | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][3]               | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? SingleOrDefault(\n\tref OperatorStringHandler? predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][4]  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault.md\n[3]: SingleOrDefault_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/SingleOrDefault_2.md",
    "content": "SqlSet.SingleOrDefault(String) Method\n=====================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                                                                                                                                              |\n| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefault()][2]                      | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][3] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| **SingleOrDefault(String)**                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic Object? SingleOrDefault(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][5]  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault.md\n[3]: SingleOrDefault_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Single_1.md",
    "content": "SqlSet.Single(SqlSet.OperatorStringHandler) Method\n==================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                                                                             |\n| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [Single()][2]                     | The single element of the set.                                                                                                          |\n| **Single(OperatorStringHandler)** | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [Single(String)][3]               | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic Object Single(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][4]  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][5] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single.md\n[3]: Single_2.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Single_2.md",
    "content": "SqlSet.Single(String) Method\n============================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                                                                                             |\n| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [Single()][2]                      | The single element of the set.                                                                                                          |\n| [Single(OperatorStringHandler)][3] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| **Single(String)**                 | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic Object Single(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[Object][5]  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][6] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single.md\n[3]: Single_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Skip.md",
    "content": "SqlSet.Skip Method\n==================\nBypasses a specified number of elements in the set and then returns the remaining elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet Skip(\n\tint count\n)\n```\n\n#### Parameters\n\n##### *count*  [Int32][2]\nThe number of elements to skip before returning the remaining elements.\n\n#### Return Value\n[SqlSet][3]  \nA new [SqlSet][3] that contains the elements that occur after the specified index in the current set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Take.md",
    "content": "SqlSet.Take Method\n==================\nReturns a specified number of contiguous elements from the start of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet Take(\n\tint count\n)\n```\n\n#### Parameters\n\n##### *count*  [Int32][2]\nThe number of elements to return.\n\n#### Return Value\n[SqlSet][3]  \nA new [SqlSet][3] that contains the specified number of elements from the start of the current set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ToArray.md",
    "content": "SqlSet.ToArray Method\n=====================\nCreates an array from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic Object[] ToArray()\n```\n\n#### Return Value\n[Object][2][]  \nAn array that contains the elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ToArrayAsync.md",
    "content": "SqlSet.ToArrayAsync Method\n==========================\nCreates an array from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<Object[]> ToArrayAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[ValueTask][4]&lt;[Object][5][]>  \nAn array that contains the elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ToList.md",
    "content": "SqlSet.ToList Method\n====================\nCreates a [List&lt;T>][1] from the set.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic List<Object> ToList()\n```\n\n#### Return Value\n[List][1]&lt;[Object][3]>  \nA [List&lt;T>][1] that contains elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ToListAsync.md",
    "content": "SqlSet.ToListAsync Method\n=========================\nCreates a [List&lt;T>][1] from the set.\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<List<Object>> ToListAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[List][1]&lt;[Object][6]>>  \nA [List&lt;T>][1] that contains elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][7]  \n[DbExtensions Namespace][2]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[2]: ../README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.object\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/ToString.md",
    "content": "SqlSet.ToString Method\n======================\nReturns the SQL query of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic override string ToString()\n```\n\n#### Return Value\n[String][2]  \nThe SQL query of the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Where.md",
    "content": "SqlSet.Where(SqlSet.OperatorStringHandler) Method\n=================================================\nFilters the set based on a predicate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                           |\n| -------------------------------- | ------------------------------------- |\n| **Where(OperatorStringHandler)** | Filters the set based on a predicate. |\n| [Where(String)][2]               | Filters the set based on a predicate. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Where(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[SqlSet][3]  \nA new [SqlSet][3] that contains elements from the current set that satisfy the condition.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Where_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet/Where_1.md",
    "content": "SqlSet.Where(String) Method\n===========================\nFilters the set based on a predicate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                           |\n| --------------------------------- | ------------------------------------- |\n| [Where(OperatorStringHandler)][2] | Filters the set based on a predicate. |\n| **Where(String)**                 | Filters the set based on a predicate. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet Where(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][3]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[SqlSet][4]  \nA new [SqlSet][4] that contains elements from the current set that satisfy the condition.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Where.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/AsAsyncEnumerable.md",
    "content": "SqlSet&lt;TResult>.AsAsyncEnumerable Method\n===========================================\nGets all TResult objects in the set. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerable<TResult> AsAsyncEnumerable()\n```\n\n#### Return Value\n[IAsyncEnumerable][2]&lt;[TResult][3]>  \nAll TResult objects in the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/AsEnumerable.md",
    "content": "SqlSet&lt;TResult>.AsEnumerable Method\n======================================\nGets all TResult objects in the set. The query is deferred-executed.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IEnumerable<TResult> AsEnumerable()\n```\n\n#### Return Value\n[IEnumerable][2]&lt;[TResult][3]>  \nAll TResult objects in the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Contains.md",
    "content": "SqlSet&lt;TResult>.Contains(TResult) Method\n===========================================\nChecks the existance of the *entity*, using the primary key value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                  | Description                                                        |\n| --------------------- | ------------------------------------------------------------------ |\n| [Contains(Object)][2] | Checks the existance of the *entity*, using the primary key value. |\n| **Contains(TResult)** | Checks the existance of the *entity*, using the primary key value. |\n\n\nSyntax\n------\n\n```csharp\npublic bool Contains(\n\tTResult entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [TResult][3]\nThe entity whose existance is to be checked.\n\n#### Return Value\n[Boolean][4]  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][5] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlSet/Contains.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.boolean\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/ContainsAsync.md",
    "content": "SqlSet&lt;TResult>.ContainsAsync(TResult, CancellationToken) Method\n===================================================================\nChecks the existance of the *entity*, using the primary key value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                          | Description                                                        |\n| --------------------------------------------- | ------------------------------------------------------------------ |\n| [ContainsAsync(Object, CancellationToken)][2] | Checks the existance of the *entity*, using the primary key value. |\n| **ContainsAsync(TResult, CancellationToken)** | Checks the existance of the *entity*, using the primary key value. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> ContainsAsync(\n\tTResult entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TResult][3]\nThe entity whose existance is to be checked.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[Boolean][7]>  \n`true` if the primary key value exists in the database; otherwise, `false`.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][8] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: ../SqlSet/ContainsAsync.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: https://learn.microsoft.com/dotnet/api/system.boolean\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Find.md",
    "content": "SqlSet&lt;TResult>.Find Method\n==============================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic TResult Find(\n\tObject id\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Return Value\n[TResult][3]  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][4] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FindAsync.md",
    "content": "SqlSet&lt;TResult>.FindAsync Method\n===================================\nGets the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FindAsync(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[TResult][6]>  \n The entity whose primary key matches the *id* parameter, or null if the *id* does not exist.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: README.md\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/First.md",
    "content": "SqlSet&lt;TResult>.First Method\n===============================\nReturns the first element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                |\n| --------------------------------- | -------------------------------------------------------------------------- |\n| **First()**                       | Returns the first element of the set.                                      |\n| [First(OperatorStringHandler)][2] | Returns the first element in the set that satisfies a specified condition. |\n| [First(String)][3]                | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult First()\n```\n\n#### Return Value\n[TResult][4]  \nThe first element in the set.\n\nExceptions\n----------\n\n| Exception                      | Condition         |\n| ------------------------------ | ----------------- |\n| [InvalidOperationException][5] | The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First_1.md\n[3]: First_2.md\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstAsync.md",
    "content": "SqlSet&lt;TResult>.FirstAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n=====================================================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                     | Description                                                                |\n| -------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [FirstAsync(CancellationToken)][2]                       | Returns the first element of the set.                                      |\n| **FirstAsync(OperatorStringHandler, CancellationToken)** | Returns the first element in the set that satisfies a specified condition. |\n| [FirstAsync(String, CancellationToken)][3]               | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][8] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync_2.md\n[3]: FirstAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstAsync_1.md",
    "content": "SqlSet&lt;TResult>.FirstAsync(String, CancellationToken) Method\n===============================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                |\n| --------------------------------------------------------- | -------------------------------------------------------------------------- |\n| [FirstAsync(CancellationToken)][2]                        | Returns the first element of the set.                                      |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][3] | Returns the first element in the set that satisfies a specified condition. |\n| **FirstAsync(String, CancellationToken)**                 | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[TResult][8]>  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][9] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync_2.md\n[3]: FirstAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: README.md\n[9]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstAsync_2.md",
    "content": "SqlSet&lt;TResult>.FirstAsync(CancellationToken) Method\n=======================================================\nReturns the first element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                |\n| --------------------------------------------------------- | -------------------------------------------------------------------------- |\n| **FirstAsync(CancellationToken)**                         | Returns the first element of the set.                                      |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][2] | Returns the first element in the set that satisfies a specified condition. |\n| [FirstAsync(String, CancellationToken)][3]                | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe first element in the set.\n\nExceptions\n----------\n\n| Exception                      | Condition         |\n| ------------------------------ | ----------------- |\n| [InvalidOperationException][8] | The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstAsync.md\n[3]: FirstAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefault.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefault Method\n========================================\nReturns the first element of the set, or a default value if the set contains no elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                     |\n| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| **FirstOrDefault()**                       | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefault(OperatorStringHandler)][2] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefault(String)][3]                | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult FirstOrDefault()\n```\n\n#### Return Value\n[TResult][4]  \nA default value if the set is empty; otherwise, the first element.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault_1.md\n[3]: FirstOrDefault_2.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefaultAsync.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefaultAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n==============================================================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                              | Description                                                                                                     |\n| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefaultAsync(CancellationToken)][2]                       | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| **FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)** | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefaultAsync(String, CancellationToken)][3]               | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstOrDefaultAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync_2.md\n[3]: FirstOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefaultAsync_1.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefaultAsync(String, CancellationToken) Method\n========================================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                     |\n| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefaultAsync(CancellationToken)][2]                        | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][3] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| **FirstOrDefaultAsync(String, CancellationToken)**                 | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstOrDefaultAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[TResult][8]>  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync_2.md\n[3]: FirstOrDefaultAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefaultAsync_2.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefaultAsync(CancellationToken) Method\n================================================================\nReturns the first element of the set, or a default value if the set contains no elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                     |\n| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| **FirstOrDefaultAsync(CancellationToken)**                         | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][2] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefaultAsync(String, CancellationToken)][3]                | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> FirstOrDefaultAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nA default value if the set is empty; otherwise, the first element.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefaultAsync.md\n[3]: FirstOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefault_1.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefault(SqlSet.OperatorStringHandler) Method\n======================================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                                                                                     |\n| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefault()][2]                     | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| **FirstOrDefault(OperatorStringHandler)** | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| [FirstOrDefault(String)][3]               | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult FirstOrDefault(\n\tref OperatorStringHandler? predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][4]  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault.md\n[3]: FirstOrDefault_2.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/FirstOrDefault_2.md",
    "content": "SqlSet&lt;TResult>.FirstOrDefault(String) Method\n================================================\nReturns the first element of the set that satisfies a condition or a default value if no such element is found.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                     |\n| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |\n| [FirstOrDefault()][2]                      | Returns the first element of the set, or a default value if the set contains no elements.                       |\n| [FirstOrDefault(OperatorStringHandler)][3] | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n| **FirstOrDefault(String)**                 | Returns the first element of the set that satisfies a condition or a default value if no such element is found. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult FirstOrDefault(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][5]  \n A default value if the set is empty or if no element passes the test specified by *predicate*; otherwise, the first element that passes the test specified by *predicate*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: FirstOrDefault.md\n[3]: FirstOrDefault_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/First_1.md",
    "content": "SqlSet&lt;TResult>.First(SqlSet.OperatorStringHandler) Method\n=============================================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                                                                |\n| -------------------------------- | -------------------------------------------------------------------------- |\n| [First()][2]                     | Returns the first element of the set.                                      |\n| **First(OperatorStringHandler)** | Returns the first element in the set that satisfies a specified condition. |\n| [First(String)][3]               | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult First(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][4]  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][5] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First.md\n[3]: First_2.md\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/First_2.md",
    "content": "SqlSet&lt;TResult>.First(String) Method\n=======================================\nReturns the first element in the set that satisfies a specified condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                |\n| --------------------------------- | -------------------------------------------------------------------------- |\n| [First()][2]                      | Returns the first element of the set.                                      |\n| [First(OperatorStringHandler)][3] | Returns the first element in the set that satisfies a specified condition. |\n| **First(String)**                 | Returns the first element in the set that satisfies a specified condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult First(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][5]  \nThe first element in the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                               |\n| ------------------------------ | ----------------------------------------------------------------------- |\n| [InvalidOperationException][6] | No element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: First.md\n[3]: First_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/GetAsyncEnumerator.md",
    "content": "SqlSet&lt;TResult>.GetAsyncEnumerator Method\n============================================\nReturns an async enumerator that iterates through the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IAsyncEnumerator<TResult> GetAsyncEnumerator(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[IAsyncEnumerator][4]&lt;[TResult][5]>  \nA [IAsyncEnumerator&lt;T>][4] for the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerator-1\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/GetEnumerator.md",
    "content": "SqlSet&lt;TResult>.GetEnumerator Method\n=======================================\nReturns an enumerator that iterates through the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic IEnumerator<TResult> GetEnumerator()\n```\n\n#### Return Value\n[IEnumerator][2]&lt;[TResult][3]>  \nA [IEnumerator&lt;T>][2] for the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Include.md",
    "content": "SqlSet&lt;TResult>.Include(Func&lt;TResult, Object>, String) Method\n===================================================================\nSpecifies the related objects to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                          | Description                                                    |\n| --------------------------------------------- | -------------------------------------------------------------- |\n| [Include(String)][2]                          | Specifies the related objects to include in the query results. |\n| **Include(Func&lt;TResult, Object>, String)** | Specifies the related objects to include in the query results. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Include(\n\tFunc<TResult, Object?> path,\n\tstring pathExpr = \"\"\n)\n```\n\n#### Parameters\n\n##### *path*  [Func][3]&lt;[TResult][4], [Object][5]>\nLambda expression that returns the deepest related object to return in the query results.\n\n##### *pathExpr*  [String][6]  (Optional)\nThis argument is compiler generated.\n\n#### Return Value\n[SqlSet][4]&lt;[TResult][4]>  \nA new [SqlSet&lt;TResult>][4] with the defined query path.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Include_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.func-2\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.object\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/IncludeMany.md",
    "content": "SqlSet&lt;TResult>.IncludeMany(String, Func&lt;SqlSet, SqlSet>) Method\n======================================================================\nSpecifies which collections to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                                                                                 | Description                                                  |\n| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------ |\n| **IncludeMany(String, Func&lt;SqlSet, SqlSet>)**                                                                                     | Specifies which collections to include in the query results. |\n| [IncludeMany&lt;TElement>(Func&lt;TResult, ICollection&lt;TElement>>, Func&lt;SqlSet&lt;TElement>, SqlSet&lt;TElement>>, String)][2] | Specifies which collections to include in the query results. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> IncludeMany(\n\tstring path,\n\tFunc<SqlSet, SqlSet>? manySetup = null\n)\n```\n\n#### Parameters\n\n##### *path*  [String][3]\nDot-separated list of one or more related objects that ends with the collection to load.\n\n##### *manySetup*  [Func][4]&lt;[SqlSet][5], [SqlSet][5]>  (Optional)\nA function to customize how the collection is loaded.\n\n#### Return Value\n[SqlSet][6]&lt;[TResult][6]>  \nA new [SqlSet&lt;TResult>][6].\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: IncludeMany__1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: https://learn.microsoft.com/dotnet/api/system.func-2\n[5]: ../SqlSet/README.md\n[6]: README.md\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/IncludeMany__1.md",
    "content": "SqlSet&lt;TResult>.IncludeMany&lt;TElement>(Func&lt;TResult, ICollection&lt;TElement>>, Func&lt;SqlSet&lt;TElement>, SqlSet&lt;TElement>>, String) Method\n=========================================================================================================================================================\nSpecifies which collections to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                                                                                | Description                                                  |\n| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |\n| [IncludeMany(String, Func&lt;SqlSet, SqlSet>)][2]                                                                                   | Specifies which collections to include in the query results. |\n| **IncludeMany&lt;TElement>(Func&lt;TResult, ICollection&lt;TElement>>, Func&lt;SqlSet&lt;TElement>, SqlSet&lt;TElement>>, String)** | Specifies which collections to include in the query results. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> IncludeMany<TElement>(\n\tFunc<TResult, ICollection<TElement>?> path,\n\tFunc<SqlSet<TElement>, SqlSet<TElement>>? manySetup = null,\n\tstring pathExpr = \"\"\n)\n\n```\n\n#### Parameters\n\n##### *path*  [Func][3]&lt;[TResult][4], [ICollection][5]&lt;**TElement**>>\nLambda expression that returns the collection to load.\n\n##### *manySetup*  [Func][3]&lt;[SqlSet][4]&lt;**TElement**>, [SqlSet][4]&lt;**TElement**>>  (Optional)\nA function to customize how the collection is loaded.\n\n##### *pathExpr*  [String][6]  (Optional)\nThis argument is compiler generated.\n\n#### Type Parameters\n\n##### *TElement*\nThe type of objects the collection holds.\n\n#### Return Value\n[SqlSet][4]&lt;[TResult][4]>  \nA new [SqlSet&lt;TResult>][4].\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][7] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: IncludeMany.md\n[3]: https://learn.microsoft.com/dotnet/api/system.func-2\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1\n[6]: https://learn.microsoft.com/dotnet/api/system.string\n[7]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Include_1.md",
    "content": "SqlSet&lt;TResult>.Include(String) Method\n=========================================\nSpecifies the related objects to include in the query results.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                           | Description                                                    |\n| ---------------------------------------------- | -------------------------------------------------------------- |\n| **Include(String)**                            | Specifies the related objects to include in the query results. |\n| [Include(Func&lt;TResult, Object>, String)][2] | Specifies the related objects to include in the query results. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Include(\n\tstring path\n)\n```\n\n#### Parameters\n\n##### *path*  [String][3]\nDot-separated list of related objects to return in the query results.\n\n#### Return Value\n[SqlSet][4]&lt;[TResult][4]>  \nA new [SqlSet&lt;TResult>][4] with the defined query path.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                         |\n| ------------------------------ | --------------------------------------------------------------------------------- |\n| [InvalidOperationException][5] | This method can only be used on sets where the result type is an annotated class. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Include.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/OrderBy.md",
    "content": "SqlSet&lt;TResult>.OrderBy(SqlSet.OperatorStringHandler) Method\n===============================================================\nSorts the elements of the set according to the *columnList*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                  |\n| ---------------------------------- | ------------------------------------------------------------ |\n| **OrderBy(OperatorStringHandler)** | Sorts the elements of the set according to the *columnList*. |\n| [OrderBy(String)][2]               | Sorts the elements of the set according to the *columnList*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> OrderBy(\n\tref OperatorStringHandler columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  OperatorStringHandler\nThe list of columns to base the sort on.\n\n#### Return Value\n[SqlSet][3]&lt;[TResult][3]>  \nA new [SqlSet&lt;TResult>][3] whose elements are sorted according to *columnList*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OrderBy_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/OrderBy_1.md",
    "content": "SqlSet&lt;TResult>.OrderBy(String) Method\n=========================================\nSorts the elements of the set according to the *columnList*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                | Description                                                  |\n| ----------------------------------- | ------------------------------------------------------------ |\n| [OrderBy(OperatorStringHandler)][2] | Sorts the elements of the set according to the *columnList*. |\n| **OrderBy(String)**                 | Sorts the elements of the set according to the *columnList*. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> OrderBy(\n\tstring columnList\n)\n```\n\n#### Parameters\n\n##### *columnList*  [String][3]\nThe list of columns to base the sort on.\n\n#### Return Value\n[SqlSet][4]&lt;[TResult][4]>  \nA new [SqlSet&lt;TResult>][4] whose elements are sorted according to *columnList*.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: OrderBy.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/README.md",
    "content": "SqlSet&lt;TResult> Class\n========================\nRepresents an immutable, connected SQL query that maps to TResult objects. This class cannot be instantiated, to get an instance use one of the [Database.From&lt;TResult>(String)][1] or [Database.FromQuery&lt;TResult>(SqlBuilder)][2] overloads.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][3]  \n  [DbExtensions.SqlSet][4]  \n    **DbExtensions.SqlSet&lt;TResult>**  \n      [DbExtensions.SqlTable&lt;TEntity>][5]  \n  \n**Namespace:** [DbExtensions][6]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic class SqlSet<TResult> : SqlSet\n\n```\n\n#### Type Parameters\n\n##### *TResult*\nThe type of objects to map the results to.\n\nThe **SqlSet&lt;TResult>** type exposes the following members.\n\n\nProperties\n----------\n\n| Name            | Description                                                                                        |\n| --------------- | -------------------------------------------------------------------------------------------------- |\n| [Database][7]   | The [Database][8] this set is connected to. <br/>(Inherited from [SqlSet][4])                      |\n| [ResultType][9] | The type of objects this set returns. This property can be null. <br/>(Inherited from [SqlSet][4]) |\n\n\nMethods\n-------\n\n| Name                                                                                                                                  | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [All(OperatorStringHandler)][10]                                                                                                      | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                        |\n| [All(String)][11]                                                                                                                     | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                        |\n| [AllAsync(OperatorStringHandler, CancellationToken)][12]                                                                              | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                        |\n| [AllAsync(String, CancellationToken)][13]                                                                                             | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                        |\n| [Any()][14]                                                                                                                           | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Any(OperatorStringHandler)][15]                                                                                                      | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                       |\n| [Any(String)][16]                                                                                                                     | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                       |\n| [AnyAsync(CancellationToken)][17]                                                                                                     | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][18]                                                                              | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                       |\n| [AnyAsync(String, CancellationToken)][19]                                                                                             | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                       |\n| [AsAsyncEnumerable][20]                                                                                                               | Gets all TResult objects in the set. The query is deferred-executed.                                                                                                                                     |\n| [AsEnumerable][21]                                                                                                                    | Gets all TResult objects in the set. The query is deferred-executed.                                                                                                                                     |\n| [Cast(Type)][22]                                                                                                                      | Casts the elements of the set to the specified type. <br/>(Inherited from [SqlSet][4])                                                                                                                   |\n| [Cast&lt;TResult>()][23]                                                                                                              | Casts the elements of the set to the specified type. <br/>(Inherited from [SqlSet][4])                                                                                                                   |\n| [Contains(Object)][24]                                                                                                                | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                     |\n| [Contains(TResult)][25]                                                                                                               | Checks the existance of the *entity*, using the primary key value.                                                                                                                                       |\n| [ContainsAsync(Object, CancellationToken)][26]                                                                                        | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                     |\n| [ContainsAsync(TResult, CancellationToken)][27]                                                                                       | Checks the existance of the *entity*, using the primary key value.                                                                                                                                       |\n| [ContainsKey][28]                                                                                                                     | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                            |\n| [ContainsKeyAsync][29]                                                                                                                | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                            |\n| [Count()][30]                                                                                                                         | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [Count(OperatorStringHandler)][31]                                                                                                    | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                     |\n| [Count(String)][32]                                                                                                                   | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                     |\n| [CountAsync(CancellationToken)][33]                                                                                                   | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [CountAsync(OperatorStringHandler, CancellationToken)][34]                                                                            | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                     |\n| [CountAsync(String, CancellationToken)][35]                                                                                           | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                     |\n| [Find][36]                                                                                                                            | Gets the entity whose primary key matches the *id* parameter.                                                                                                                                            |\n| [FindAsync][37]                                                                                                                       | Gets the entity whose primary key matches the *id* parameter.                                                                                                                                            |\n| [First()][38]                                                                                                                         | Returns the first element of the set.                                                                                                                                                                    |\n| [First(OperatorStringHandler)][39]                                                                                                    | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [First(String)][40]                                                                                                                   | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstAsync(CancellationToken)][41]                                                                                                   | Returns the first element of the set.                                                                                                                                                                    |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][42]                                                                            | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstAsync(String, CancellationToken)][43]                                                                                           | Returns the first element in the set that satisfies a specified condition.                                                                                                                               |\n| [FirstOrDefault()][44]                                                                                                                | Returns the first element of the set, or a default value if the set contains no elements.                                                                                                                |\n| [FirstOrDefault(OperatorStringHandler)][45]                                                                                           | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefault(String)][46]                                                                                                          | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefaultAsync(CancellationToken)][47]                                                                                          | Returns the first element of the set, or a default value if the set contains no elements.                                                                                                                |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][48]                                                                   | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [FirstOrDefaultAsync(String, CancellationToken)][49]                                                                                  | Returns the first element of the set that satisfies a condition or a default value if no such element is found.                                                                                          |\n| [GetAsyncEnumerator][50]                                                                                                              | Returns an async enumerator that iterates through the set.                                                                                                                                               |\n| [GetDefiningQuery][51]                                                                                                                | Returns the SQL query that is the source of data for the set. <br/>(Inherited from [SqlSet][4])                                                                                                          |\n| [GetEnumerator][52]                                                                                                                   | Returns an enumerator that iterates through the set.                                                                                                                                                     |\n| [Include(String)][53]                                                                                                                 | Specifies the related objects to include in the query results.                                                                                                                                           |\n| [Include(Func&lt;TResult, Object>, String)][54]                                                                                       | Specifies the related objects to include in the query results.                                                                                                                                           |\n| [IncludeMany(String, Func&lt;SqlSet, SqlSet>)][55]                                                                                    | Specifies which collections to include in the query results.                                                                                                                                             |\n| [IncludeMany&lt;TElement>(Func&lt;TResult, ICollection&lt;TElement>>, Func&lt;SqlSet&lt;TElement>, SqlSet&lt;TElement>>, String)][56] | Specifies which collections to include in the query results.                                                                                                                                             |\n| [LongCount()][57]                                                                                                                     | Returns an [Int64][58] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                        |\n| [LongCount(OperatorStringHandler)][59]                                                                                                | Returns an [Int64][58] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                               |\n| [LongCount(String)][60]                                                                                                               | Returns an [Int64][58] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                               |\n| [LongCountAsync(CancellationToken)][61]                                                                                               | Returns an [Int64][58] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                        |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][62]                                                                        | Returns an [Int64][58] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                               |\n| [LongCountAsync(String, CancellationToken)][63]                                                                                       | Returns an [Int64][58] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                               |\n| [OrderBy(OperatorStringHandler)][64]                                                                                                  | Sorts the elements of the set according to the *columnList*.                                                                                                                                             |\n| [OrderBy(String)][65]                                                                                                                 | Sorts the elements of the set according to the *columnList*.                                                                                                                                             |\n| [Select(OperatorStringHandler, Type)][66]                                                                                             | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Select(String, Type)][67]                                                                                                            | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Select&lt;TResult>(OperatorStringHandler)][68]                                                                                       | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Select&lt;TResult>(String)][69]                                                                                                      | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][70]                                                       | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][71]                                                                      | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                      |\n| [Single()][72]                                                                                                                        | The single element of the set.                                                                                                                                                                           |\n| [Single(OperatorStringHandler)][73]                                                                                                   | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [Single(String)][74]                                                                                                                  | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleAsync(CancellationToken)][75]                                                                                                  | The single element of the set.                                                                                                                                                                           |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][76]                                                                           | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleAsync(String, CancellationToken)][77]                                                                                          | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.                                                                  |\n| [SingleOrDefault()][78]                                                                                                               | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][79]                                                                                          | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][80]                                                                                                         | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(CancellationToken)][81]                                                                                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][82]                                                                  | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][83]                                                                                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [Skip][84]                                                                                                                            | Bypasses a specified number of elements in the set and then returns the remaining elements.                                                                                                              |\n| [Take][85]                                                                                                                            | Returns a specified number of contiguous elements from the start of the set.                                                                                                                             |\n| [ToArray][86]                                                                                                                         | Creates an array from the set.                                                                                                                                                                           |\n| [ToArrayAsync][87]                                                                                                                    | Creates an array from the set.                                                                                                                                                                           |\n| [ToList][88]                                                                                                                          | Creates a List&lt;TResult> from the set.                                                                                                                                                                 |\n| [ToListAsync][89]                                                                                                                     | Creates a List&lt;TResult> from the set.                                                                                                                                                                 |\n| [ToString][90]                                                                                                                        | Returns the SQL query of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                      |\n| [Where(OperatorStringHandler)][91]                                                                                                    | Filters the set based on a predicate.                                                                                                                                                                    |\n| [Where(String)][92]                                                                                                                   | Filters the set based on a predicate.                                                                                                                                                                    |\n\n\nRemarks\n-------\nFor information on how to use SqlSet see [SqlSet Tutorial][93].\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][6]  \n\n[1]: ../Database/From__1.md\n[2]: ../Database/FromQuery__1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: ../SqlSet/README.md\n[5]: ../SqlTable_1/README.md\n[6]: ../README.md\n[7]: ../SqlSet/Database.md\n[8]: ../Database/README.md\n[9]: ../SqlSet/ResultType.md\n[10]: ../SqlSet/All.md\n[11]: ../SqlSet/All_1.md\n[12]: ../SqlSet/AllAsync.md\n[13]: ../SqlSet/AllAsync_1.md\n[14]: ../SqlSet/Any.md\n[15]: ../SqlSet/Any_1.md\n[16]: ../SqlSet/Any_2.md\n[17]: ../SqlSet/AnyAsync_2.md\n[18]: ../SqlSet/AnyAsync.md\n[19]: ../SqlSet/AnyAsync_1.md\n[20]: AsAsyncEnumerable.md\n[21]: AsEnumerable.md\n[22]: ../SqlSet/Cast.md\n[23]: ../SqlSet/Cast__1.md\n[24]: ../SqlSet/Contains.md\n[25]: Contains.md\n[26]: ../SqlSet/ContainsAsync.md\n[27]: ContainsAsync.md\n[28]: ../SqlSet/ContainsKey.md\n[29]: ../SqlSet/ContainsKeyAsync.md\n[30]: ../SqlSet/Count.md\n[31]: ../SqlSet/Count_1.md\n[32]: ../SqlSet/Count_2.md\n[33]: ../SqlSet/CountAsync_2.md\n[34]: ../SqlSet/CountAsync.md\n[35]: ../SqlSet/CountAsync_1.md\n[36]: Find.md\n[37]: FindAsync.md\n[38]: First.md\n[39]: First_1.md\n[40]: First_2.md\n[41]: FirstAsync_2.md\n[42]: FirstAsync.md\n[43]: FirstAsync_1.md\n[44]: FirstOrDefault.md\n[45]: FirstOrDefault_1.md\n[46]: FirstOrDefault_2.md\n[47]: FirstOrDefaultAsync_2.md\n[48]: FirstOrDefaultAsync.md\n[49]: FirstOrDefaultAsync_1.md\n[50]: GetAsyncEnumerator.md\n[51]: ../SqlSet/GetDefiningQuery.md\n[52]: GetEnumerator.md\n[53]: Include_1.md\n[54]: Include.md\n[55]: IncludeMany.md\n[56]: IncludeMany__1.md\n[57]: ../SqlSet/LongCount.md\n[58]: https://learn.microsoft.com/dotnet/api/system.int64\n[59]: ../SqlSet/LongCount_1.md\n[60]: ../SqlSet/LongCount_2.md\n[61]: ../SqlSet/LongCountAsync_2.md\n[62]: ../SqlSet/LongCountAsync.md\n[63]: ../SqlSet/LongCountAsync_1.md\n[64]: OrderBy.md\n[65]: OrderBy_1.md\n[66]: ../SqlSet/Select_1.md\n[67]: ../SqlSet/Select_3.md\n[68]: ../SqlSet/Select__1.md\n[69]: ../SqlSet/Select__1_2.md\n[70]: ../SqlSet/Select__1_1.md\n[71]: ../SqlSet/Select__1_3.md\n[72]: Single.md\n[73]: Single_1.md\n[74]: Single_2.md\n[75]: SingleAsync_2.md\n[76]: SingleAsync.md\n[77]: SingleAsync_1.md\n[78]: SingleOrDefault.md\n[79]: SingleOrDefault_1.md\n[80]: SingleOrDefault_2.md\n[81]: SingleOrDefaultAsync_2.md\n[82]: SingleOrDefaultAsync.md\n[83]: SingleOrDefaultAsync_1.md\n[84]: Skip.md\n[85]: Take.md\n[86]: ToArray.md\n[87]: ToArrayAsync.md\n[88]: ToList.md\n[89]: ToListAsync.md\n[90]: ../SqlSet/ToString.md\n[91]: Where.md\n[92]: Where_1.md\n[93]: https://maxtoroq.github.io/DbExtensions/docs/7/SqlSet.html"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Single.md",
    "content": "SqlSet&lt;TResult>.Single Method\n================================\nThe single element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                                                                                             |\n| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| **Single()**                       | The single element of the set.                                                                                                          |\n| [Single(OperatorStringHandler)][2] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [Single(String)][3]                | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult Single()\n```\n\n#### Return Value\n[TResult][4]  \nThe single element of the set.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                    |\n| ------------------------------ | ------------------------------------------------------------ |\n| [InvalidOperationException][5] | The set contains more than one element.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single_1.md\n[3]: Single_2.md\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleAsync.md",
    "content": "SqlSet&lt;TResult>.SingleAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n======================================================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                      | Description                                                                                                                             |\n| --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleAsync(CancellationToken)][2]                       | The single element of the set.                                                                                                          |\n| **SingleAsync(OperatorStringHandler, CancellationToken)** | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [SingleAsync(String, CancellationToken)][3]               | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][8] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync_2.md\n[3]: SingleAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleAsync_1.md",
    "content": "SqlSet&lt;TResult>.SingleAsync(String, CancellationToken) Method\n================================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                             |\n| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleAsync(CancellationToken)][2]                        | The single element of the set.                                                                                                          |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][3] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| **SingleAsync(String, CancellationToken)**                 | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[TResult][8]>  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][9] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync_2.md\n[3]: SingleAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: README.md\n[9]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleAsync_2.md",
    "content": "SqlSet&lt;TResult>.SingleAsync(CancellationToken) Method\n========================================================\nThe single element of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                       | Description                                                                                                                             |\n| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleAsync(CancellationToken)**                         | The single element of the set.                                                                                                          |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][2] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [SingleAsync(String, CancellationToken)][3]                | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe single element of the set.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                    |\n| ------------------------------ | ------------------------------------------------------------ |\n| [InvalidOperationException][8] | The set contains more than one element.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleAsync.md\n[3]: SingleAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefault.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefault Method\n=========================================\nReturns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                                                                                                                                              |\n| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleOrDefault()**                       | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][2] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][3]                | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult SingleOrDefault()\n```\n\n#### Return Value\n[TResult][4]  \nThe single element of the set, or a default value if the set contains no elements.\n\nExceptions\n----------\n\n| Exception                      | Condition                               |\n| ------------------------------ | --------------------------------------- |\n| [InvalidOperationException][5] | The set contains more than one element. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault_1.md\n[3]: SingleOrDefault_2.md\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefaultAsync.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefaultAsync(SqlSet.OperatorStringHandler, CancellationToken) Method\n===============================================================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                               | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefaultAsync(CancellationToken)][2]                       | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| **SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)** | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][3]               | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleOrDefaultAsync(\n\tOperatorStringHandler predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync_2.md\n[3]: SingleOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefaultAsync_1.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefaultAsync(String, CancellationToken) Method\n=========================================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefaultAsync(CancellationToken)][2]                        | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][3] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| **SingleOrDefaultAsync(String, CancellationToken)**                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleOrDefaultAsync(\n\tstring predicate,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]&lt;[TResult][8]>  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync_2.md\n[3]: SingleOrDefaultAsync.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefaultAsync_2.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefaultAsync(CancellationToken) Method\n=================================================================\nReturns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                                | Description                                                                                                                                                                                              |\n| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **SingleOrDefaultAsync(CancellationToken)**                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][2] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefaultAsync(String, CancellationToken)][3]                | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult> SingleOrDefaultAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]&lt;[TResult][7]>  \nThe single element of the set, or a default value if the set contains no elements.\n\nExceptions\n----------\n\n| Exception                      | Condition                               |\n| ------------------------------ | --------------------------------------- |\n| [InvalidOperationException][8] | The set contains more than one element. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefaultAsync.md\n[3]: SingleOrDefaultAsync_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[7]: README.md\n[8]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefault_1.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefault(SqlSet.OperatorStringHandler) Method\n=======================================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                       | Description                                                                                                                                                                                              |\n| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefault()][2]                     | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| **SingleOrDefault(OperatorStringHandler)** | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| [SingleOrDefault(String)][3]               | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult SingleOrDefault(\n\tref OperatorStringHandler? predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][4]  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault.md\n[3]: SingleOrDefault_2.md\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/SingleOrDefault_2.md",
    "content": "SqlSet&lt;TResult>.SingleOrDefault(String) Method\n=================================================\nReturns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                        | Description                                                                                                                                                                                              |\n| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [SingleOrDefault()][2]                      | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.                                               |\n| [SingleOrDefault(OperatorStringHandler)][3] | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n| **SingleOrDefault(String)**                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult SingleOrDefault(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][5]  \nThe single element of the set that satisfies the condition, or a default value if no such element is found.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: SingleOrDefault.md\n[3]: SingleOrDefault_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Single_1.md",
    "content": "SqlSet&lt;TResult>.Single(SqlSet.OperatorStringHandler) Method\n==============================================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                                                                                                                             |\n| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [Single()][2]                     | The single element of the set.                                                                                                          |\n| **Single(OperatorStringHandler)** | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| [Single(String)][3]               | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult Single(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][4]  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][5] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single.md\n[3]: Single_2.md\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Single_2.md",
    "content": "SqlSet&lt;TResult>.Single(String) Method\n========================================\nReturns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                               | Description                                                                                                                             |\n| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| [Single()][2]                      | The single element of the set.                                                                                                          |\n| [Single(OperatorStringHandler)][3] | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n| **Single(String)**                 | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. |\n\n\nSyntax\n------\n\n```csharp\npublic TResult Single(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][4]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[TResult][5]  \nThe single element of the set that passes the test in the specified *predicate*.\n\nExceptions\n----------\n\n| Exception                      | Condition                                                                                                                                |\n| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [InvalidOperationException][6] | No element satisfies the condition in *predicate*.-or-More than one element satisfies the condition in *predicate*.-or-The set is empty. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Single.md\n[3]: Single_1.md\n[4]: https://learn.microsoft.com/dotnet/api/system.string\n[5]: README.md\n[6]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Skip.md",
    "content": "SqlSet&lt;TResult>.Skip Method\n==============================\nBypasses a specified number of elements in the set and then returns the remaining elements.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Skip(\n\tint count\n)\n```\n\n#### Parameters\n\n##### *count*  [Int32][2]\nThe number of elements to skip before returning the remaining elements.\n\n#### Return Value\n[SqlSet][3]&lt;[TResult][3]>  \nA new [SqlSet&lt;TResult>][3] that contains the elements that occur after the specified index in the current set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Take.md",
    "content": "SqlSet&lt;TResult>.Take Method\n==============================\nReturns a specified number of contiguous elements from the start of the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Take(\n\tint count\n)\n```\n\n#### Parameters\n\n##### *count*  [Int32][2]\nThe number of elements to return.\n\n#### Return Value\n[SqlSet][3]&lt;[TResult][3]>  \nA new [SqlSet&lt;TResult>][3] that contains the specified number of elements from the start of the current set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.int32\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/ToArray.md",
    "content": "SqlSet&lt;TResult>.ToArray Method\n=================================\nCreates an array from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic TResult[] ToArray()\n```\n\n#### Return Value\n[TResult][2][]  \nAn array that contains the elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/ToArrayAsync.md",
    "content": "SqlSet&lt;TResult>.ToArrayAsync Method\n======================================\nCreates an array from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<TResult[]> ToArrayAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[ValueTask][4]&lt;[TResult][5][]>  \nAn array that contains the elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/ToList.md",
    "content": "SqlSet&lt;TResult>.ToList Method\n================================\nCreates a List&lt;TResult> from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic List<TResult> ToList()\n```\n\n#### Return Value\n[List][2]&lt;[TResult][3]>  \nA List&lt;TResult> that contains elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/ToListAsync.md",
    "content": "SqlSet&lt;TResult>.ToListAsync Method\n=====================================\nCreates a List&lt;TResult> from the set.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<List<TResult>> ToListAsync(\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *cancellationToken*  [CancellationToken][2]  (Optional)\nThe [CancellationToken][2] to monitor for cancellation requests. The default is [None][3].\n\n#### Return Value\n[ValueTask][4]&lt;[List][5]&lt;[TResult][6]>>  \nA List&lt;TResult> that contains elements from the set.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[5]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Where.md",
    "content": "SqlSet&lt;TResult>.Where(SqlSet.OperatorStringHandler) Method\n=============================================================\nFilters the set based on a predicate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                             | Description                           |\n| -------------------------------- | ------------------------------------- |\n| **Where(OperatorStringHandler)** | Filters the set based on a predicate. |\n| [Where(String)][2]               | Filters the set based on a predicate. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Where(\n\tref OperatorStringHandler predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  OperatorStringHandler\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[SqlSet][3]&lt;[TResult][3]>  \nA new [SqlSet&lt;TResult>][3] that contains elements from the current set that satisfy the condition.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Where_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlSet_1/Where_1.md",
    "content": "SqlSet&lt;TResult>.Where(String) Method\n=======================================\nFilters the set based on a predicate.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                              | Description                           |\n| --------------------------------- | ------------------------------------- |\n| [Where(OperatorStringHandler)][2] | Filters the set based on a predicate. |\n| **Where(String)**                 | Filters the set based on a predicate. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlSet<TResult> Where(\n\tstring predicate\n)\n```\n\n#### Parameters\n\n##### *predicate*  [String][3]\nA SQL expression to test each row for a condition.\n\n#### Return Value\n[SqlSet][4]&lt;[TResult][4]>  \nA new [SqlSet&lt;TResult>][4] that contains elements from the current set that satisfy the condition.\n\nSee Also\n--------\n\n#### Reference\n[SqlSet&lt;TResult> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Where.md\n[3]: https://learn.microsoft.com/dotnet/api/system.string\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Add.md",
    "content": "SqlTable.Add Method\n===================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic void Add(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/AddAsync.md",
    "content": "SqlTable.AddAsync Method\n========================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/AddRange.md",
    "content": "SqlTable.AddRange(IEnumerable&lt;Object>) Method\n================================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                 | Description                                                                                                              |\n| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |\n| **AddRange(IEnumerable&lt;Object>)** | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| [AddRange(Object[])][2]              | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic void AddRange(\n\tIEnumerable<Object> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose INSERT commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/AddRangeAsync.md",
    "content": "SqlTable.AddRangeAsync(IEnumerable&lt;Object>, CancellationToken) Method\n========================================================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                         | Description                                                                                                              |\n| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |\n| [AddRangeAsync(Object[])][2]                                 | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| **AddRangeAsync(IEnumerable&lt;Object>, CancellationToken)** | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddRangeAsync(\n\tIEnumerable<Object> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose INSERT commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/AddRangeAsync_1.md",
    "content": "SqlTable.AddRangeAsync(Object[]) Method\n=======================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                                                              |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| **AddRangeAsync(Object[])**                                   | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| [AddRangeAsync(IEnumerable&lt;Object>, CancellationToken)][2] | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddRangeAsync(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose INSERT commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRangeAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/AddRange_1.md",
    "content": "SqlTable.AddRange(Object[]) Method\n==================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                  | Description                                                                                                              |\n| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| [AddRange(IEnumerable&lt;Object>)][2] | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| **AddRange(Object[])**                | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic void AddRange(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose INSERT commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRange.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Cast__1.md",
    "content": "SqlTable.Cast&lt;TEntity> Method\n================================\nCasts the current [SqlTable][1] to the generic [SqlTable&lt;TEntity>][2] instance.\n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                   | Description                                                                        |\n| ---------------------- | ---------------------------------------------------------------------------------- |\n| [Cast(Type)][4]        | Casts the elements of the set to the specified type.                               |\n| **Cast&lt;TEntity>()** | Casts the current [SqlTable][1] to the generic [SqlTable&lt;TEntity>][2] instance. |\n\n\nSyntax\n------\n\n```csharp\npublic SqlTable<TEntity> Cast<TEntity>()\nwhere TEntity : class\n\n```\n\n#### Type Parameters\n\n##### *TEntity*\nThe type of the entity.\n\n#### Return Value\n[SqlTable][2]&lt;**TEntity**>  \nThe [SqlTable&lt;TEntity>][2] instance for TEntity.\n\nExceptions\n----------\n\n| Exception                      | Condition                                             |\n| ------------------------------ | ----------------------------------------------------- |\n| [InvalidOperationException][5] | The specified TEntity is not valid for this instance. |\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][1]  \n[DbExtensions Namespace][3]  \n\n[1]: README.md\n[2]: ../SqlTable_1/README.md\n[3]: ../README.md\n[4]: ../SqlSet/Cast.md\n[5]: https://learn.microsoft.com/dotnet/api/system.invalidoperationexception"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Name.md",
    "content": "SqlTable.Name Property\n======================\nGets the name of the table.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string Name { get; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/README.md",
    "content": "SqlTable Class\n==============\nA non-generic version of [SqlTable&lt;TEntity>][1] which can be used when the type of the entity is not known at build time. This class cannot be instantiated, to get an instance use the [Database.Table(Type)][2] method.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][3]  \n  [DbExtensions.SqlSet][4]  \n    **DbExtensions.SqlTable**  \n  \n**Namespace:** [DbExtensions][5]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class SqlTable : SqlSet\n```\n\nThe **SqlTable** type exposes the following members.\n\n\nProperties\n----------\n\n| Name            | Description                                                                                        |\n| --------------- | -------------------------------------------------------------------------------------------------- |\n| [Database][6]   | The [Database][7] this set is connected to. <br/>(Inherited from [SqlSet][4])                      |\n| [Name][8]       | Gets the name of the table.                                                                        |\n| [ResultType][9] | The type of objects this set returns. This property can be null. <br/>(Inherited from [SqlSet][4]) |\n\n\nMethods\n-------\n\n| Name                                                                            | Description                                                                                                                                                                                                                                |\n| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [Add][10]                                                                       | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.                                                                                                                       |\n| [AddAsync][11]                                                                  | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.                                                                                                                       |\n| [AddRange(IEnumerable&lt;Object>)][12]                                          | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                   |\n| [AddRange(Object[])][13]                                                        | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                   |\n| [AddRangeAsync(Object[])][14]                                                   | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                   |\n| [AddRangeAsync(IEnumerable&lt;Object>, CancellationToken)][15]                  | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                   |\n| [All(OperatorStringHandler)][16]                                                | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [All(String)][17]                                                               | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [AllAsync(OperatorStringHandler, CancellationToken)][18]                        | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [AllAsync(String, CancellationToken)][19]                                       | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [Any()][20]                                                                     | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Any(OperatorStringHandler)][21]                                                | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                         |\n| [Any(String)][22]                                                               | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                         |\n| [AnyAsync(CancellationToken)][23]                                               | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][24]                        | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                         |\n| [AnyAsync(String, CancellationToken)][25]                                       | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                         |\n| [AsAsyncEnumerable][26]                                                         | Gets all elements in the set. The query is deferred-executed. <br/>(Inherited from [SqlSet][4])                                                                                                                                            |\n| [AsEnumerable][27]                                                              | Gets all elements in the set. The query is deferred-executed. <br/>(Inherited from [SqlSet][4])                                                                                                                                            |\n| [Cast(Type)][28]                                                                | Casts the elements of the set to the specified type. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [Cast&lt;TEntity>()][29]                                                        | Casts the current **SqlTable** to the generic [SqlTable&lt;TEntity>][1] instance.                                                                                                                                                          |\n| [Contains][30]                                                                  | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                                                       |\n| [ContainsAsync][31]                                                             | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                                                       |\n| [ContainsKey][32]                                                               | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                              |\n| [ContainsKeyAsync][33]                                                          | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                              |\n| [Count()][34]                                                                   | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                               |\n| [Count(OperatorStringHandler)][35]                                              | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                       |\n| [Count(String)][36]                                                             | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                       |\n| [CountAsync(CancellationToken)][37]                                             | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                               |\n| [CountAsync(OperatorStringHandler, CancellationToken)][38]                      | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                       |\n| [CountAsync(String, CancellationToken)][39]                                     | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                       |\n| [Find][40]                                                                      | Gets the entity whose primary key matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                                            |\n| [FindAsync][41]                                                                 | Gets the entity whose primary key matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                                            |\n| [First()][42]                                                                   | Returns the first element of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [First(OperatorStringHandler)][43]                                              | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet][4])                                                                                                                               |\n| [First(String)][44]                                                             | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet][4])                                                                                                                               |\n| [FirstAsync(CancellationToken)][45]                                             | Returns the first element of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][46]                      | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet][4])                                                                                                                               |\n| [FirstAsync(String, CancellationToken)][47]                                     | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet][4])                                                                                                                               |\n| [FirstOrDefault()][48]                                                          | Returns the first element of the set, or a default value if the set contains no elements. <br/>(Inherited from [SqlSet][4])                                                                                                                |\n| [FirstOrDefault(OperatorStringHandler)][49]                                     | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet][4])                                                                                          |\n| [FirstOrDefault(String)][50]                                                    | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet][4])                                                                                          |\n| [FirstOrDefaultAsync(CancellationToken)][51]                                    | Returns the first element of the set, or a default value if the set contains no elements. <br/>(Inherited from [SqlSet][4])                                                                                                                |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][52]             | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet][4])                                                                                          |\n| [FirstOrDefaultAsync(String, CancellationToken)][53]                            | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet][4])                                                                                          |\n| [GetAsyncEnumerator][54]                                                        | Returns an async enumerator that iterates through the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                               |\n| [GetDefiningQuery][55]                                                          | Returns the SQL query that is the source of data for the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                            |\n| [GetEnumerator][56]                                                             | Returns an enumerator that iterates through the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [Include][57]                                                                   | Specifies the related objects to include in the query results. <br/>(Inherited from [SqlSet][4])                                                                                                                                           |\n| [IncludeMany][58]                                                               | Specifies which collections to include in the query results. <br/>(Inherited from [SqlSet][4])                                                                                                                                             |\n| [LongCount()][59]                                                               | Returns an [Int64][60] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                          |\n| [LongCount(OperatorStringHandler)][61]                                          | Returns an [Int64][60] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                 |\n| [LongCount(String)][62]                                                         | Returns an [Int64][60] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                 |\n| [LongCountAsync(CancellationToken)][63]                                         | Returns an [Int64][60] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                          |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][64]                  | Returns an [Int64][60] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                 |\n| [LongCountAsync(String, CancellationToken)][65]                                 | Returns an [Int64][60] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                 |\n| [OrderBy(OperatorStringHandler)][66]                                            | Sorts the elements of the set according to the *columnList*. <br/>(Inherited from [SqlSet][4])                                                                                                                                             |\n| [OrderBy(String)][67]                                                           | Sorts the elements of the set according to the *columnList*. <br/>(Inherited from [SqlSet][4])                                                                                                                                             |\n| [Refresh][68]                                                                   | Sets all column members of *entity* to their most current persisted value.                                                                                                                                                                 |\n| [RefreshAsync][69]                                                              | Sets all column members of *entity* to their most current persisted value.                                                                                                                                                                 |\n| [Remove][70]                                                                    | Executes a DELETE command for the specified *entity*.                                                                                                                                                                                      |\n| [RemoveAsync][71]                                                               | Executes a DELETE command for the specified *entity*.                                                                                                                                                                                      |\n| [RemoveKey][72]                                                                 | Executes a DELETE command for the entity whose primary key matches the *id* parameter.                                                                                                                                                     |\n| [RemoveKeyAsync][73]                                                            | Executes a DELETE command for the entity whose primary key matches the *id* parameter.                                                                                                                                                     |\n| [RemoveRange(IEnumerable&lt;Object>)][74]                                       | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                     |\n| [RemoveRange(Object[])][75]                                                     | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                     |\n| [RemoveRangeAsync(Object[])][76]                                                | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                     |\n| [RemoveRangeAsync(IEnumerable&lt;Object>, CancellationToken)][77]               | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                     |\n| [Select(OperatorStringHandler, Type)][78]                                       | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Select(String, Type)][79]                                                      | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Select&lt;TResult>(OperatorStringHandler)][80]                                 | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Select&lt;TResult>(String)][81]                                                | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][82] | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][83]                | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [Single()][84]                                                                  | The single element of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [Single(OperatorStringHandler)][85]                                             | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet][4])                                                                  |\n| [Single(String)][86]                                                            | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet][4])                                                                  |\n| [SingleAsync(CancellationToken)][87]                                            | The single element of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][88]                     | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet][4])                                                                  |\n| [SingleAsync(String, CancellationToken)][89]                                    | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet][4])                                                                  |\n| [SingleOrDefault()][90]                                                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. <br/>(Inherited from [SqlSet][4])                                               |\n| [SingleOrDefault(OperatorStringHandler)][91]                                    | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet][4]) |\n| [SingleOrDefault(String)][92]                                                   | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet][4]) |\n| [SingleOrDefaultAsync(CancellationToken)][93]                                   | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. <br/>(Inherited from [SqlSet][4])                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][94]            | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet][4]) |\n| [SingleOrDefaultAsync(String, CancellationToken)][95]                           | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet][4]) |\n| [Skip][96]                                                                      | Bypasses a specified number of elements in the set and then returns the remaining elements. <br/>(Inherited from [SqlSet][4])                                                                                                              |\n| [Take][97]                                                                      | Returns a specified number of contiguous elements from the start of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [ToArray][98]                                                                   | Creates an array from the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [ToArrayAsync][99]                                                              | Creates an array from the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [ToList][100]                                                                   | Creates a [List&lt;T>][101] from the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                |\n| [ToListAsync][102]                                                              | Creates a [List&lt;T>][101] from the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                |\n| [ToString][103]                                                                 | Returns the SQL query of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                        |\n| [Update(Object)][104]                                                           | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                     |\n| [Update(Object, Object)][105]                                                   | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                     |\n| [UpdateAsync(Object, CancellationToken)][106]                                   | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                     |\n| [UpdateAsync(Object, Object, CancellationToken)][107]                           | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                     |\n| [UpdateRange(IEnumerable&lt;Object>)][108]                                      | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                     |\n| [UpdateRange(Object[])][109]                                                    | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                     |\n| [UpdateRangeAsync(Object[])][110]                                               | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                     |\n| [UpdateRangeAsync(IEnumerable&lt;Object>, CancellationToken)][111]              | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                     |\n| [Where(OperatorStringHandler)][112]                                             | Filters the set based on a predicate. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Where(String)][113]                                                            | Filters the set based on a predicate. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][5]  \n\n[1]: ../SqlTable_1/README.md\n[2]: ../Database/Table.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: ../SqlSet/README.md\n[5]: ../README.md\n[6]: ../SqlSet/Database.md\n[7]: ../Database/README.md\n[8]: Name.md\n[9]: ../SqlSet/ResultType.md\n[10]: Add.md\n[11]: AddAsync.md\n[12]: AddRange.md\n[13]: AddRange_1.md\n[14]: AddRangeAsync_1.md\n[15]: AddRangeAsync.md\n[16]: ../SqlSet/All.md\n[17]: ../SqlSet/All_1.md\n[18]: ../SqlSet/AllAsync.md\n[19]: ../SqlSet/AllAsync_1.md\n[20]: ../SqlSet/Any.md\n[21]: ../SqlSet/Any_1.md\n[22]: ../SqlSet/Any_2.md\n[23]: ../SqlSet/AnyAsync_2.md\n[24]: ../SqlSet/AnyAsync.md\n[25]: ../SqlSet/AnyAsync_1.md\n[26]: ../SqlSet/AsAsyncEnumerable.md\n[27]: ../SqlSet/AsEnumerable.md\n[28]: ../SqlSet/Cast.md\n[29]: Cast__1.md\n[30]: ../SqlSet/Contains.md\n[31]: ../SqlSet/ContainsAsync.md\n[32]: ../SqlSet/ContainsKey.md\n[33]: ../SqlSet/ContainsKeyAsync.md\n[34]: ../SqlSet/Count.md\n[35]: ../SqlSet/Count_1.md\n[36]: ../SqlSet/Count_2.md\n[37]: ../SqlSet/CountAsync_2.md\n[38]: ../SqlSet/CountAsync.md\n[39]: ../SqlSet/CountAsync_1.md\n[40]: ../SqlSet/Find.md\n[41]: ../SqlSet/FindAsync.md\n[42]: ../SqlSet/First.md\n[43]: ../SqlSet/First_1.md\n[44]: ../SqlSet/First_2.md\n[45]: ../SqlSet/FirstAsync_2.md\n[46]: ../SqlSet/FirstAsync.md\n[47]: ../SqlSet/FirstAsync_1.md\n[48]: ../SqlSet/FirstOrDefault.md\n[49]: ../SqlSet/FirstOrDefault_1.md\n[50]: ../SqlSet/FirstOrDefault_2.md\n[51]: ../SqlSet/FirstOrDefaultAsync_2.md\n[52]: ../SqlSet/FirstOrDefaultAsync.md\n[53]: ../SqlSet/FirstOrDefaultAsync_1.md\n[54]: ../SqlSet/GetAsyncEnumerator.md\n[55]: ../SqlSet/GetDefiningQuery.md\n[56]: ../SqlSet/GetEnumerator.md\n[57]: ../SqlSet/Include.md\n[58]: ../SqlSet/IncludeMany.md\n[59]: ../SqlSet/LongCount.md\n[60]: https://learn.microsoft.com/dotnet/api/system.int64\n[61]: ../SqlSet/LongCount_1.md\n[62]: ../SqlSet/LongCount_2.md\n[63]: ../SqlSet/LongCountAsync_2.md\n[64]: ../SqlSet/LongCountAsync.md\n[65]: ../SqlSet/LongCountAsync_1.md\n[66]: ../SqlSet/OrderBy.md\n[67]: ../SqlSet/OrderBy_1.md\n[68]: Refresh.md\n[69]: RefreshAsync.md\n[70]: Remove.md\n[71]: RemoveAsync.md\n[72]: RemoveKey.md\n[73]: RemoveKeyAsync.md\n[74]: RemoveRange.md\n[75]: RemoveRange_1.md\n[76]: RemoveRangeAsync_1.md\n[77]: RemoveRangeAsync.md\n[78]: ../SqlSet/Select_1.md\n[79]: ../SqlSet/Select_3.md\n[80]: ../SqlSet/Select__1.md\n[81]: ../SqlSet/Select__1_2.md\n[82]: ../SqlSet/Select__1_1.md\n[83]: ../SqlSet/Select__1_3.md\n[84]: ../SqlSet/Single.md\n[85]: ../SqlSet/Single_1.md\n[86]: ../SqlSet/Single_2.md\n[87]: ../SqlSet/SingleAsync_2.md\n[88]: ../SqlSet/SingleAsync.md\n[89]: ../SqlSet/SingleAsync_1.md\n[90]: ../SqlSet/SingleOrDefault.md\n[91]: ../SqlSet/SingleOrDefault_1.md\n[92]: ../SqlSet/SingleOrDefault_2.md\n[93]: ../SqlSet/SingleOrDefaultAsync_2.md\n[94]: ../SqlSet/SingleOrDefaultAsync.md\n[95]: ../SqlSet/SingleOrDefaultAsync_1.md\n[96]: ../SqlSet/Skip.md\n[97]: ../SqlSet/Take.md\n[98]: ../SqlSet/ToArray.md\n[99]: ../SqlSet/ToArrayAsync.md\n[100]: ../SqlSet/ToList.md\n[101]: https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1\n[102]: ../SqlSet/ToListAsync.md\n[103]: ../SqlSet/ToString.md\n[104]: Update.md\n[105]: Update_1.md\n[106]: UpdateAsync_1.md\n[107]: UpdateAsync.md\n[108]: UpdateRange.md\n[109]: UpdateRange_1.md\n[110]: UpdateRangeAsync_1.md\n[111]: UpdateRangeAsync.md\n[112]: ../SqlSet/Where.md\n[113]: ../SqlSet/Where_1.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Refresh.md",
    "content": "SqlTable.Refresh Method\n=======================\nSets all column members of *entity* to their most current persisted value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic void Refresh(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity to refresh.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RefreshAsync.md",
    "content": "SqlTable.RefreshAsync Method\n============================\nSets all column members of *entity* to their most current persisted value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask RefreshAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity to refresh.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][6]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[6]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Remove.md",
    "content": "SqlTable.Remove Method\n======================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool Remove(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose DELETE command is to be executed.\n\n#### Return Value\n[Boolean][3]  \n`true` if *entity* is deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveAsync.md",
    "content": "SqlTable.RemoveAsync Method\n===========================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> RemoveAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][2]\nThe entity whose DELETE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if *entity* is deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveKey.md",
    "content": "SqlTable.RemoveKey Method\n=========================\nExecutes a DELETE command for the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool RemoveKey(\n\tObject id\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Return Value\n[Boolean][3]  \n`true` if a record that matches *id* was found and deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveKeyAsync.md",
    "content": "SqlTable.RemoveKeyAsync Method\n==============================\nExecutes a DELETE command for the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> RemoveKeyAsync(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if a record that matches *id* was found and deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveRange.md",
    "content": "SqlTable.RemoveRange(IEnumerable&lt;Object>) Method\n===================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                    | Description                                            |\n| --------------------------------------- | ------------------------------------------------------ |\n| **RemoveRange(IEnumerable&lt;Object>)** | Executes DELETE commands for the specified *entities*. |\n| [RemoveRange(Object[])][2]              | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void RemoveRange(\n\tIEnumerable<Object> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose DELETE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveRangeAsync.md",
    "content": "SqlTable.RemoveRangeAsync(IEnumerable&lt;Object>, CancellationToken) Method\n===========================================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                            |\n| --------------------------------------------------------------- | ------------------------------------------------------ |\n| [RemoveRangeAsync(Object[])][2]                                 | Executes DELETE commands for the specified *entities*. |\n| **RemoveRangeAsync(IEnumerable&lt;Object>, CancellationToken)** | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask RemoveRangeAsync(\n\tIEnumerable<Object> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose DELETE commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveRangeAsync_1.md",
    "content": "SqlTable.RemoveRangeAsync(Object[]) Method\n==========================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                            |\n| ---------------------------------------------------------------- | ------------------------------------------------------ |\n| **RemoveRangeAsync(Object[])**                                   | Executes DELETE commands for the specified *entities*. |\n| [RemoveRangeAsync(IEnumerable&lt;Object>, CancellationToken)][2] | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask RemoveRangeAsync(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose DELETE commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRangeAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/RemoveRange_1.md",
    "content": "SqlTable.RemoveRange(Object[]) Method\n=====================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                            |\n| ---------------------------------------- | ------------------------------------------------------ |\n| [RemoveRange(IEnumerable&lt;Object>)][2] | Executes DELETE commands for the specified *entities*. |\n| **RemoveRange(Object[])**                | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void RemoveRange(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose DELETE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRange.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Update.md",
    "content": "SqlTable.Update(Object) Method\n==============================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                        | Description                                            |\n| --------------------------- | ------------------------------------------------------ |\n| **Update(Object)**          | Executes an UPDATE command for the specified *entity*. |\n| [Update(Object, Object)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tObject entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Update_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateAsync.md",
    "content": "SqlTable.UpdateAsync(Object, Object, CancellationToken) Method\n==============================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                               | Description                                            |\n| -------------------------------------------------- | ------------------------------------------------------ |\n| [UpdateAsync(Object, CancellationToken)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **UpdateAsync(Object, Object, CancellationToken)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tObject entity,\n\tObject? originalId,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][3]\nThe original primary key value.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]\n\nRemarks\n-------\nThis overload is helpful when the entity uses an assigned primary key.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateAsync_1.md",
    "content": "SqlTable.UpdateAsync(Object, CancellationToken) Method\n======================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                | Description                                            |\n| --------------------------------------------------- | ------------------------------------------------------ |\n| **UpdateAsync(Object, CancellationToken)**          | Executes an UPDATE command for the specified *entity*. |\n| [UpdateAsync(Object, Object, CancellationToken)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tObject entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateRange.md",
    "content": "SqlTable.UpdateRange(IEnumerable&lt;Object>) Method\n===================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                    | Description                                            |\n| --------------------------------------- | ------------------------------------------------------ |\n| **UpdateRange(IEnumerable&lt;Object>)** | Executes UPDATE commands for the specified *entities*. |\n| [UpdateRange(Object[])][2]              | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void UpdateRange(\n\tIEnumerable<Object> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose UPDATE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateRangeAsync.md",
    "content": "SqlTable.UpdateRangeAsync(IEnumerable&lt;Object>, CancellationToken) Method\n===========================================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                            | Description                                            |\n| --------------------------------------------------------------- | ------------------------------------------------------ |\n| [UpdateRangeAsync(Object[])][2]                                 | Executes UPDATE commands for the specified *entities*. |\n| **UpdateRangeAsync(IEnumerable&lt;Object>, CancellationToken)** | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateRangeAsync(\n\tIEnumerable<Object> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[Object][4]>\nThe entities whose UPDATE commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][8]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[8]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateRangeAsync_1.md",
    "content": "SqlTable.UpdateRangeAsync(Object[]) Method\n==========================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                            |\n| ---------------------------------------------------------------- | ------------------------------------------------------ |\n| **UpdateRangeAsync(Object[])**                                   | Executes UPDATE commands for the specified *entities*. |\n| [UpdateRangeAsync(IEnumerable&lt;Object>, CancellationToken)][2] | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateRangeAsync(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose UPDATE commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][5]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRangeAsync.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\n[5]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/UpdateRange_1.md",
    "content": "SqlTable.UpdateRange(Object[]) Method\n=====================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                            |\n| ---------------------------------------- | ------------------------------------------------------ |\n| [UpdateRange(IEnumerable&lt;Object>)][2] | Executes UPDATE commands for the specified *entities*. |\n| **UpdateRange(Object[])**                | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void UpdateRange(\n\tparams Object[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [Object][3][]\nThe entities whose UPDATE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRange.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable/Update_1.md",
    "content": "SqlTable.Update(Object, Object) Method\n======================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                       | Description                                            |\n| -------------------------- | ------------------------------------------------------ |\n| [Update(Object)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **Update(Object, Object)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tObject entity,\n\tObject? originalId\n)\n```\n\n#### Parameters\n\n##### *entity*  [Object][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][3]\nThe original primary key value.\n\n\nRemarks\n-------\nThis overload is helpful when the entity uses an assigned primary key.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Update.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Add.md",
    "content": "SqlTable&lt;TEntity>.Add Method\n===============================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic void Add(\n\tTEntity entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/AddAsync.md",
    "content": "SqlTable&lt;TEntity>.AddAsync Method\n====================================\nRecursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddAsync(\n\tTEntity entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe object whose INSERT command is to be executed. This parameter is named entity for consistency with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't need to have a primary key.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/AddRange.md",
    "content": "SqlTable&lt;TEntity>.AddRange(IEnumerable&lt;TEntity>) Method\n=============================================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                  | Description                                                                                                              |\n| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| **AddRange(IEnumerable&lt;TEntity>)** | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| [AddRange(TEntity[])][2]              | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic void AddRange(\n\tIEnumerable<TEntity> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose INSERT commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/AddRangeAsync.md",
    "content": "SqlTable&lt;TEntity>.AddRangeAsync(IEnumerable&lt;TEntity>, CancellationToken) Method\n=====================================================================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                          | Description                                                                                                              |\n| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| [AddRangeAsync(TEntity[])][2]                                 | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| **AddRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)** | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddRangeAsync(\n\tIEnumerable<TEntity> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose INSERT commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/AddRangeAsync_1.md",
    "content": "SqlTable&lt;TEntity>.AddRangeAsync(TEntity[]) Method\n====================================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                           | Description                                                                                                              |\n| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| **AddRangeAsync(TEntity[])**                                   | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| [AddRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][2] | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask AddRangeAsync(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose INSERT commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRangeAsync.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/AddRange_1.md",
    "content": "SqlTable&lt;TEntity>.AddRange(TEntity[]) Method\n===============================================\nRecursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                   | Description                                                                                                              |\n| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| [AddRange(IEnumerable&lt;TEntity>)][2] | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n| **AddRange(TEntity[])**                | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations. |\n\n\nSyntax\n------\n\n```csharp\npublic void AddRange(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose INSERT commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: AddRange.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Name.md",
    "content": "SqlTable&lt;TEntity>.Name Property\n==================================\nGets the name of the table.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string Name { get; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/README.md",
    "content": "SqlTable&lt;TEntity> Class\n==========================\nA [SqlSet&lt;TResult>][1] that provides CRUD (Create, Read, Update, Delete) operations for annotated classes. This class cannot be instantiated, to get an instance use the [Database.Table&lt;TEntity>()][2] method.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][3]  \n  [DbExtensions.SqlSet][4]  \n    [DbExtensions.SqlSet][1]&lt;**TEntity**>  \n      **DbExtensions.SqlTable&lt;TEntity>**  \n  \n**Namespace:** [DbExtensions][5]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class SqlTable<TEntity> : SqlSet<TEntity>\nwhere TEntity : class\n\n```\n\n#### Type Parameters\n\n##### *TEntity*\nThe type of the entity.\n\nThe **SqlTable&lt;TEntity>** type exposes the following members.\n\n\nProperties\n----------\n\n| Name            | Description                                                                                        |\n| --------------- | -------------------------------------------------------------------------------------------------- |\n| [Database][6]   | The [Database][7] this set is connected to. <br/>(Inherited from [SqlSet][4])                      |\n| [Name][8]       | Gets the name of the table.                                                                        |\n| [ResultType][9] | The type of objects this set returns. This property can be null. <br/>(Inherited from [SqlSet][4]) |\n\n\nMethods\n-------\n\n| Name                                                                                                                                  | Description                                                                                                                                                                                                                                            |\n| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [Add][10]                                                                                                                             | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.                                                                                                                                   |\n| [AddAsync][11]                                                                                                                        | Recursively executes INSERT commands for the specified *entity* and all its one-to-one and one-to-many associations.                                                                                                                                   |\n| [AddRange(IEnumerable&lt;TEntity>)][12]                                                                                               | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                               |\n| [AddRange(TEntity[])][13]                                                                                                             | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                               |\n| [AddRangeAsync(TEntity[])][14]                                                                                                        | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                               |\n| [AddRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][15]                                                                       | Recursively executes INSERT commands for the specified *entities* and all their one-to-one and one-to-many associations.                                                                                                                               |\n| [All(OperatorStringHandler)][16]                                                                                                      | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                      |\n| [All(String)][17]                                                                                                                     | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                      |\n| [AllAsync(OperatorStringHandler, CancellationToken)][18]                                                                              | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                      |\n| [AllAsync(String, CancellationToken)][19]                                                                                             | Determines whether all elements of the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                      |\n| [Any()][20]                                                                                                                           | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Any(OperatorStringHandler)][21]                                                                                                      | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [Any(String)][22]                                                                                                                     | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [AnyAsync(CancellationToken)][23]                                                                                                     | Determines whether the set contains any elements. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [AnyAsync(OperatorStringHandler, CancellationToken)][24]                                                                              | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [AnyAsync(String, CancellationToken)][25]                                                                                             | Determines whether any element of the set satisfies a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                                     |\n| [AsAsyncEnumerable][26]                                                                                                               | Gets all TResult objects in the set. The query is deferred-executed. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                     |\n| [AsEnumerable][27]                                                                                                                    | Gets all TResult objects in the set. The query is deferred-executed. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                     |\n| [Cast(Type)][28]                                                                                                                      | Casts the elements of the set to the specified type. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                 |\n| [Cast&lt;TResult>()][29]                                                                                                              | Casts the elements of the set to the specified type. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                 |\n| [Contains(Object)][30]                                                                                                                | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                                                                   |\n| [Contains(TResult)][31]                                                                                                               | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                       |\n| [ContainsAsync(Object, CancellationToken)][32]                                                                                        | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet][4])                                                                                                                                                   |\n| [ContainsAsync(TResult, CancellationToken)][33]                                                                                       | Checks the existance of the *entity*, using the primary key value. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                       |\n| [ContainsKey][34]                                                                                                                     | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [ContainsKeyAsync][35]                                                                                                                | Checks the existance of an entity whose primary matches the *id* parameter. <br/>(Inherited from [SqlSet][4])                                                                                                                                          |\n| [Count()][36]                                                                                                                         | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [Count(OperatorStringHandler)][37]                                                                                                    | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                   |\n| [Count(String)][38]                                                                                                                   | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                   |\n| [CountAsync(CancellationToken)][39]                                                                                                   | Returns the number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                           |\n| [CountAsync(OperatorStringHandler, CancellationToken)][40]                                                                            | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                   |\n| [CountAsync(String, CancellationToken)][41]                                                                                           | Returns a number that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                                   |\n| [Find][42]                                                                                                                            | Gets the entity whose primary key matches the *id* parameter. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                            |\n| [FindAsync][43]                                                                                                                       | Gets the entity whose primary key matches the *id* parameter. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                            |\n| [First()][44]                                                                                                                         | Returns the first element of the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                    |\n| [First(OperatorStringHandler)][45]                                                                                                    | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                               |\n| [First(String)][46]                                                                                                                   | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                               |\n| [FirstAsync(CancellationToken)][47]                                                                                                   | Returns the first element of the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                    |\n| [FirstAsync(OperatorStringHandler, CancellationToken)][48]                                                                            | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                               |\n| [FirstAsync(String, CancellationToken)][49]                                                                                           | Returns the first element in the set that satisfies a specified condition. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                               |\n| [FirstOrDefault()][50]                                                                                                                | Returns the first element of the set, or a default value if the set contains no elements. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                |\n| [FirstOrDefault(OperatorStringHandler)][51]                                                                                           | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                          |\n| [FirstOrDefault(String)][52]                                                                                                          | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                          |\n| [FirstOrDefaultAsync(CancellationToken)][53]                                                                                          | Returns the first element of the set, or a default value if the set contains no elements. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                |\n| [FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)][54]                                                                   | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                          |\n| [FirstOrDefaultAsync(String, CancellationToken)][55]                                                                                  | Returns the first element of the set that satisfies a condition or a default value if no such element is found. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                          |\n| [GetAsyncEnumerator][56]                                                                                                              | Returns an async enumerator that iterates through the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                               |\n| [GetDefiningQuery][57]                                                                                                                | Returns the SQL query that is the source of data for the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                        |\n| [GetEnumerator][58]                                                                                                                   | Returns an enumerator that iterates through the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                     |\n| [Include(String)][59]                                                                                                                 | Specifies the related objects to include in the query results. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                           |\n| [Include(Func&lt;TResult, Object>, String)][60]                                                                                       | Specifies the related objects to include in the query results. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                           |\n| [IncludeMany(String, Func&lt;SqlSet, SqlSet>)][61]                                                                                    | Specifies which collections to include in the query results. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                             |\n| [IncludeMany&lt;TElement>(Func&lt;TResult, ICollection&lt;TElement>>, Func&lt;SqlSet&lt;TElement>, SqlSet&lt;TElement>>, String)][62] | Specifies which collections to include in the query results. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                             |\n| [LongCount()][63]                                                                                                                     | Returns an [Int64][64] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                      |\n| [LongCount(OperatorStringHandler)][65]                                                                                                | Returns an [Int64][64] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [LongCount(String)][66]                                                                                                               | Returns an [Int64][64] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [LongCountAsync(CancellationToken)][67]                                                                                               | Returns an [Int64][64] that represents the total number of elements in the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                      |\n| [LongCountAsync(OperatorStringHandler, CancellationToken)][68]                                                                        | Returns an [Int64][64] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [LongCountAsync(String, CancellationToken)][69]                                                                                       | Returns an [Int64][64] that represents how many elements in the set satisfy a condition. <br/>(Inherited from [SqlSet][4])                                                                                                                             |\n| [OrderBy(OperatorStringHandler)][70]                                                                                                  | Sorts the elements of the set according to the *columnList*. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                             |\n| [OrderBy(String)][71]                                                                                                                 | Sorts the elements of the set according to the *columnList*. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                             |\n| [Refresh][72]                                                                                                                         | Sets all column members of *entity* to their most current persisted value.                                                                                                                                                                             |\n| [RefreshAsync][73]                                                                                                                    | Sets all column members of *entity* to their most current persisted value.                                                                                                                                                                             |\n| [Remove][74]                                                                                                                          | Executes a DELETE command for the specified *entity*.                                                                                                                                                                                                  |\n| [RemoveAsync][75]                                                                                                                     | Executes a DELETE command for the specified *entity*.                                                                                                                                                                                                  |\n| [RemoveKey][76]                                                                                                                       | Executes a DELETE command for the entity whose primary key matches the *id* parameter.                                                                                                                                                                 |\n| [RemoveKeyAsync][77]                                                                                                                  | Executes a DELETE command for the entity whose primary key matches the *id* parameter.                                                                                                                                                                 |\n| [RemoveRange(IEnumerable&lt;TEntity>)][78]                                                                                            | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [RemoveRange(TEntity[])][79]                                                                                                          | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [RemoveRangeAsync(TEntity[])][80]                                                                                                     | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [RemoveRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][81]                                                                    | Executes DELETE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [Select(OperatorStringHandler, Type)][82]                                                                                             | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Select(String, Type)][83]                                                                                                            | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Select&lt;TResult>(OperatorStringHandler)][84]                                                                                       | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Select&lt;TResult>(String)][85]                                                                                                      | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Select&lt;TResult>(OperatorStringHandler, Func&lt;DbDataReader, TResult>)][86]                                                       | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)][87]                                                                      | Projects each element of the set into a new form. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                    |\n| [Single()][88]                                                                                                                        | The single element of the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                           |\n| [Single(OperatorStringHandler)][89]                                                                                                   | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                  |\n| [Single(String)][90]                                                                                                                  | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                  |\n| [SingleAsync(CancellationToken)][91]                                                                                                  | The single element of the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                           |\n| [SingleAsync(OperatorStringHandler, CancellationToken)][92]                                                                           | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                  |\n| [SingleAsync(String, CancellationToken)][93]                                                                                          | Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                  |\n| [SingleOrDefault()][94]                                                                                                               | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                               |\n| [SingleOrDefault(OperatorStringHandler)][95]                                                                                          | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet&lt;TResult>][1]) |\n| [SingleOrDefault(String)][96]                                                                                                         | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet&lt;TResult>][1]) |\n| [SingleOrDefaultAsync(CancellationToken)][97]                                                                                         | Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                               |\n| [SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)][98]                                                                  | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet&lt;TResult>][1]) |\n| [SingleOrDefaultAsync(String, CancellationToken)][99]                                                                                 | Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. <br/>(Inherited from [SqlSet&lt;TResult>][1]) |\n| [Skip][100]                                                                                                                           | Bypasses a specified number of elements in the set and then returns the remaining elements. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                              |\n| [Take][101]                                                                                                                           | Returns a specified number of contiguous elements from the start of the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                             |\n| [ToArray][102]                                                                                                                        | Creates an array from the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                           |\n| [ToArrayAsync][103]                                                                                                                   | Creates an array from the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                           |\n| [ToList][104]                                                                                                                         | Creates a List&lt;TResult> from the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                 |\n| [ToListAsync][105]                                                                                                                    | Creates a List&lt;TResult> from the set. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                 |\n| [ToString][106]                                                                                                                       | Returns the SQL query of the set. <br/>(Inherited from [SqlSet][4])                                                                                                                                                                                    |\n| [Update(TEntity)][107]                                                                                                                | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                                 |\n| [Update(TEntity, Object)][108]                                                                                                        | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                                 |\n| [UpdateAsync(TEntity, CancellationToken)][109]                                                                                        | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                                 |\n| [UpdateAsync(TEntity, Object, CancellationToken)][110]                                                                                | Executes an UPDATE command for the specified *entity*.                                                                                                                                                                                                 |\n| [UpdateRange(IEnumerable&lt;TEntity>)][111]                                                                                           | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [UpdateRange(TEntity[])][112]                                                                                                         | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [UpdateRangeAsync(TEntity[])][113]                                                                                                    | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [UpdateRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][114]                                                                   | Executes UPDATE commands for the specified *entities*.                                                                                                                                                                                                 |\n| [Where(OperatorStringHandler)][115]                                                                                                   | Filters the set based on a predicate. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                    |\n| [Where(String)][116]                                                                                                                  | Filters the set based on a predicate. <br/>(Inherited from [SqlSet&lt;TResult>][1])                                                                                                                                                                    |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][5]  \n\n[1]: ../SqlSet_1/README.md\n[2]: ../Database/Table__1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.object\n[4]: ../SqlSet/README.md\n[5]: ../README.md\n[6]: ../SqlSet/Database.md\n[7]: ../Database/README.md\n[8]: Name.md\n[9]: ../SqlSet/ResultType.md\n[10]: Add.md\n[11]: AddAsync.md\n[12]: AddRange.md\n[13]: AddRange_1.md\n[14]: AddRangeAsync_1.md\n[15]: AddRangeAsync.md\n[16]: ../SqlSet/All.md\n[17]: ../SqlSet/All_1.md\n[18]: ../SqlSet/AllAsync.md\n[19]: ../SqlSet/AllAsync_1.md\n[20]: ../SqlSet/Any.md\n[21]: ../SqlSet/Any_1.md\n[22]: ../SqlSet/Any_2.md\n[23]: ../SqlSet/AnyAsync_2.md\n[24]: ../SqlSet/AnyAsync.md\n[25]: ../SqlSet/AnyAsync_1.md\n[26]: ../SqlSet_1/AsAsyncEnumerable.md\n[27]: ../SqlSet_1/AsEnumerable.md\n[28]: ../SqlSet/Cast.md\n[29]: ../SqlSet/Cast__1.md\n[30]: ../SqlSet/Contains.md\n[31]: ../SqlSet_1/Contains.md\n[32]: ../SqlSet/ContainsAsync.md\n[33]: ../SqlSet_1/ContainsAsync.md\n[34]: ../SqlSet/ContainsKey.md\n[35]: ../SqlSet/ContainsKeyAsync.md\n[36]: ../SqlSet/Count.md\n[37]: ../SqlSet/Count_1.md\n[38]: ../SqlSet/Count_2.md\n[39]: ../SqlSet/CountAsync_2.md\n[40]: ../SqlSet/CountAsync.md\n[41]: ../SqlSet/CountAsync_1.md\n[42]: ../SqlSet_1/Find.md\n[43]: ../SqlSet_1/FindAsync.md\n[44]: ../SqlSet_1/First.md\n[45]: ../SqlSet_1/First_1.md\n[46]: ../SqlSet_1/First_2.md\n[47]: ../SqlSet_1/FirstAsync_2.md\n[48]: ../SqlSet_1/FirstAsync.md\n[49]: ../SqlSet_1/FirstAsync_1.md\n[50]: ../SqlSet_1/FirstOrDefault.md\n[51]: ../SqlSet_1/FirstOrDefault_1.md\n[52]: ../SqlSet_1/FirstOrDefault_2.md\n[53]: ../SqlSet_1/FirstOrDefaultAsync_2.md\n[54]: ../SqlSet_1/FirstOrDefaultAsync.md\n[55]: ../SqlSet_1/FirstOrDefaultAsync_1.md\n[56]: ../SqlSet_1/GetAsyncEnumerator.md\n[57]: ../SqlSet/GetDefiningQuery.md\n[58]: ../SqlSet_1/GetEnumerator.md\n[59]: ../SqlSet_1/Include_1.md\n[60]: ../SqlSet_1/Include.md\n[61]: ../SqlSet_1/IncludeMany.md\n[62]: ../SqlSet_1/IncludeMany__1.md\n[63]: ../SqlSet/LongCount.md\n[64]: https://learn.microsoft.com/dotnet/api/system.int64\n[65]: ../SqlSet/LongCount_1.md\n[66]: ../SqlSet/LongCount_2.md\n[67]: ../SqlSet/LongCountAsync_2.md\n[68]: ../SqlSet/LongCountAsync.md\n[69]: ../SqlSet/LongCountAsync_1.md\n[70]: ../SqlSet_1/OrderBy.md\n[71]: ../SqlSet_1/OrderBy_1.md\n[72]: Refresh.md\n[73]: RefreshAsync.md\n[74]: Remove.md\n[75]: RemoveAsync.md\n[76]: RemoveKey.md\n[77]: RemoveKeyAsync.md\n[78]: RemoveRange.md\n[79]: RemoveRange_1.md\n[80]: RemoveRangeAsync_1.md\n[81]: RemoveRangeAsync.md\n[82]: ../SqlSet/Select_1.md\n[83]: ../SqlSet/Select_3.md\n[84]: ../SqlSet/Select__1.md\n[85]: ../SqlSet/Select__1_2.md\n[86]: ../SqlSet/Select__1_1.md\n[87]: ../SqlSet/Select__1_3.md\n[88]: ../SqlSet_1/Single.md\n[89]: ../SqlSet_1/Single_1.md\n[90]: ../SqlSet_1/Single_2.md\n[91]: ../SqlSet_1/SingleAsync_2.md\n[92]: ../SqlSet_1/SingleAsync.md\n[93]: ../SqlSet_1/SingleAsync_1.md\n[94]: ../SqlSet_1/SingleOrDefault.md\n[95]: ../SqlSet_1/SingleOrDefault_1.md\n[96]: ../SqlSet_1/SingleOrDefault_2.md\n[97]: ../SqlSet_1/SingleOrDefaultAsync_2.md\n[98]: ../SqlSet_1/SingleOrDefaultAsync.md\n[99]: ../SqlSet_1/SingleOrDefaultAsync_1.md\n[100]: ../SqlSet_1/Skip.md\n[101]: ../SqlSet_1/Take.md\n[102]: ../SqlSet_1/ToArray.md\n[103]: ../SqlSet_1/ToArrayAsync.md\n[104]: ../SqlSet_1/ToList.md\n[105]: ../SqlSet_1/ToListAsync.md\n[106]: ../SqlSet/ToString.md\n[107]: Update.md\n[108]: Update_1.md\n[109]: UpdateAsync_1.md\n[110]: UpdateAsync.md\n[111]: UpdateRange.md\n[112]: UpdateRange_1.md\n[113]: UpdateRangeAsync_1.md\n[114]: UpdateRangeAsync.md\n[115]: ../SqlSet_1/Where.md\n[116]: ../SqlSet_1/Where_1.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Refresh.md",
    "content": "SqlTable&lt;TEntity>.Refresh Method\n===================================\nSets all column members of *entity* to their most current persisted value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic void Refresh(\n\tTEntity entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe entity to refresh.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RefreshAsync.md",
    "content": "SqlTable&lt;TEntity>.RefreshAsync Method\n========================================\nSets all column members of *entity* to their most current persisted value.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask RefreshAsync(\n\tTEntity entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe entity to refresh.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Remove.md",
    "content": "SqlTable&lt;TEntity>.Remove Method\n==================================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool Remove(\n\tTEntity entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe entity whose DELETE command is to be executed.\n\n#### Return Value\n[Boolean][3]  \n`true` if *entity* is deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveAsync.md",
    "content": "SqlTable&lt;TEntity>.RemoveAsync Method\n=======================================\nExecutes a DELETE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> RemoveAsync(\n\tTEntity entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][2]\nThe entity whose DELETE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if *entity* is deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][2]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: README.md\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveKey.md",
    "content": "SqlTable&lt;TEntity>.RemoveKey Method\n=====================================\nExecutes a DELETE command for the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic bool RemoveKey(\n\tObject id\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n#### Return Value\n[Boolean][3]  \n`true` if a record that matches *id* was found and deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.boolean\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveKeyAsync.md",
    "content": "SqlTable&lt;TEntity>.RemoveKeyAsync Method\n==========================================\nExecutes a DELETE command for the entity whose primary key matches the *id* parameter.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic ValueTask<bool> RemoveKeyAsync(\n\tObject id,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *id*  [Object][2]\nThe primary key value.\n\n##### *cancellationToken*  [CancellationToken][3]  (Optional)\nThe [CancellationToken][3] to monitor for cancellation requests. The default is [None][4].\n\n#### Return Value\n[ValueTask][5]&lt;[Boolean][6]>  \n`true` if a record that matches *id* was found and deleted; otherwise, `false`.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][7]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.object\n[3]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask-1\n[6]: https://learn.microsoft.com/dotnet/api/system.boolean\n[7]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveRange.md",
    "content": "SqlTable&lt;TEntity>.RemoveRange(IEnumerable&lt;TEntity>) Method\n================================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                            |\n| ---------------------------------------- | ------------------------------------------------------ |\n| **RemoveRange(IEnumerable&lt;TEntity>)** | Executes DELETE commands for the specified *entities*. |\n| [RemoveRange(TEntity[])][2]              | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void RemoveRange(\n\tIEnumerable<TEntity> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose DELETE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveRangeAsync.md",
    "content": "SqlTable&lt;TEntity>.RemoveRangeAsync(IEnumerable&lt;TEntity>, CancellationToken) Method\n========================================================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                            |\n| ---------------------------------------------------------------- | ------------------------------------------------------ |\n| [RemoveRangeAsync(TEntity[])][2]                                 | Executes DELETE commands for the specified *entities*. |\n| **RemoveRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)** | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask RemoveRangeAsync(\n\tIEnumerable<TEntity> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose DELETE commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveRangeAsync_1.md",
    "content": "SqlTable&lt;TEntity>.RemoveRangeAsync(TEntity[]) Method\n=======================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                              | Description                                            |\n| ----------------------------------------------------------------- | ------------------------------------------------------ |\n| **RemoveRangeAsync(TEntity[])**                                   | Executes DELETE commands for the specified *entities*. |\n| [RemoveRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][2] | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask RemoveRangeAsync(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose DELETE commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRangeAsync.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/RemoveRange_1.md",
    "content": "SqlTable&lt;TEntity>.RemoveRange(TEntity[]) Method\n==================================================\nExecutes DELETE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                            |\n| ----------------------------------------- | ------------------------------------------------------ |\n| [RemoveRange(IEnumerable&lt;TEntity>)][2] | Executes DELETE commands for the specified *entities*. |\n| **RemoveRange(TEntity[])**                | Executes DELETE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void RemoveRange(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose DELETE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: RemoveRange.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Update.md",
    "content": "SqlTable&lt;TEntity>.Update(TEntity) Method\n===========================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                         | Description                                            |\n| ---------------------------- | ------------------------------------------------------ |\n| **Update(TEntity)**          | Executes an UPDATE command for the specified *entity*. |\n| [Update(TEntity, Object)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tTEntity entity\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][3]\nThe entity whose UPDATE command is to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Update_1.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateAsync.md",
    "content": "SqlTable&lt;TEntity>.UpdateAsync(TEntity, Object, CancellationToken) Method\n===========================================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                | Description                                            |\n| --------------------------------------------------- | ------------------------------------------------------ |\n| [UpdateAsync(TEntity, CancellationToken)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **UpdateAsync(TEntity, Object, CancellationToken)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tTEntity entity,\n\tObject? originalId,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][4]\nThe original primary key value.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nRemarks\n-------\nThis overload is helpful when the entity uses an assigned primary key.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateAsync_1.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateAsync_1.md",
    "content": "SqlTable&lt;TEntity>.UpdateAsync(TEntity, CancellationToken) Method\n===================================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                 | Description                                            |\n| ---------------------------------------------------- | ------------------------------------------------------ |\n| **UpdateAsync(TEntity, CancellationToken)**          | Executes an UPDATE command for the specified *entity*. |\n| [UpdateAsync(TEntity, Object, CancellationToken)][2] | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateAsync(\n\tTEntity entity,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *cancellationToken*  [CancellationToken][4]  (Optional)\nThe [CancellationToken][4] to monitor for cancellation requests. The default is [None][5].\n\n#### Return Value\n[ValueTask][6]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateAsync.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateRange.md",
    "content": "SqlTable&lt;TEntity>.UpdateRange(IEnumerable&lt;TEntity>) Method\n================================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                     | Description                                            |\n| ---------------------------------------- | ------------------------------------------------------ |\n| **UpdateRange(IEnumerable&lt;TEntity>)** | Executes UPDATE commands for the specified *entities*. |\n| [UpdateRange(TEntity[])][2]              | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void UpdateRange(\n\tIEnumerable<TEntity> entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose UPDATE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRange_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateRangeAsync.md",
    "content": "SqlTable&lt;TEntity>.UpdateRangeAsync(IEnumerable&lt;TEntity>, CancellationToken) Method\n========================================================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                             | Description                                            |\n| ---------------------------------------------------------------- | ------------------------------------------------------ |\n| [UpdateRangeAsync(TEntity[])][2]                                 | Executes UPDATE commands for the specified *entities*. |\n| **UpdateRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)** | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateRangeAsync(\n\tIEnumerable<TEntity> entities,\n\tCancellationToken cancellationToken = default\n)\n```\n\n#### Parameters\n\n##### *entities*  [IEnumerable][3]&lt;[TEntity][4]>\nThe entities whose UPDATE commands are to be executed.\n\n##### *cancellationToken*  [CancellationToken][5]  (Optional)\nThe [CancellationToken][5] to monitor for cancellation requests. The default is [None][6].\n\n#### Return Value\n[ValueTask][7]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][4]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRangeAsync_1.md\n[3]: https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1\n[4]: README.md\n[5]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken\n[6]: https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken.none\n[7]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateRangeAsync_1.md",
    "content": "SqlTable&lt;TEntity>.UpdateRangeAsync(TEntity[]) Method\n=======================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                                              | Description                                            |\n| ----------------------------------------------------------------- | ------------------------------------------------------ |\n| **UpdateRangeAsync(TEntity[])**                                   | Executes UPDATE commands for the specified *entities*. |\n| [UpdateRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)][2] | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic ValueTask UpdateRangeAsync(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose UPDATE commands are to be executed.\n\n#### Return Value\n[ValueTask][4]\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRangeAsync.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/UpdateRange_1.md",
    "content": "SqlTable&lt;TEntity>.UpdateRange(TEntity[]) Method\n==================================================\nExecutes UPDATE commands for the specified *entities*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                                      | Description                                            |\n| ----------------------------------------- | ------------------------------------------------------ |\n| [UpdateRange(IEnumerable&lt;TEntity>)][2] | Executes UPDATE commands for the specified *entities*. |\n| **UpdateRange(TEntity[])**                | Executes UPDATE commands for the specified *entities*. |\n\n\nSyntax\n------\n\n```csharp\npublic void UpdateRange(\n\tparams TEntity[] entities\n)\n```\n\n#### Parameters\n\n##### *entities*  [TEntity][3][]\nThe entities whose UPDATE commands are to be executed.\n\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: UpdateRange.md\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/SqlTable_1/Update_1.md",
    "content": "SqlTable&lt;TEntity>.Update(TEntity, Object) Method\n===================================================\nExecutes an UPDATE command for the specified *entity*.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nOverloads\n---------\n\n| Name                        | Description                                            |\n| --------------------------- | ------------------------------------------------------ |\n| [Update(TEntity)][2]        | Executes an UPDATE command for the specified *entity*. |\n| **Update(TEntity, Object)** | Executes an UPDATE command for the specified *entity*. |\n\n\nSyntax\n------\n\n```csharp\npublic void Update(\n\tTEntity entity,\n\tObject? originalId\n)\n```\n\n#### Parameters\n\n##### *entity*  [TEntity][3]\nThe entity whose UPDATE command is to be executed.\n\n##### *originalId*  [Object][4]\nThe original primary key value.\n\n\nRemarks\n-------\nThis overload is helpful when the entity uses an assigned primary key.\n\nSee Also\n--------\n\n#### Reference\n[SqlTable&lt;TEntity> Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: Update.md\n[3]: README.md\n[4]: https://learn.microsoft.com/dotnet/api/system.object"
  },
  {
    "path": "docs/api/DbExtensions/TableAttribute/Name.md",
    "content": "TableAttribute.Name Property\n============================\nGets or sets the name of the table or view.\n  \n**Namespace:** [DbExtensions][1]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic string? Name { get; set; }\n```\n\n#### Property Value\n[String][2]\n\nSee Also\n--------\n\n#### Reference\n[TableAttribute Class][3]  \n[DbExtensions Namespace][1]  \n\n[1]: ../README.md\n[2]: https://learn.microsoft.com/dotnet/api/system.string\n[3]: README.md"
  },
  {
    "path": "docs/api/DbExtensions/TableAttribute/README.md",
    "content": "TableAttribute Class\n====================\nDesignates a class as an entity class that is associated with a database table.\n\n\nInheritance Hierarchy\n---------------------\n[System.Object][1]  \n  [System.Attribute][2]  \n    **DbExtensions.TableAttribute**  \n  \n**Namespace:** [DbExtensions][3]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic sealed class TableAttribute : Attribute\n```\n\nThe **TableAttribute** type exposes the following members.\n\n\nConstructors\n------------\n\n| Name                | Description                                                |\n| ------------------- | ---------------------------------------------------------- |\n| [TableAttribute][4] | Initializes a new instance of the **TableAttribute** class |\n\n\nProperties\n----------\n\n| Name      | Description                                 |\n| --------- | ------------------------------------------- |\n| [Name][5] | Gets or sets the name of the table or view. |\n\n\nSee Also\n--------\n\n#### Reference\n[DbExtensions Namespace][3]  \n\n[1]: https://learn.microsoft.com/dotnet/api/system.object\n[2]: https://learn.microsoft.com/dotnet/api/system.attribute\n[3]: ../README.md\n[4]: _ctor.md\n[5]: Name.md"
  },
  {
    "path": "docs/api/DbExtensions/TableAttribute/_ctor.md",
    "content": "TableAttribute Constructor\n==========================\nInitializes a new instance of the [TableAttribute][1] class\n  \n**Namespace:** [DbExtensions][2]  \n**Assembly:** DbExtensions.dll\n\nSyntax\n------\n\n```csharp\npublic TableAttribute()\n```\n\n\nSee Also\n--------\n\n#### Reference\n[TableAttribute Class][1]  \n[DbExtensions Namespace][2]  \n\n[1]: README.md\n[2]: ../README.md"
  },
  {
    "path": "docs/api/README.md",
    "content": "DbExtensions Namespaces\n=======================\n\n\nNamespaces\n----------\n\n| Namespace         | Description                                                                                                                                                                       |\n| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [DbExtensions][1] | DbExtensions is a data-access framework with a strong focus on query composition, granularity and code aesthetics. [Database][2] is the entry point of the [DbExtensions][1] API. |\n\n[1]: DbExtensions/README.md\n[2]: DbExtensions/Database/README.md"
  },
  {
    "path": "samples/App/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n   <connectionStrings>\n      <add name=\"sqlite\" connectionString=\"Data Source=Northwind\\Northwind.sl3; FailIfMissing=True;\" providerName=\"System.Data.SQLite\" />\n      <add name=\"sqlserver\" connectionString=\"Data Source=(localdb)\\mssqllocaldb; AttachDbFileName=|DataDirectory|\\Northwind\\Northwind.mdf; Integrated Security=true; MultipleActiveResultSets=true\" providerName=\"Microsoft.Data.SqlClient\" />\n      <add name=\"mysql\" connectionString=\"Server=localhost; Database=northwind;\" providerName=\"MySql.Data.MySqlClient\" />\n   </connectionStrings>\n</configuration>\n"
  },
  {
    "path": "samples/App/Program.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Data.Common;\nusing System.IO;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Text.RegularExpressions;\nusing DbExtensions;\n\nnamespace Samples {\n\n   using static Console;\n\n   class Program {\n\n      readonly string\n      _samplesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, \"..\", \"..\", \"..\", \"..\");\n\n      static void\n      Main() {\n\n         DbProviderFactories.RegisterFactory(\"Microsoft.Data.SqlClient\", Microsoft.Data.SqlClient.SqlClientFactory.Instance);\n         DbProviderFactories.RegisterFactory(\"MySql.Data.MySqlClient\", MySql.Data.MySqlClient.MySqlClientFactory.Instance);\n         DbProviderFactories.RegisterFactory(\"System.Data.SQLite\", System.Data.SQLite.SQLiteFactory.Instance);\n\n         new Program().Run();\n      }\n\n      void\n      Run() {\n\n         WriteLine(\"DbExtensions Sample Runner\");\n         WriteLine(\"==========================\");\n\n         var connectionStrings = ConfigurationManager.ConnectionStrings\n            .Cast<ConnectionStringSettings>()\n            // Only connection strings defined in this application config file\n            .Where(c => c.ElementInformation.Source != null && c.ElementInformation.Source.EndsWith(\"dll.config\", StringComparison.OrdinalIgnoreCase))\n            .ToArray();\n\n         var connIndex = GetArrayOption(connectionStrings.Select(c => c.Name).ToArray(), \"Select a connection string (or Enter to select the first one):\");\n         var connSettings = connectionStrings[connIndex];\n         var provider = DbProviderFactories.GetFactory(connSettings.ProviderName);\n\n         WriteLine();\n         WriteLine(\"Provider: {0}\", provider.GetType().AssemblyQualifiedName);\n         WriteLine();\n         WriteLine(\"Connecting...\");\n\n         try {\n\n            var db = new Database(connSettings.ConnectionString, connSettings.ProviderName);\n\n            using (db.EnsureConnectionOpen()) {\n               WriteLine(\"Server Version: {0}\", ((DbConnection)db.Connection).ServerVersion);\n            }\n\n         } catch (Exception ex) {\n\n            WriteError(ex, fatal: true);\n            return;\n         }\n\n         var samplesLangs = GetSamplesLanguages();\n\n         var samplesLangIndex = GetArrayOption(samplesLangs, \"Select the samples language (or Enter):\");\n         var samplesLanguage = samplesLangs[samplesLangIndex];\n\n         object[] samples;\n\n         try {\n            samples = GetSamples(samplesLanguage, connSettings).ToArray();\n         } catch (Exception ex) {\n\n            WriteError(ex, fatal: true);\n            return;\n         }\n\n         var samplesOptions =\n            (from s in samples\n             let name = s.GetType().Name\n             let friendlyName = name.Substring(0, name.Length - \"Samples\".Length)\n             select friendlyName)\n             .Append(\"All\")\n             .ToArray();\n\n         var samplesIndex = GetArrayOption(samplesOptions, \"Select the samples category (or Enter to run all):\", samplesOptions.Length - 1);\n\n         var selectedSamples = (samplesIndex == samplesOptions.Length - 1) ? samples\n            : [samples[samplesIndex]];\n\n         var continueOnErrorOptions = new[] { \"Yes\", \"No\" };\n         var continueOnError = GetArrayOption(continueOnErrorOptions, \"Continue on Error:\") == 0;\n\n         WriteLine();\n         WriteLine(\"Press key to begin...\");\n         ReadKey();\n\n         for (int i = 0; i < selectedSamples.Length; i++) {\n\n            var sampl = selectedSamples[i];\n\n            RunSamples(sampl, continueOnError);\n\n            if (sampl is IDisposable disp) {\n               disp.Dispose();\n            }\n\n            WriteLine();\n            WriteLine((i == selectedSamples.Length - 1) ? \"Press key to exit...\" : \"Press key to continue...\");\n            ReadKey();\n         }\n      }\n\n      string[]\n      GetSamplesLanguages() {\n\n         var appDir = AppDomain.CurrentDomain.BaseDirectory\n            .Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries)\n            .Reverse()\n            .Skip(3)\n            .First();\n\n         var projectsDir = Directory\n            .GetDirectories(_samplesPath, \"*\", SearchOption.TopDirectoryOnly)\n            .Select(s => s.Split(Path.DirectorySeparatorChar).Last())\n            .Where(s => !s.Equals(appDir))\n            .ToArray();\n\n         return projectsDir;\n      }\n\n      IEnumerable<object>\n      GetSamples(string language, ConnectionStringSettings connSettings) {\n\n         var projectDir = Path.Combine(_samplesPath, language);\n         var projectFile = Directory.GetFiles(projectDir, String.Format(\"*.{0}proj\", Regex.Replace(language, \"[a-z]\", \"\")))\n            .FirstOrDefault()\n            ?? throw new InvalidOperationException(\"Project file not found.\");\n\n         var projectFileName = projectFile.Split(Path.DirectorySeparatorChar).Last();\n         var assemblyName = String.Join(\".\", projectFileName.Split('.').Reverse().Skip(1).Reverse());\n         var assemblyDir = Directory.GetDirectories(Path.Combine(projectDir, \"bin\", \"Debug\"), \"net*\").First();\n         var assemblyPath = new Uri(Path.Combine(assemblyDir, assemblyName + \".dll\")).LocalPath;\n\n         var samplesAssembly = Assembly.LoadFrom(assemblyPath);\n\n         var dbType = samplesAssembly.GetTypes()\n            .Where(t => typeof(Database).IsAssignableFrom(t))\n            .Single();\n\n         var db = (Database)Activator.CreateInstance(dbType, connSettings.ConnectionString, connSettings.ProviderName);\n         db.Configuration.Log = Out;\n\n         return\n            from t in samplesAssembly.GetTypes()\n            where t.IsPublic\n               && t.Name.EndsWith(\"Samples\")\n            let parameters = t.GetConstructors().First().GetParameters()\n            let args =\n               from p in parameters\n               select (typeof(Database).IsAssignableFrom(p.ParameterType) ? db\n                  : p.ParameterType.IsValueType ? Activator.CreateInstance(p.ParameterType)\n                  : null)\n            select Activator.CreateInstance(t, args.ToArray());\n      }\n\n      static void\n      RunSamples(object samples, bool continueOnError) {\n\n         var samplesType = samples.GetType();\n         var isDisposable = samples is IDisposable;\n\n         var methods = samplesType\n            .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)\n            .ToList();\n\n         for (int i = 0; i < methods.Count; i++) {\n\n            var method = methods[i];\n\n            if (isDisposable\n               && method.Name == \"Dispose\") {\n\n               continue;\n            }\n\n            WriteLine();\n            WriteLine(method.Name);\n            Write(new string('=', method.Name.Length));\n            WriteLine();\n\n            object returnValue = null;\n\n            if (method.ReturnType == typeof(void)) {\n\n               var runSample = (Action)Delegate.CreateDelegate(typeof(Action), samples, method);\n\n               if (continueOnError) {\n\n                  try {\n                     runSample();\n                  } catch (Exception ex) {\n                     WriteError(ex);\n                     continue;\n                  }\n\n               } else {\n                  runSample();\n               }\n\n            } else {\n\n               void runSample() {\n                  returnValue = Expression.Lambda<Func<object>>(\n                     Expression.Convert(\n                        Expression.Call(Expression.Constant(samples), method)\n                        , typeof(object)\n                     )\n                  ).Compile()();\n\n                  if (returnValue is IEnumerable ienum) {\n                     returnValue = ienum.Cast<object>().ToArray();\n                  }\n               }\n\n               if (continueOnError) {\n\n                  try {\n                     runSample();\n                  } catch (Exception ex) {\n                     WriteError(ex);\n                     continue;\n                  }\n\n               } else {\n                  runSample();\n               }\n            }\n\n            if (returnValue != null) {\n\n               WriteLine();\n\n               if (returnValue is SqlBuilder sql) {\n\n                  WriteLine(returnValue);\n\n                  for (int j = 0; j < sql.ParameterValues.Count; j++) {\n\n                     var value = sql.ParameterValues[j];\n                     var type = value?.GetType();\n\n                     WriteLine(\"-- {0}: {1} [{2}]\", j, type, value);\n                  }\n\n               } else {\n\n                  var color = ForegroundColor;\n                  ForegroundColor = ConsoleColor.DarkGray;\n\n                  ObjectDumper.Write(returnValue, 1, Out);\n\n                  ForegroundColor = color;\n               }\n            }\n         }\n      }\n\n      static int\n      GetArrayOption<T>(T[] options, string title, int defaultOption = 0) {\n\n         var firstTry = true;\n         var index = -1;\n         var left = CursorLeft;\n\n         while (index < 0 || index >= options.Length) {\n\n            if (!firstTry) {\n               WriteLine();\n            }\n\n            firstTry = false;\n\n            WriteLine();\n            WriteLine(title);\n\n            for (int i = 0; i < options.Length; i++) {\n\n               if (i > 0) {\n                  Write(\", \");\n               }\n\n               Write(\"[{0}] {1}\", i + 1, options[i]);\n            }\n\n            Write(\": \");\n\n            left = CursorLeft;\n            var key = ReadKey();\n\n            if (key.Key == ConsoleKey.Enter) {\n\n               index = defaultOption;\n\n            } else {\n\n               try {\n                  index = Int32.Parse(key.KeyChar.ToString()) - 1;\n               } catch (Exception) { }\n            }\n         }\n\n         var prevColor = ForegroundColor;\n\n         ForegroundColor = ConsoleColor.Green;\n\n         CursorLeft = left;\n         Write(options[index]);\n         WriteLine();\n\n         ForegroundColor = prevColor;\n\n         return index;\n      }\n\n      static void\n      WriteError(Exception ex, bool fatal = false) {\n\n         var prevColor = ForegroundColor;\n         ForegroundColor = ConsoleColor.Red;\n         WriteLine(ex.Message);\n         ForegroundColor = prevColor;\n\n         WriteLine();\n         WriteLine((fatal) ? \"Press key to exit...\" : \"Press key to continue...\");\n         ReadKey();\n      }\n   }\n}\n"
  },
  {
    "path": "samples/App/Samples.App.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net8.0</TargetFramework>\n    <LangVersion>12</LangVersion>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.Data.SqlClient\" Version=\"6.1.1\" />\n    <PackageReference Include=\"MySql.Data\" Version=\"8.4.0\" />\n    <PackageReference Include=\"System.Configuration.ConfigurationManager\" Version=\"9.0.8\" />\n    <PackageReference Include=\"System.Data.SQLite.Core\" Version=\"1.0.119\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\DbExtensions\\DbExtensions.csproj\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Update=\"Northwind\\Northwind.mdf\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n    <None Update=\"Northwind\\Northwind.sl3\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n    <None Include=\"Northwind\\Northwind_log.ldf\">\n      <DependentUpon>Northwind.mdf</DependentUpon>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "samples/App/Utilities/ObjectDumper-LICENSE.txt",
    "content": "﻿MICROSOFT LIMITED PUBLIC LICENSE version 1.1\n\nThis license governs use of code marked as “sample” or “example” available on this web site without a license agreement, as provided under the section above titled “NOTICE SPECIFIC TO SOFTWARE AVAILABLE ON THIS WEB SITE.” If you use such code (the “software”), you accept this license. If you do not accept the license, do not use the software.\n\n\n1. Definitions\n\nThe terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.\n\nA “contribution” is the original software, or any additions or changes to the software.\n\nA “contributor” is any person that distributes its contribution under this license.\n\n“Licensed patents” are a contributor’s patent claims that read directly on its contribution.\n\n\n2. Grant of Rights\n\n(A) Copyright Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.\n\n(B) Patent Grant - Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.\n\n\n3. Conditions and Limitations\n\n(A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.\n\n(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.\n\n(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.\n\n(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.\n\n(E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.\n\n(F) Platform Limitation - The licenses granted in sections 2(A) and 2(B) extend only to the software or derivative works that you create that run directly on a Microsoft Windows operating system product, Microsoft run-time technology (such as the .NET Framework or Silverlight), or Microsoft application platform (such as Microsoft Office or Microsoft Dynamics)."
  },
  {
    "path": "samples/App/Utilities/ObjectDumper.cs",
    "content": "﻿// Copyright (C) Microsoft Corporation.  All rights reserved.\n// See ObjectDumper-LICENSE.txt for license information.\n\nusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Reflection;\n\npublic class ObjectDumper {\n\n    public static void Write(object element)\n    {\n        Write(element, 0);\n    }\n\n    public static void Write(object element, int depth)\n    {\n        Write(element, depth, Console.Out);\n    }\n\n    public static void Write(object element, int depth, TextWriter log)\n    {\n        ObjectDumper dumper = new ObjectDumper(depth);\n        dumper.writer = log;\n        dumper.WriteObject(null, element);\n    }\n\n    TextWriter writer;\n    int pos;\n    int level;\n    int depth;\n\n    private ObjectDumper(int depth)\n    {\n        this.depth = depth;\n    }\n\n    private void Write(string s)\n    {\n        if (s != null) {\n            writer.Write(s);\n            pos += s.Length;\n        }\n    }\n\n    private void WriteIndent()\n    {\n        for (int i = 0; i < level; i++) writer.Write(\"  \");\n    }\n\n    private void WriteLine()\n    {\n        writer.WriteLine();\n        pos = 0;\n    }\n\n    private void WriteTab()\n    {\n        Write(\"  \");\n        while (pos % 8 != 0) Write(\" \");\n    }\n\n    private void WriteObject(string prefix, object element)\n    {\n        if (element == null || element is ValueType || element is string) {\n            WriteIndent();\n            Write(prefix);\n            WriteValue(element);\n            WriteLine();\n        }\n        else {\n            IEnumerable enumerableElement = element as IEnumerable;\n            if (enumerableElement != null) {\n                foreach (object item in enumerableElement) {\n                    if (item is IEnumerable && !(item is string)) {\n                        WriteIndent();\n                        Write(prefix);\n                        Write(\"...\");\n                        WriteLine();\n                        if (level < depth) {\n                            level++;\n                            WriteObject(prefix, item);\n                            level--;\n                        }\n                    }\n                    else {\n                        WriteObject(prefix, item);\n                    }\n                }\n            }\n            else {\n                MemberInfo[] members = element.GetType().GetMembers(BindingFlags.Public | BindingFlags.Instance);\n                WriteIndent();\n                Write(prefix);\n                bool propWritten = false;\n                foreach (MemberInfo m in members) {\n                    FieldInfo f = m as FieldInfo;\n                    PropertyInfo p = m as PropertyInfo;\n                    if (f != null || p != null) {\n                        if (propWritten) {\n                            WriteTab();\n                        }\n                        else {\n                            propWritten = true;\n                        }\n                        Write(m.Name);\n                        Write(\"=\");\n                        Type t = f != null ? f.FieldType : p.PropertyType;\n                        if (t.IsValueType || t == typeof(string)) {\n                            WriteValue(f != null ? f.GetValue(element) : p.GetValue(element, null));\n                        }\n                        else {\n                            if (typeof(IEnumerable).IsAssignableFrom(t)) {\n                                Write(\"...\");\n                            }\n                            else {\n                                Write(\"{ }\");\n                            }\n                        }\n                    }\n                }\n                if (propWritten) WriteLine();\n                if (level < depth) {\n                    foreach (MemberInfo m in members) {\n                        FieldInfo f = m as FieldInfo;\n                        PropertyInfo p = m as PropertyInfo;\n                        if (f != null || p != null) {\n                            Type t = f != null ? f.FieldType : p.PropertyType;\n                            if (!(t.IsValueType || t == typeof(string))) {\n                                object value = f != null ? f.GetValue(element) : p.GetValue(element, null);\n                                if (value != null) {\n                                    level++;\n                                    WriteObject(m.Name + \": \", value);\n                                    level--;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private void WriteValue(object o)\n    {\n        if (o == null) {\n            Write(\"null\");\n        }\n        else if (o is DateTime) {\n            Write(((DateTime)o).ToShortDateString());\n        }\n        else if (o is ValueType || o is string) {\n            Write(o.ToString());\n        }\n        else if (o is IEnumerable) {\n            Write(\"...\");\n        }\n        else {\n            Write(\"{ }\");\n        }\n    }\n}\n"
  },
  {
    "path": "samples/CSharp/Database.Annotated.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing Samples.CSharp.Northwind;\n\nnamespace Samples.CSharp {\n\n   public class DatabaseAnnotatedSamples {\n\n      readonly NorthwindDatabase db;\n\n      public DatabaseAnnotatedSamples(NorthwindDatabase db) {\n         this.db = db;\n      }\n\n      public IEnumerable<Product> IncludeManyToOne() {\n\n         return db.Products\n            .Include(p => p.Category)\n            .Include(p => p.Supplier)\n            .Take(3)\n            .AsEnumerable();\n      }\n\n      public IEnumerable<EmployeeTerritory> IncludeManyToOneNested() {\n\n         return db.EmployeeTerritories\n            .Include(p => p.Territory.Region)\n            .Take(3)\n            .AsEnumerable();\n      }\n\n      public Region IncludeOneToMany() {\n\n         return db.Regions\n            .IncludeMany(p => p.Territories)\n            .First();\n      }\n\n      public bool ContainsKey() {\n         return db.Products.ContainsKey(1);\n      }\n\n      public Product Find() {\n         return db.Products.Find(1);\n      }\n\n      public void Transactions_AdoNet() {\n\n         using var tx = db.EnsureInTransaction();\n         // Connection is automatically opened if not open\n\n         var order = new Order {\n            CustomerID = \"ALFKI\",\n            OrderDetails = {\n               new OrderDetail { ProductID = 77, Quantity = 1 },\n               new OrderDetail { ProductID = 41, Quantity = 2 }\n            }\n         };\n\n         db.Orders.Add(order);\n\n         order.Freight = 10m;\n\n         db.Orders.Update(order);\n\n         // The following line is not needed when cascade delete is configured on the database\n         db.OrderDetails.RemoveRange(order.OrderDetails);\n\n         db.Orders.Remove(order);\n\n         tx.Commit();\n         // Connection is closed if wasn't open\n      }\n   }\n}"
  },
  {
    "path": "samples/CSharp/Database.Poco.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing DbExtensions;\nusing Samples.CSharp.Northwind;\n\nnamespace Samples.CSharp {\n\n   public class DatabasePocoSamples {\n\n      readonly Database db;\n\n      public DatabasePocoSamples(Database db) {\n         this.db = db;\n      }\n\n      public IEnumerable<Product> SelectWithManyToOne() {\n\n         var query = SQL\n            .SELECT(\"p.ProductID, p.ProductName, p.CategoryID, s.SupplierID, '' AS MissingProperty\")\n            ._(\"c.CategoryID AS Category$CategoryID, c.CategoryName AS Category$CategoryName\")\n            ._(\"s.SupplierID AS Supplier$SupplierID, s.CompanyName AS Supplier$CompanyName\")\n            .FROM(\"Products p\")\n            .LEFT_JOIN(\"Categories c ON p.CategoryID = c.CategoryID\")\n            .LEFT_JOIN(\"Suppliers s ON p.SupplierID = s.SupplierID\")\n            .WHERE($\"p.ProductID < {3}\");\n\n         return db.Map<Product>(query);\n      }\n\n      public IEnumerable<EmployeeTerritory> SelectWithManyToOneNested() {\n\n         var query = SQL\n            .SELECT(\"et.EmployeeID, et.TerritoryID\")\n            ._(\"t.TerritoryID AS Territory$TerritoryID, t.TerritoryDescription AS Territory$TerritoryDescription, t.RegionID AS Territory$RegionID\")\n            ._(\"r.RegionID AS Territory$Region$RegionID, r.RegionDescription AS Territory$Region$RegionDescription\")\n            .FROM(\"EmployeeTerritories et\")\n            .LEFT_JOIN(\"Territories t ON et.TerritoryID = t.TerritoryID\")\n            .LEFT_JOIN(\"Region r ON t.RegionID = r.RegionID\")\n            .WHERE($\"et.EmployeeID < {3}\");\n\n         return db.Map<EmployeeTerritory>(query);\n      }\n\n      public IEnumerable AnnonymousType() {\n\n         var query = SQL\n            .SELECT(\"p.ProductID, p.ProductName\")\n            .FROM(\"Products p\")\n            .WHERE($\"p.ProductID < {3}\");\n\n         return db.Map(query, r => new {\n            ProductID = r.GetInt32(0),\n            ProductName = r.GetStringOrNull(1)\n         });\n      }\n\n      public IEnumerable<ProductWithStockValue> MappingCalculatedColumn() {\n\n         var query = SQL\n            .SELECT(\"p.ProductID, (p.UnitPrice * p.UnitsInStock) AS ValueInStock\")\n            .FROM(\"Products p\")\n            .WHERE($\"p.ProductID < {3}\")\n            .ORDER_BY(\"ValueInStock\");\n\n         return db.Map<ProductWithStockValue>(query);\n      }\n\n      public MappingToConstructorArgumentsSample MappingToConstructorArguments() {\n\n         var query = SQL\n            .SELECT(\"1 AS '1'\")\n            ._(\"'http://example.com' AS Url$1\")\n            ._(\"15.5 AS Price$1, 'USD' AS Price$2\");\n\n         return db.Map<MappingToConstructorArgumentsSample>(query)\n            .Single();\n      }\n\n      public MappingToConstructorArgumentsSample MappingToConstructorArgumentsNested() {\n\n         var query = SQL\n            .SELECT(\"1 AS '1'\")\n            ._(\"'http://example.com' AS '2$1'\")\n            ._(\"15.5 AS '3$1', 'USD' AS '3$2'\");\n\n         return db.Map<MappingToConstructorArgumentsSample>(query)\n            .Single();\n      }\n\n      public IEnumerable<dynamic> Dynamic() {\n\n         var query = SQL\n            .SELECT(\"p.ProductID, p.ProductName, p.CategoryID, s.SupplierID\")\n            ._(\"c.CategoryID AS Category$CategoryID, c.CategoryName AS Category$CategoryName\")\n            ._(\"s.SupplierID AS Supplier$SupplierID, s.CompanyName AS Supplier$CompanyName\")\n            .FROM(\"Products p\")\n            .LEFT_JOIN(\"Categories c ON p.CategoryID = c.CategoryID\")\n            .LEFT_JOIN(\"Suppliers s ON p.SupplierID = s.SupplierID\")\n            .WHERE($\"p.ProductID < {3}\");\n\n         return db.Map(query);\n      }\n   }\n\n   public class ProductWithStockValue : Product {\n\n      public decimal ValueInStock { get; set; }\n   }\n\n   public class MappingToConstructorArgumentsSample {\n\n      public int Id { get; private set; }\n      public Uri Url { get; private set; }\n      public Money? Price { get; private set; }\n\n      public MappingToConstructorArgumentsSample(int id) {\n         this.Id = id;\n      }\n\n      public MappingToConstructorArgumentsSample(int id, Uri url, Money? price)\n         : this(id) {\n\n         this.Url = url;\n         this.Price = price;\n      }\n   }\n\n   public struct Money {\n\n      public readonly decimal Amount;\n      public readonly string Currency;\n\n      public Money(decimal amount, string currency) {\n         this.Amount = amount;\n         this.Currency = currency;\n      }\n\n      public override string ToString() {\n         return this.Currency + this.Amount.ToString();\n      }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Category.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Categories\")]\n   public class Category {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int CategoryID { get; set; }\n\n      [Column]\n      public string CategoryName { get; set; }\n\n      [Column]\n      public string Description { get; set; }\n\n      [Column]\n      public byte[] Picture { get; set; }\n\n      [Association(OtherKey = nameof(Product.CategoryID))]\n      public Collection<Product> Products { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Customer.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Customers\")]\n   public class Customer {\n\n      [Column(IsPrimaryKey = true)]\n      public string CustomerID { get; set; }\n\n      [Column]\n      public string CompanyName { get; set; }\n\n      [Column]\n      public string ContactName { get; set; }\n\n      [Column]\n      public string ContactTitle { get; set; }\n\n      [Column]\n      public string Address { get; set; }\n\n      [Column]\n      public string City { get; set; }\n\n      [Column]\n      public string Region { get; set; }\n\n      [Column]\n      public string PostalCode { get; set; }\n\n      [Column]\n      public string Country { get; set; }\n\n      [Column]\n      public string Phone { get; set; }\n\n      [Column]\n      public string Fax { get; set; }\n\n      [Association(OtherKey = nameof(CustomerCustomerDemo.CustomerID))]\n      public Collection<CustomerCustomerDemo> CustomerCustomerDemos { get; } = new();\n\n      [Association(OtherKey = nameof(Order.CustomerID))]\n      public Collection<Order> Orders { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/CustomerCustomerDemo.cs",
    "content": "﻿using System;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table]\n   public class CustomerCustomerDemo {\n\n      [Column(IsPrimaryKey = true)]\n      public string CustomerID { get; set; }\n\n      [Column(IsPrimaryKey = true)]\n      public string CustomerTypeID { get; set; }\n\n      [Association(ThisKey = nameof(CustomerTypeID))]\n      public CustomerDemographic CustomerDemographic { get; set; }\n\n      [Association(ThisKey = nameof(CustomerID))]\n      public Customer Customer { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/CustomerDemographic.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"CustomerDemographics\")]\n   public class CustomerDemographic {\n\n      [Column(IsPrimaryKey = true)]\n      public string CustomerTypeID { get; set; }\n\n      [Column]\n      public string CustomerDesc { get; set; }\n\n      [Association(OtherKey = nameof(CustomerCustomerDemo.CustomerTypeID))]\n      public Collection<CustomerCustomerDemo> CustomerCustomerDemos { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Employee.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Employees\")]\n   public class Employee {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int EmployeeID { get; set; }\n\n      [Column]\n      public string LastName { get; set; }\n\n      [Column]\n      public string FirstName { get; set; }\n\n      [Column]\n      public string Title { get; set; }\n\n      [Column]\n      public string TitleOfCourtesy { get; set; }\n\n      [Column]\n      public DateTime? BirthDate { get; set; }\n\n      [Column]\n      public DateTime? HireDate { get; set; }\n\n      [Column]\n      public string Address { get; set; }\n\n      [Column]\n      public string City { get; set; }\n\n      [Column]\n      public string Region { get; set; }\n\n      [Column]\n      public string PostalCode { get; set; }\n\n      [Column]\n      public string Country { get; set; }\n\n      [Column]\n      public string HomePhone { get; set; }\n\n      [Column]\n      public string Extension { get; set; }\n\n      [Column]\n      public byte[] Photo { get; set; }\n\n      [Column]\n      public string Notes { get; set; }\n\n      [Column]\n      public int? ReportsTo { get; set; }\n\n      [Column]\n      public string PhotoPath { get; set; }\n\n      [Association(ThisKey = nameof(ReportsTo))]\n      public Employee ReportsToEmployee { get; set; }\n\n      [Association(OtherKey = nameof(Employee.ReportsTo))]\n      public Collection<Employee> Employees { get; } = new();\n\n      [Association(OtherKey = nameof(EmployeeTerritory.EmployeeID))]\n      public Collection<EmployeeTerritory> EmployeeTerritories { get; } = new();\n\n      [Association(OtherKey = nameof(Order.EmployeeID))]\n      public Collection<Order> Orders { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/EmployeeTerritory.cs",
    "content": "﻿using System;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"EmployeeTerritories\")]\n   public class EmployeeTerritory {\n\n      [Column(IsPrimaryKey = true)]\n      public int EmployeeID { get; set; }\n\n      [Column(IsPrimaryKey = true)]\n      public string TerritoryID { get; set; }\n\n      [Association(ThisKey = nameof(EmployeeID))]\n      public Employee Employee { get; set; }\n\n      [Association(ThisKey = nameof(TerritoryID))]\n      public Territory Territory { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/NorthwindDatabase.cs",
    "content": "﻿using System;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   public class NorthwindDatabase : Database {\n\n      public SqlTable<Product> Products => Table<Product>();\n\n      public SqlTable<Order> Orders => Table<Order>();\n\n      public SqlTable<OrderDetail> OrderDetails => Table<OrderDetail>();\n\n      public SqlTable<Employee> Employees => Table<Employee>();\n\n      public SqlTable<EmployeeTerritory> EmployeeTerritories => Table<EmployeeTerritory>();\n\n      public SqlTable<Region> Regions => Table<Region>();\n\n      public NorthwindDatabase(string connectionString, string providerInvariantName)\n         : base(connectionString, providerInvariantName) { }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Order.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Orders\")]\n   public class Order {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int OrderID { get; set; }\n\n      [Column]\n      public string CustomerID { get; set; }\n\n      [Column]\n      public int? EmployeeID { get; set; }\n\n      [Column]\n      public DateTime? OrderDate { get; set; }\n\n      [Column]\n      public DateTime? RequiredDate { get; set; }\n\n      [Column]\n      public DateTime? ShippedDate { get; set; }\n\n      [Column]\n      public int? ShipVia { get; set; }\n\n      [Column]\n      public decimal? Freight { get; set; }\n\n      [Column]\n      public string ShipName { get; set; }\n\n      [Column]\n      public string ShipAddress { get; set; }\n\n      [Column]\n      public string ShipCity { get; set; }\n\n      [Column]\n      public string ShipRegion { get; set; }\n\n      [Column]\n      public string ShipPostalCode { get; set; }\n\n      [Column]\n      public string ShipCountry { get; set; }\n\n      [Association(OtherKey = nameof(OrderDetail.OrderID))]\n      public Collection<OrderDetail> OrderDetails { get; } = new();\n\n      [Association(ThisKey = nameof(CustomerID))]\n      public Customer Customer { get; set; }\n\n      [Association(ThisKey = nameof(EmployeeID))]\n      public Employee Employee { get; set; }\n\n      [Association(ThisKey = nameof(ShipVia))]\n      public Shipper Shipper { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/OrderDetail.cs",
    "content": "﻿using System;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Order Details\")]\n   public class OrderDetail {\n\n      [Column(IsPrimaryKey = true)]\n      public int OrderID { get; set; }\n\n      [Column(IsPrimaryKey = true)]\n      public int ProductID { get; set; }\n\n      [Column]\n      public decimal UnitPrice { get; set; }\n\n      [Column]\n      public short Quantity { get; set; }\n\n      [Column]\n      public float Discount { get; set; }\n\n      [Association(ThisKey = nameof(OrderID))]\n      public Order Order { get; set; }\n\n      [Association(ThisKey = nameof(ProductID))]\n      public Product Product { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Product.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Products\")]\n   public class Product {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int ProductID { get; set; }\n\n      [Column]\n      public string ProductName { get; set; }\n\n      [Column]\n      public int? SupplierID { get; set; }\n\n      [Column]\n      public int? CategoryID { get; set; }\n\n      [Column]\n      public string QuantityPerUnit { get; set; }\n\n      [Column]\n      public decimal? UnitPrice { get; set; }\n\n      [Column]\n      public short? UnitsInStock { get; set; }\n\n      [Column]\n      public short? UnitsOnOrder { get; set; }\n\n      [Column]\n      public short? ReorderLevel { get; set; }\n\n      [Column]\n      public bool Discontinued { get; set; }\n\n      [Association(OtherKey = nameof(OrderDetail.ProductID))]\n      public Collection<OrderDetail> OrderDetails { get; } = new();\n\n      [Association(ThisKey = nameof(CategoryID))]\n      public Category Category { get; set; }\n\n      [Association(ThisKey = nameof(SupplierID))]\n      public Supplier Supplier { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Region.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Region\")]\n   public class Region {\n\n      [Column(IsPrimaryKey = true)]\n      public int RegionID { get; set; }\n\n      [Column]\n      public string RegionDescription { get; set; }\n\n      [Association(OtherKey = nameof(Territory.RegionID))]\n      public Collection<Territory> Territories { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Shipper.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Shippers\")]\n   public class Shipper {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int ShipperID { get; set; }\n\n      [Column]\n      public string CompanyName { get; set; }\n\n      [Column]\n      public string Phone { get; set; }\n\n      [Association(OtherKey = nameof(Order.ShipVia))]\n      public Collection<Order> Orders { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Supplier.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Suppliers\")]\n   public class Supplier {\n\n      [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n      public int SupplierID { get; set; }\n\n      [Column]\n      public string CompanyName { get; set; }\n\n      [Column]\n      public string ContactName { get; set; }\n\n      [Column]\n      public string ContactTitle { get; set; }\n\n      [Column]\n      public string Address { get; set; }\n\n      [Column]\n      public string City { get; set; }\n\n      [Column]\n      public string Region { get; set; }\n\n      [Column]\n      public string PostalCode { get; set; }\n\n      [Column]\n      public string Country { get; set; }\n\n      [Column]\n      public string Phone { get; set; }\n\n      [Column]\n      public string Fax { get; set; }\n\n      [Association(OtherKey = nameof(Product.SupplierID))]\n      public Collection<Product> Products { get; } = new();\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Northwind/Territory.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing DbExtensions;\n\nnamespace Samples.CSharp.Northwind {\n\n   [Table(Name = \"Territories\")]\n   public class Territory {\n\n      [Column(IsPrimaryKey = true)]\n      public string TerritoryID { get; set; }\n\n      [Column]\n      public string TerritoryDescription { get; set; }\n\n      [Column]\n      public int RegionID { get; set; }\n\n      [Association(OtherKey = nameof(EmployeeTerritory.TerritoryID))]\n      public Collection<EmployeeTerritory> EmployeeTerritories { get; } = new();\n\n      [Association(ThisKey = nameof(RegionID))]\n      public Region Region { get; set; }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/Samples.CSharp.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0</TargetFrameworks>\n    <LangVersion>12</LangVersion>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\DbExtensions\\DbExtensions.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "samples/CSharp/SqlBuilder.cs",
    "content": "﻿using System;\nusing DbExtensions;\n\nnamespace Samples.CSharp {\n\n   public class SqlBuilderSamples {\n\n#pragma warning disable CA1822\n      public SqlBuilder DynamicSql_1() {\n         return DynamicSql(2, 3);\n      }\n\n      public SqlBuilder DynamicSql_2() {\n         return DynamicSql(null, 3);\n      }\n\n      public SqlBuilder DynamicSql_3() {\n         return DynamicSql(2, null);\n      }\n\n      public SqlBuilder DynamicSql_4() {\n         return DynamicSql(null, null);\n      }\n\n      SqlBuilder DynamicSql(int? categoryId, int? supplierId) {\n\n         return SQL\n            .SELECT(\"p.ProductID, p.ProductName\")\n            .FROM(\"Products p\")\n            .WHERE()\n            ._If(categoryId.HasValue, $\"p.CategoryID = {categoryId.Value}\")\n            ._If(supplierId.HasValue, $\"p.SupplierID = {supplierId.Value}\")\n            .ORDER_BY(\"p.ProductName, p.ProductID DESC\");\n      }\n\n      public SqlBuilder Subquery() {\n\n         return SQL\n            .SELECT($\"o.OrderID, o.CustomerID, ({SQL\n               .SELECT(\"COUNT(od.Quantity)\")\n               .FROM(\"OrderDetails od\")\n               .WHERE(\"od.OrderID = o.OrderID\")}) AS TotalItems\")\n            .FROM(\"Orders o\");\n      }\n\n      public SqlBuilder ExtendRawSql() {\n\n         return ((SqlBuilder)$\"\"\"\n             SELECT ProductID, ProductName\n             FROM Products\n             \"\"\")\n            .WHERE($\"CategoryID = {1}\");\n      }\n\n      public SqlBuilder ListArgument() {\n\n         int[] range = { 1, 2, 3 };\n\n         return SQL\n            .SELECT(\"p.ProductID, p.CategoryID\")\n            .FROM(\"Products p\")\n            .WHERE($\"p.CategoryID = {1} AND p.ProductID IN ({range:list})\")\n            ._($\"EXISTS ({SQL\n               .SELECT(\"ProductID\")\n               .FROM(\"OrderDetails\")\n               .WHERE($\"OrderID = {77}\")})\")\n            .GROUP_BY(\"p.ProductID\");\n      }\n\n      public SqlBuilder Insert() {\n\n         return SQL\n            .INSERT_INTO(\"Products(ProductName, UnitPrice, CategoryID)\")\n            .VALUES(\"Chai\", 15.56, 5);\n      }\n\n      public SqlBuilder Update() {\n\n         return SQL\n            .UPDATE(\"Products\")\n            .SET($\"Discontinued = {true}\")\n            .WHERE($\"ProductID = {1}\");\n      }\n\n      public SqlBuilder UpdateWithSubquery() {\n\n         return SQL\n            .UPDATE(\"Products p\")\n            .SET($\"p.Discontinued = {true}\")\n            .WHERE($\"p.ProductID = ({SQL\n               .SELECT(\"p2.ProductID\")\n               .FROM(\"Products p2\")\n               .WHERE(\"p2.ProductID <> p.ProductID\")})\");\n      }\n\n      public SqlBuilder Delete() {\n\n         return SQL\n            .DELETE_FROM(\"Products\")\n            .WHERE($\"ProductID = {1}\");\n      }\n\n      /// <summary>\n      /// SELECT Products.*, Categories.CategoryName\n      /// FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID\n      /// WHERE (((Products.Discontinued)=0))\n      /// </summary>\n      /// <remarks>Northwind.Alphabetical list of products</remarks>\n\n      public SqlBuilder AlphabeticalListOfProducts() {\n\n         return SQL\n            .SELECT(\"Products.*, Categories.CategoryName\")\n            .FROM(\"Categories\")\n            .LEFT_JOIN(\"Products ON Categories.CategoryID = Products.CategoryID\")\n            .WHERE($\"Products.Discontinued = {0}\");\n      }\n\n      /// <summary>\n      /// SELECT City, CompanyName, ContactName, 'Customers' AS Relationship \n      /// FROM Customers\n      /// UNION SELECT City, CompanyName, ContactName, 'Suppliers'\n      /// FROM Suppliers\n      /// </summary>\n      /// <remarks>Northwind.Customer and Suppliers by City</remarks>\n\n      public SqlBuilder CustomersAndSuppliersByCity() {\n\n         return SQL\n            .SELECT(\"City, CompanyName, ContactName, 'Customers' AS Relationship\")\n            .FROM(\"Customers\")\n            .UNION()\n            .SELECT(\"City, CompanyName, ContactName, 'Suppliers'\")\n            .FROM(\"Suppliers\");\n      }\n\n      /// <summary>\n      /// SELECT Products.ProductName, Products.UnitPrice\n      /// FROM Products\n      /// WHERE Products.UnitPrice > (SELECT AVG(UnitPrice) From Products)\n      /// </summary>\n      /// <remarks>Northwind.Products Above Average Price</remarks>\n\n      public SqlBuilder ProductsAboveAveragePrice() {\n\n         return SQL\n            .SELECT(\"Products.ProductName, Products.UnitPrice\")\n            .FROM(\"Products\")\n            .WHERE($\"Products.UnitPrice > ({SQL\n               .SELECT(\"AVG(UnitPrice)\")\n               .FROM(\"Products\")})\");\n      }\n\n      /// <summary>\n      /// SELECT Categories.CategoryName, Products.ProductName, \n      /// Sum(CONVERT(money,(\"Order Details\".UnitPrice*Quantity*(1-Discount)/100))*100) AS ProductSales\n      /// FROM (Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID) \n      /// INNER JOIN (Orders \n      ///       INNER JOIN \"Order Details\" ON Orders.OrderID = \"Order Details\".OrderID) \n      ///    ON Products.ProductID = \"Order Details\".ProductID\n      /// WHERE (((Orders.ShippedDate) Between '19970101' And '19971231'))\n      /// GROUP BY Categories.CategoryName, Products.ProductName\n      /// </summary>\n      /// <remarks>Northwind.Product Sales for 1997</remarks>\n\n      public SqlBuilder ProductSalesFor1997() {\n\n         return SQL\n            .SELECT(\"Categories.CategoryName, Products.ProductName, Sum(CONVERT(money,(\\\"Order Details\\\".UnitPrice*Quantity*(1-Discount)/100))*100) AS ProductSales\")\n            .FROM(\"(Categories\").INNER_JOIN(\"Products ON Categories.CategoryID = Products.CategoryID)\")\n            .INNER_JOIN(\"(Orders\").INNER_JOIN(\"\\\"Order Details\\\" ON Orders.OrderID = \\\"Order Details\\\".OrderID) ON Products.ProductID = \\\"Order Details\\\".ProductID\")\n            .WHERE($\"(((Orders.ShippedDate) Between {new DateTime(1997, 1, 1)} And {new DateTime(1997, 12, 31)}))\")\n            .GROUP_BY(\"Categories.CategoryName, Products.ProductName\");\n      }\n   }\n}\n"
  },
  {
    "path": "samples/CSharp/SqlSet.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing DbExtensions;\nusing Samples.CSharp.Northwind;\n\nnamespace Samples.CSharp {\n   \n   public class SqlSetSamples {\n\n      readonly SqlSet<Product> products;\n\n      public SqlSetSamples(Database db) {\n         this.products = db.From<Product>(\"Products\");\n      }\n\n      public bool AreThereAnyProducts() {\n         return products.Any();\n      }\n\n      public bool DoAllProductsHaveUnitPrice() {\n         return products.All(\"NOT UnitPrice IS NULL\");\n      }\n\n      public bool DoSomeProductsAreOutOfStock() {\n         return products.Any(\"UnitsInStock = 0\");\n      }\n\n      public int HowManyProductsAreOutOfStock() {\n         return products.Count(\"UnitsInStock = 0\");\n      }\n\n      public Product FirstProduct() {\n         return products.First();\n      }\n\n      public Product SecondProduct() {\n         return products.Skip(1).First();\n      }\n\n      public Product FirstOutOfStockProduct() {\n         return products.First(\"UnitsInStock = 0\");\n      }\n\n      public IEnumerable Top5ProductsWithLowestStock() {\n         \n         return products\n            .Where(\"UnitsInStock > 0\")\n            .OrderBy(\"UnitsInStock\")\n            .Take(5)\n            .Select(\"ProductName, UnitsInStock\",\n               r => new { Name = r.GetString(0), UnitsInStock = r.GetInt16(1) })\n            .AsEnumerable();\n      }\n\n      public IEnumerable<string> NamesOfOutOfStockProducts() {\n         \n         return products\n            .Where(\"UnitsInStock = 0\")\n            .Select(\"ProductName\", r => r.GetString(0))\n            .AsEnumerable();\n      }\n\n      public Product GetSpecificProduct() {\n         return products.SingleOrDefault(\"ProductID = 5\");\n      }\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/.editorconfig",
    "content": "﻿[*.cs]\n\n# CA2007: Consider calling ConfigureAwait on the awaited task\ndotnet_diagnostic.CA2007.severity = warning\n"
  },
  {
    "path": "src/DbExtensions/Attributes.cs",
    "content": "﻿// Copyright 2016-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\n\nnamespace DbExtensions;\n\n#nullable enable\n\n[AttributeUsage(AttributeTargets.Class)]\nsealed class DatabaseAttribute : Attribute {\n\n   public string?\n   Name { get; set; }\n}\n\n/// <summary>\n/// Designates a class as an entity class that is associated with a database table.\n/// </summary>\n\n[AttributeUsage(AttributeTargets.Class, Inherited = false)]\npublic sealed class TableAttribute : Attribute {\n\n   /// <summary>\n   /// Gets or sets the name of the table or view.\n   /// </summary>\n\n   public string?\n   Name { get; set; }\n}\n\n/// <summary>\n/// Associates a property with a column in a database table.\n/// </summary>\n\n[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]\npublic sealed class ColumnAttribute : Attribute, IDataAttribute {\n\n   bool\n   _canBeNull = true;\n\n   bool\n   _canBeNullSet = false;\n\n   /// <summary>\n   /// Gets or sets the name of a column.\n   /// </summary>\n\n   public string?\n   Name { get; set; }\n\n   /// <summary>\n   /// Gets or sets a private storage field to hold the value from a column.\n   /// </summary>\n\n   string?\n   IDataAttribute.Storage { get; set; }\n\n   /// <summary>\n   /// Gets or sets the type of the database column.\n   /// </summary>\n\n   internal string?\n   DbType { get; set; }\n\n   /// <summary>\n   /// Gets or sets the type to convert this member to before sending to the database.\n   /// </summary>\n\n   public Type?\n   ConvertTo { get; set; }\n\n   internal string?\n   Expression { get; set; }\n\n   /// <summary>\n   /// Gets or sets whether this class member represents a column that is part or all of the primary key of the table.\n   /// </summary>\n\n   public bool\n   IsPrimaryKey { get; set; }\n\n   /// <summary>\n   ///  Gets or sets whether a column contains values that the database auto-generates.\n   /// </summary>\n\n   public bool\n   IsDbGenerated { get; set; }\n\n   /// <summary>\n   /// Gets or sets whether the column type of the member is a database timestamp or version number.\n   /// </summary>\n\n   public bool\n   IsVersion { get; set; }\n\n   internal UpdateCheck\n   UpdateCheck { get; set; } = UpdateCheck.Always;\n\n   /// <summary>\n   /// Gets or sets the <see cref=\"DbExtensions.AutoSync\"/> enumeration.\n   /// </summary>\n\n   public AutoSync\n   AutoSync { get; set; } = AutoSync.Default;\n\n   internal bool\n   IsDiscriminator { get; set; }\n\n   internal bool\n   CanBeNull {\n      get => _canBeNull;\n      set {\n         _canBeNullSet = true;\n         _canBeNull = value;\n      }\n   }\n\n   internal bool\n   CanBeNullSet => _canBeNullSet;\n}\n\ninternal enum UpdateCheck {\n   Always,\n   Never,\n   WhenChanged\n}\n\n/// <summary>\n/// Used to specify for during INSERT and UPDATE operations when\n/// a data member should be read back after the operation completes.\n/// </summary>\n\npublic enum AutoSync {\n\n   /// <summary>\n   /// Automatically selects the value.\n   /// </summary>\n\n   Default = 0, // Automatically choose\n\n   /// <summary>\n   /// Always returns the value.\n   /// </summary>\n\n   Always = 1,\n\n   /// <summary>\n   /// Never returns the value.\n   /// </summary>\n\n   Never = 2,\n\n   /// <summary>\n   /// Returns the value only after an INSERT operation.\n   /// </summary>\n\n   OnInsert = 3,\n\n   /// <summary>\n   /// Returns the value only after an UPDATE operation.\n   /// </summary>\n\n   OnUpdate = 4\n}\n\n/// <summary>\n/// Designates a property to represent a database association, such as a foreign key relationship.\n/// </summary>\n\n[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]\npublic sealed class AssociationAttribute : Attribute, IDataAttribute {\n\n   /// <summary>\n   /// Gets or sets the name of a constraint.\n   /// </summary>\n\n   public string?\n   Name { get; set; }\n\n   /// <summary>\n   /// Gets or sets a private storage field to hold the value for the association property.\n   /// </summary>\n\n   string?\n   IDataAttribute.Storage { get; set; }\n\n   /// <summary>\n   /// Gets or sets members of this entity class to represent the key values on this side of the association.\n   /// </summary>\n\n   public string?\n   ThisKey { get; set; }\n\n   /// <summary>\n   /// Gets or sets one or more members of the target entity class as key values on the other side of the association.\n   /// </summary>\n\n   public string?\n   OtherKey { get; set; }\n\n   /// <summary>\n   /// Gets or sets the indication of a uniqueness constraint on the foreign key.\n   /// </summary>\n   /// <remarks>When true, this property indicates a true 1:1 relationship.</remarks>\n\n   internal bool\n   IsUnique { get; set; }\n\n   /// <summary>\n   /// Gets or sets the member as the foreign key in an association representing a database relationship.\n   /// </summary>\n\n   internal bool\n   IsForeignKey { get; set; }\n\n   internal string?\n   DeleteRule { get; set; }\n\n   internal bool\n   DeleteOnNull { get; set; }\n}\n\n/// <summary>\n/// Class attribute used to describe an inheritance hierarchy to be mapped.\n/// For example, \n/// \n///     [Table(Name = \"People\")]\n///     [InheritanceMapping(\"P\", typeof(Person), IsDefault=true)]\n///     [InheritanceMapping(\"C\", typeof(Customer))]\n///     [InheritanceMapping(\"E\", typeof(Employee))]\n///     class Person { ... }\n///     \n/// </summary>\n\n[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]\nsealed class InheritanceMappingAttribute : Attribute {\n\n   /// <summary>\n   /// Discriminator value in store column for this type.\n   /// </summary>\n\n   public object\n   Code { get; }\n\n   /// <summary>\n   /// Type to instantiate when Key is matched.\n   /// </summary>\n\n   public Type\n   Type { get; }\n\n   /// <summary>\n   /// If discriminator value in store column is unrecognized then instantiate this type.\n   /// </summary>\n\n   public bool\n   IsDefault { get; set; }\n\n   public\n   InheritanceMappingAttribute(object code, Type type) {\n\n      ArgumentNullException.ThrowIfNull(code);\n      ArgumentNullException.ThrowIfNull(type);\n\n      this.Code = code;\n      this.Type = type;\n   }\n}\n\ninterface IDataAttribute {\n\n   string?\n   Name { get; set; }\n\n   string?\n   Storage { get; set; }\n}\n\n/// <summary>\n/// Designates a property as a complex property that groups columns of a table that share the same base name.\n/// </summary>\n\n[AttributeUsage(AttributeTargets.Property)]\npublic sealed class ComplexPropertyAttribute : Attribute {\n\n   /// <summary>\n   /// The base name for the columns on the complex property.\n   /// The default is the property name.\n   /// </summary>\n\n   public string?\n   Name { get; set; }\n\n   /// <summary>\n   /// The separator to use between the base name and the complex property's columns.\n   /// The default is null, which means the separator is taken from <see cref=\"DatabaseConfiguration.DefaultComplexPropertySeparator\" qualifyHint=\"true\"/>.\n   /// To use no separator and override the default configuration, use an empty <see cref=\"String\"/>.\n   /// </summary>\n\n   public string?\n   Separator { get; set; }\n\n   /// <summary>\n   /// Initializes a new instance of the <see cref=\"ComplexPropertyAttribute\"/> class\n   /// </summary>\n\n   public\n   ComplexPropertyAttribute() { }\n\n   internal\n   ComplexPropertyAttribute(ComplexPropertyAttribute other) {\n      this.Name = other.Name;\n      this.Separator = other.Separator;\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Database.cs",
    "content": "﻿// Copyright 2009-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Data.Common;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace DbExtensions;\n\n#nullable enable\n\n#if DBEX_QE\n/// <summary>\n/// Provides simple data access using <see cref=\"SqlSet\"/> and <see cref=\"SqlBuilder\"/>.\n/// </summary>\n#else\n/// <summary>\n/// Provides simple data access using <see cref=\"SqlSet\"/>, <see cref=\"SqlBuilder\"/> and <see cref=\"SqlTable&lt;TEntity>\"/>.\n/// </summary>\n#endif\n\npublic partial class Database : IDisposable {\n\n   readonly bool\n   _disposeConn;\n\n   /// <summary>\n   /// Gets the connection to associate with new commands.\n   /// </summary>\n\n   public DbConnection\n   Connection { get; }\n\n   /// <summary>\n   /// Gets or sets a transaction to associate with new commands.\n   /// </summary>\t\t\n\n   public DbTransaction?\n   Transaction { get; set; }\n\n   /// <summary>\n   /// Provides access to configuration options for this instance. \n   /// </summary>\n\n   public DatabaseConfiguration\n   Configuration { get; private set; }\n\n   /// <summary>\n   /// Initializes a new instance of the <see cref=\"Database\"/> class\n   /// using the provided connection string and provider's invariant name.\n   /// </summary>\n   /// <param name=\"connectionString\">The connection string.</param>\n   /// <param name=\"providerInvariantName\">The provider's invariant name.</param>\n\n#pragma warning disable CS8618\n   public\n   Database(string connectionString, string providerInvariantName) {\n\n      ArgumentNullException.ThrowIfNull(connectionString);\n      ArgumentNullException.ThrowIfNull(providerInvariantName);\n\n      var factory = DbProviderFactories.GetFactory(providerInvariantName);\n\n      var connection = factory.CreateConnection()\n         ?? throw new ArgumentException(\"The provider factory CreateConnection() returned null.\", nameof(providerInvariantName));\n\n      connection.ConnectionString = connectionString;\n\n      this.Connection = connection;\n      _disposeConn = true;\n\n      Initialize(providerInvariantName);\n   }\n\n   /// <summary>\n   /// Initializes a new instance of the <see cref=\"Database\"/> class\n   /// using the provided connection.\n   /// </summary>\n   /// <param name=\"connection\">The connection.</param>\n\n   public\n   Database(DbConnection connection) {\n\n      ArgumentNullException.ThrowIfNull(connection);\n\n      this.Connection = connection;\n\n      Initialize(null);\n   }\n\n   internal // Used by tests\n   Database(DbConnection connection, string providerInvariantName) {\n\n      ArgumentNullException.ThrowIfNull(connection);\n      ArgumentNullException.ThrowIfNull(providerInvariantName);\n\n      this.Connection = connection;\n\n      Initialize(providerInvariantName);\n   }\n#pragma warning restore CS8618\n\n   void\n   Initialize(string? providerInvariantName) {\n\n      providerInvariantName ??= this.Connection.GetType().Namespace\n         ?? throw new InvalidOperationException(\"Couldn't determine provider invariant name.\");\n\n      this.Configuration = new DatabaseConfiguration(\n         providerInvariantName,\n         () => CreateCommandBuilder(providerInvariantName));\n\n      Initialize2(providerInvariantName);\n   }\n\n   partial void\n   Initialize2(string providerInvariantName);\n\n   DbCommandBuilder?\n   CreateCommandBuilder(string providerInvariantName) {\n\n      var factory = DbProviderFactories.GetFactory(this.Connection)\n         ?? DbProviderFactories.GetFactory(providerInvariantName);\n\n      return factory.CreateCommandBuilder();\n   }\n\n   /// <summary>\n   /// Opens <see cref=\"Connection\"/> (if it's not open) and returns an <see cref=\"IDisposable\"/> object\n   /// you can use to close it (if it wasn't open).\n   /// </summary>\n   /// <returns>An <see cref=\"IDisposable\"/> object to close the connection.</returns>\n   /// <remarks>\n   /// Use this method with the <c>using</c> statement in C# or Visual Basic to ensure that a block of code\n   /// is always executed with an open connection.\n   /// </remarks>\n   /// <example>\n   /// <code>\n   /// using (db.EnsureConnectionOpen()) {\n   ///   // Execute commands.\n   /// }\n   /// </code>\n   /// </example>\n\n   public IDisposable\n   EnsureConnectionOpen() {\n\n      var conn = this.Connection;\n      var wasClosed = (conn.State == ConnectionState.Closed);\n\n      if (wasClosed) {\n         conn.Open();\n      }\n\n      return new WrappedConnection((wasClosed) ? conn : null);\n   }\n\n   /// <summary>\n   /// Opens <see cref=\"Connection\"/> (if it's not open) and returns an <see cref=\"IAsyncDisposable\"/> object\n   /// you can use to close it (if it wasn't open).\n   /// </summary>\n   /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> to monitor for cancellation requests. The default is <see cref=\"CancellationToken.None\"/>.</param>\n   /// <returns>An <see cref=\"IAsyncDisposable\"/> object to close the connection.</returns>\n   /// <remarks>\n   /// Use this method with the <c>using</c> statement in C# or Visual Basic to ensure that a block of code\n   /// is always executed with an open connection.\n   /// </remarks>\n   /// <example>\n   /// <code>\n   /// await using (await db.EnsureConnectionOpenAsync()) {\n   ///   // Execute commands.\n   /// }\n   /// </code>\n   /// </example>\n\n   public async ValueTask<IAsyncDisposable>\n   EnsureConnectionOpenAsync(CancellationToken cancellationToken = default) {\n\n      var conn = this.Connection;\n      var wasClosed = (conn.State == ConnectionState.Closed);\n\n      if (wasClosed) {\n\n         await conn.OpenAsync(cancellationToken)\n            .ConfigureAwait(false);\n      }\n\n      return new WrappedConnection((wasClosed) ? conn : null);\n   }\n\n   /// <summary>\n   /// Returns a virtual transaction that you can use to ensure a code block is always executed in \n   /// a transaction, new or existing.\n   /// </summary>\n   /// <returns>\n   /// A virtual transaction you can use to ensure a code block is always executed in \n   /// a transaction, new or existing.\n   /// </returns>\n   /// <remarks>\n   /// This method returns a virtual transaction that wraps an existing or new transaction.\n   /// By calling <see cref=\"DbTransaction.Commit()\"/> on the returned object, this object\n   /// will then call <see cref=\"DbTransaction.Commit()\"/> on the wrapped transaction if the\n   /// transaction was just created, or do nothing if it was previously created.\n   /// </remarks>\n   /// <example>\n   /// <para>\n   /// Calls to this method can be nested, like in the following example:\n   /// </para>\n   /// <code>\n   /// void DoSomething() {\n   /// \n   ///    using (var tx = this.db.EnsureInTransaction()) {\n   ///       \n   ///       // Execute commands\n   /// \n   ///       DoSomethingElse();\n   /// \n   ///       tx.Commit();\n   ///    }\n   /// }\n   /// \n   /// void DoSomethingElse() { \n   ///    \n   ///    using (var tx = this.db.EnsureInTransaction()) {\n   ///       \n   ///       // Execute commands\n   /// \n   ///       tx.Commit();\n   ///    }\n   /// }\n   /// </code>\n   /// </example>\n\n   public DbTransaction\n   EnsureInTransaction() =>\n      EnsureInTransaction(IsolationLevel.Unspecified);\n\n   /// <inheritdoc cref=\"EnsureInTransaction()\"/>\n   /// <param name=\"isolationLevel\">\n   /// Specifies the isolation level for the transaction. This parameter is ignored when using\n   /// an existing transaction.\n   /// </param>\n\n   public virtual DbTransaction\n   EnsureInTransaction(IsolationLevel isolationLevel) {\n\n      var connHolder = (WrappedConnection)EnsureConnectionOpen();\n      var newTx = default(DbTransaction);\n\n      try {\n\n         if (this.Transaction is null) {\n            this.Transaction = (newTx = this.Connection.BeginTransaction(isolationLevel));\n            this.Configuration.Log?.WriteLine(\"-- TRANSACTION STARTED\");\n         }\n\n      } catch {\n\n         connHolder.Dispose();\n         throw;\n      }\n\n      if (newTx != null) {\n         return new WrappedTransaction(this, newTx, connHolder);\n      }\n\n      return new NoOpTransaction(this.Connection, isolationLevel, connHolder);\n   }\n\n   /// <inheritdoc cref=\"EnsureInTransaction()\" path=\"*[not(self::example)]\"/>\n   /// <inheritdoc cref=\"EnsureConnectionOpenAsync\" path=\"param\"/>\n   /// <example>\n   /// <para>\n   /// Calls to this method can be nested, like in the following example:\n   /// </para>\n   /// <code>\n   /// async Task DoSomething() {\n   /// \n   ///    await using (var tx = await this.db.EnsureInTransactionAsync()) {\n   ///       \n   ///       // Execute commands\n   /// \n   ///       await DoSomethingElse();\n   /// \n   ///       await tx.CommitAsync();\n   ///    }\n   /// }\n   /// \n   /// async Task DoSomethingElse() {\n   ///    \n   ///    await using (var tx = await this.db.EnsureInTransactionAsync()) {\n   ///       \n   ///       // Execute commands\n   /// \n   ///       await tx.CommitAsync();\n   ///    }\n   /// }\n   /// </code>\n   /// </example>\n\n   public ValueTask<DbTransaction>\n   EnsureInTransactionAsync(CancellationToken cancellationToken = default) =>\n      EnsureInTransactionAsync(IsolationLevel.Unspecified, cancellationToken);\n\n   /// <inheritdoc cref=\"EnsureInTransactionAsync(CancellationToken)\"/>\n   /// <inheritdoc cref=\"EnsureInTransaction(IsolationLevel)\" path=\"param\"/>\n\n   public virtual async ValueTask<DbTransaction>\n   EnsureInTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken = default) {\n\n      var connHolder = (WrappedConnection)EnsureConnectionOpen();\n      var newTx = default(DbTransaction);\n\n      try {\n\n         if (this.Transaction is null) {\n\n            this.Transaction = (newTx = await this.Connection.BeginTransactionAsync(isolationLevel, cancellationToken)\n               .ConfigureAwait(false));\n\n            this.Configuration.Log?.WriteLine(\"-- TRANSACTION STARTED\");\n         }\n\n      } catch {\n\n         await connHolder.DisposeAsync()\n            .ConfigureAwait(false);\n\n         throw;\n      }\n\n      if (newTx != null) {\n         return new WrappedTransaction(this, newTx, connHolder);\n      }\n\n      return new NoOpTransaction(this.Connection, isolationLevel, connHolder);\n   }\n\n   /// <summary>\n   /// Executes the <paramref name=\"nonQuery\"/> command. Optionally uses a transaction and validates\n   /// affected records value before committing.\n   /// </summary>\n   /// <param name=\"nonQuery\">The non-query command to execute.</param>\n   /// <param name=\"affect\">The number of records the command should affect. This value is ignored if less or equal to -1.</param>\n   /// <param name=\"exact\"><c>true</c> if the number of affected records should exactly match <paramref name=\"affect\"/>; <c>false</c> if a lower number is acceptable.</param>\n   /// <returns>The number of affected records.</returns>\n   /// <exception cref=\"ChangeConflictException\">The number of affected records is not equal to <paramref name=\"affect\"/>.</exception>\n\n   public int\n   Execute(SqlBuilder nonQuery, int affect = -1, bool exact = false) {\n\n      ArgumentNullException.ThrowIfNull(nonQuery);\n\n      var command = CreateCommand(nonQuery);\n      var validateAffected = affect > -1;\n\n      using var conn = EnsureConnectionOpen();\n      using var tx = (validateAffected) ? EnsureInTransaction() : null;\n\n      command.Transaction = this.Transaction;\n\n      int affectedRecords;\n\n      try {\n         affectedRecords = command.ExecuteNonQuery();\n      } catch {\n\n         Trace(command, error: true);\n         throw;\n      }\n\n      OnExecuted(command, affect, exact, validateAffected, affectedRecords);\n\n      tx?.Commit();\n\n      return affectedRecords;\n   }\n\n   /// <inheritdoc cref=\"Execute\"/>\n   /// <inheritdoc cref=\"EnsureConnectionOpenAsync\" path=\"param\"/>\n\n   public async ValueTask<int>\n   ExecuteAsync(SqlBuilder nonQuery, int affect = -1, bool exact = false, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(nonQuery);\n\n      var command = CreateCommand(nonQuery);\n      var validateAffected = affect > -1;\n\n      await using var conn = (await EnsureConnectionOpenAsync(cancellationToken)\n            .ConfigureAwait(false))\n         .ConfigureAwait(false);\n\n      var tx = (validateAffected) ?\n         await EnsureInTransactionAsync(cancellationToken).ConfigureAwait(false)\n         : new NoOpTransaction(this.Connection, IsolationLevel.Unspecified, new WrappedConnection(null));\n\n      await using var txDisp = tx.ConfigureAwait(false);\n\n      command.Transaction = this.Transaction;\n\n      int affectedRecords;\n\n      try {\n\n         affectedRecords = await command.ExecuteNonQueryAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n      } catch {\n\n         Trace(command, error: true);\n         throw;\n      }\n\n      OnExecuted(command, affect, exact, validateAffected, affectedRecords);\n\n      await tx.CommitAsync(cancellationToken)\n         .ConfigureAwait(false);\n\n      return affectedRecords;\n   }\n\n   void\n   OnExecuted(DbCommand command, int affect, bool exact, bool validateAffected, int affectedRecords) {\n\n      Trace(command, affectedRecords);\n\n      if (validateAffected\n         && affectedRecords != affect) {\n\n         if (exact) {\n\n            throw new ChangeConflictException(String.Create(\n               CultureInfo.InvariantCulture,\n               $\"The number of affected records should be {affect}, the actual number is {affectedRecords}.\"));\n\n         } else if (affectedRecords > affect) {\n\n            throw new ChangeConflictException(String.Create(\n               CultureInfo.InvariantCulture,\n               $\"The number of affected records should be {affect} or lower, the actual number is {affectedRecords}.\"));\n         }\n      }\n   }\n\n   /// <summary>\n   /// Maps the results of the <paramref name=\"query\"/> to <typeparamref name=\"TResult\"/> objects,\n   /// using the provided <paramref name=\"mapper\"/> delegate.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type of objects to map the results to.</typeparam>\n   /// <param name=\"query\">The query.</param>\n   /// <param name=\"mapper\">The delegate for creating <typeparamref name=\"TResult\"/> objects from an <see cref=\"DbDataReader\"/> object.</param>\n   /// <returns>The results of the query as <typeparamref name=\"TResult\"/> objects.</returns>\n\n   public IEnumerable<TResult>\n   Map<TResult>(SqlBuilder query, Func<DbDataReader, TResult> mapper) {\n\n      ArgumentNullException.ThrowIfNull(query);\n      ArgumentNullException.ThrowIfNull(mapper);\n\n      return new MappingEnumerable<TResult>(CreateCommand(query), mapper, this.Configuration.Log);\n   }\n\n   /// <inheritdoc cref=\"Map&lt;TResult>(SqlBuilder, Func&lt;DbDataReader, TResult>)\"/>\n\n   public IAsyncEnumerable<TResult>\n   AsyncMap<TResult>(SqlBuilder query, Func<DbDataReader, TResult> mapper) {\n\n      ArgumentNullException.ThrowIfNull(query);\n      ArgumentNullException.ThrowIfNull(mapper);\n\n      return new AsyncMappingEnumerable<TResult>(CreateCommand(query), mapper, this.Configuration.Log);\n   }\n\n   /// <summary>\n   /// Gets the identity value of the last inserted record.\n   /// </summary>\n   /// <returns>The identity value of the last inserted record.</returns>\n   /// <remarks>\n   /// It is very important to keep the connection open between the last \n   /// command and this one, or else you might get the wrong value.\n   /// </remarks>\n\n   public virtual object?\n   LastInsertId() {\n\n      var sql = this.Configuration.LastInsertIdCommand;\n\n      if (String.IsNullOrEmpty(sql)) {\n         throw new InvalidOperationException(\"Configuration.LastInsertIdCommand cannot be null or empty.\");\n      }\n\n      var command = CreateCommand(new SqlBuilder(sql.Length, 0).Append(sql));\n      var value = command.ExecuteScalar();\n\n      Trace(command);\n\n      return value;\n   }\n\n   /// <inheritdoc cref=\"LastInsertId\"/>\n   /// <inheritdoc cref=\"EnsureConnectionOpenAsync\" path=\"param\"/>\n\n   public virtual async ValueTask<object?>\n   LastInsertIdAsync(CancellationToken cancellationToken = default) {\n\n      var sql = this.Configuration.LastInsertIdCommand;\n\n      if (String.IsNullOrEmpty(sql)) {\n         throw new InvalidOperationException(\"Configuration.LastInsertIdCommand cannot be null or empty.\");\n      }\n\n      var command = CreateCommand(new SqlBuilder(sql.Length, 0).Append(sql));\n      var value = await command.ExecuteScalarAsync(cancellationToken)\n         .ConfigureAwait(false);\n\n      Trace(command);\n\n      return value;\n   }\n\n   /// <summary>\n   /// Creates and returns a <see cref=\"DbCommand\"/> object from the specified <paramref name=\"sqlBuilder\"/>.\n   /// </summary>\n   /// <param name=\"sqlBuilder\">The <see cref=\"SqlBuilder\"/> that provides the command's text and parameters.</param>\n   /// <returns>\n   /// A new <see cref=\"DbCommand\"/> object with its <see cref=\"DbCommand.CommandText\"/> property\n   /// initialized with the <paramref name=\"sqlBuilder\"/>'s string representation, and its <see cref=\"DbCommand.Parameters\"/>\n   /// property is initialized with the values from the <see cref=\"SqlBuilder.ParameterValues\"/> property of the <paramref name=\"sqlBuilder\"/> parameter.\n   /// </returns>\n\n   public virtual DbCommand\n   CreateCommand(SqlBuilder sqlBuilder) {\n\n      ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n      var command = this.Connection.CreateCommand();\n\n      var format = sqlBuilder.ToString();\n      var parameters = sqlBuilder.ParameterValues;\n\n      if (this.Transaction is { } tx) {\n         command.Transaction = tx;\n      }\n\n      if (this.Configuration.CommandTimeout is { } timeout and > -1) {\n         command.CommandTimeout = timeout;\n      }\n\n      if (parameters is null or { Count: 0 }) {\n         command.CommandText = format;\n         return command;\n      }\n\n      var paramPlaceholders = new object[parameters.Count];\n\n      for (int i = 0; i < paramPlaceholders.Length; i++) {\n\n         var paramValue = parameters[i];\n\n         var dbParam = paramValue as DbParameter;\n\n         if (dbParam is null) {\n            dbParam = command.CreateParameter();\n            dbParam.Value = paramValue ?? DBNull.Value;\n         }\n\n         dbParam.ParameterName = this.Configuration.ParameterNameBuilder\n            .Invoke($\"p{i}\");\n\n         command.Parameters.Add(dbParam);\n\n         paramPlaceholders[i] = this.Configuration.ParameterPlaceholderBuilder\n            .Invoke(dbParam.ParameterName);\n      }\n\n      command.CommandText = String.Format(CultureInfo.InvariantCulture, format, paramPlaceholders);\n\n      return command;\n   }\n\n   /// <summary>\n   /// Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier.\n   /// </summary>\n   /// <param name=\"identifier\">The original identifier.</param>\n   /// <returns>The quoted version of the identifier. If the indentifier is already quoted it's returned unchanged.</returns>\n\n   public string\n   QuoteIdentifier(string identifier) {\n\n      QuoteIdentifierImpl(identifier, out var quotePrefix, out var quoteSuffix);\n\n      return String.Concat(quotePrefix, identifier, quoteSuffix);\n   }\n\n   internal void\n   QuoteIdentifier(StringBuilder sb, string identifier) {\n\n      QuoteIdentifierImpl(identifier, out var quotePrefix, out var quoteSuffix);\n\n      sb.Append(quotePrefix);\n      sb.Append(identifier);\n      sb.Append(quoteSuffix);\n   }\n\n   void\n   QuoteIdentifierImpl(string identifier, out string quotePrefix, out string quoteSuffix) {\n\n      ArgumentNullException.ThrowIfNull(identifier);\n\n      quotePrefix = this.Configuration.QuotePrefix;\n      quoteSuffix = this.Configuration.QuoteSuffix;\n\n      if (quotePrefix.Length == 0\n         && quoteSuffix.Length == 0) {\n\n         return;\n      }\n\n      if (identifier.StartsWith(quotePrefix, StringComparison.Ordinal)\n         && identifier.EndsWith(quoteSuffix, StringComparison.Ordinal)) {\n\n         quotePrefix = String.Empty;\n         quoteSuffix = String.Empty;\n      }\n   }\n\n   internal void\n   Trace(DbCommand command, int? affectedRecords = null, bool error = false) =>\n      Trace(command, this.Configuration.Log, affectedRecords, error);\n\n   internal static void\n   Trace(DbCommand command, TextWriter? log, int? affectedRecords = null, bool error = false) {\n\n      if (log is not null) {\n\n         log.WriteLine();\n\n         if (error) {\n            log.WriteLine(\"-- ERROR: The following command produced an error\");\n         }\n\n         log.WriteLine(command.CommandText);\n\n         for (int i = 0; i < command.Parameters.Count; i++) {\n\n            var param = command.Parameters[i];\n\n            if (param is not null) {\n               log.WriteLine(String.Create(log.FormatProvider, $\"-- {param.ParameterName}: {param.Direction} {param.DbType} (Size = {param.Size}) [{param.Value}]\"));\n            }\n         }\n\n         if (affectedRecords is not null) {\n            log.WriteLine(String.Create(log.FormatProvider, $\"-- [{affectedRecords.Value}] records affected.\"));\n         }\n      }\n   }\n\n   /// <summary>\n   /// Releases all resources used by the current instance of the <see cref=\"Database\"/> class.\n   /// </summary>\n\n   public void\n   Dispose() {\n\n      Dispose(true);\n      GC.SuppressFinalize(this);\n   }\n\n   /// <summary>\n   /// Releases the resources used by this <see cref=\"Database\"/> instance.\n   /// </summary>\n   /// <param name=\"disposing\">\n   /// <c>true</c> if this method is being called due to a call to <see cref=\"Dispose()\"/>; otherwise, <c>false</c>.\n   /// </param>\n\n   protected virtual void\n   Dispose(bool disposing) {\n\n      if (disposing) {\n\n         if (_disposeConn) {\n            this.Connection?.Dispose();\n         }\n      }\n   }\n\n   // Object Members\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public override bool\n   Equals(object? obj) => base.Equals(obj);\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public override int\n   GetHashCode() => base.GetHashCode();\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new Type\n   GetType() => base.GetType();\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public override string?\n   ToString() => base.ToString();\n\n   sealed class WrappedConnection(DbConnection? previouslyClosedConn) : IDisposable, IAsyncDisposable {\n\n      public void\n      Dispose() {\n\n         if (previouslyClosedConn is { State: not ConnectionState.Closed } conn) {\n            conn.Close();\n         }\n      }\n\n      public async ValueTask\n      DisposeAsync() {\n\n         if (previouslyClosedConn is { State: not ConnectionState.Closed } conn) {\n\n            await conn.CloseAsync()\n               .ConfigureAwait(false);\n         }\n      }\n   }\n\n   sealed class WrappedTransaction : DbTransaction {\n\n      readonly Database\n      _db;\n\n      readonly DbTransaction\n      _tx;\n\n      readonly WrappedConnection\n      _connHolder;\n\n      protected override DbConnection?\n      DbConnection => _tx.Connection;\n\n      public override IsolationLevel\n      IsolationLevel => _tx.IsolationLevel;\n\n      public\n      WrappedTransaction(Database db, DbTransaction tx, WrappedConnection connHolder) {\n         _db = db;\n         _tx = tx;\n         _connHolder = connHolder;\n      }\n\n      public override void\n      Commit() {\n\n         try {\n            _tx.Commit();\n            _db.Configuration.Log?.WriteLine(\"-- TRANSACTION COMMITED\");\n\n         } finally {\n            RemoveTxFromDatabase();\n         }\n      }\n\n      public override async Task\n      CommitAsync(CancellationToken cancellationToken = default) {\n\n         try {\n\n            await _tx.CommitAsync(cancellationToken)\n               .ConfigureAwait(false);\n\n            _db.Configuration.Log?.WriteLine(\"-- TRANSACTION COMMITED\");\n\n         } finally {\n            RemoveTxFromDatabase();\n         }\n      }\n\n      public override void\n      Rollback() {\n\n         try {\n            _tx.Rollback();\n            _db.Configuration.Log?.WriteLine(\"-- TRANSACTION ROLLED BACK\");\n\n         } finally {\n            RemoveTxFromDatabase();\n         }\n      }\n\n      public override async Task\n      RollbackAsync(CancellationToken cancellationToken = default) {\n\n         try {\n\n            await _tx.RollbackAsync(cancellationToken)\n               .ConfigureAwait(false);\n\n            _db.Configuration.Log?.WriteLine(\"-- TRANSACTION ROLLED BACK\");\n\n         } finally {\n            RemoveTxFromDatabase();\n         }\n      }\n\n      protected override void\n      Dispose(bool disposing) {\n\n         if (disposing) {\n\n            try {\n\n               try {\n                  _tx.Dispose();\n               } finally {\n                  RemoveTxFromDatabase();\n               }\n\n            } finally {\n               _connHolder.Dispose();\n            }\n         }\n      }\n\n      public override async ValueTask\n      DisposeAsync() {\n\n         try {\n\n            try {\n\n               await _tx.DisposeAsync()\n                  .ConfigureAwait(false);\n\n            } finally {\n               RemoveTxFromDatabase();\n            }\n\n         } finally {\n\n            await _connHolder.DisposeAsync()\n               .ConfigureAwait(false);\n         }\n      }\n\n      void\n      RemoveTxFromDatabase() {\n\n         if (Object.ReferenceEquals(_tx, _db.Transaction)) {\n            _db.Transaction = null;\n         }\n      }\n   }\n\n   sealed class NoOpTransaction(DbConnection conn, IsolationLevel isolationLevel, WrappedConnection connHolder) : DbTransaction {\n\n      protected override DbConnection?\n      DbConnection => conn;\n\n      public override IsolationLevel\n      IsolationLevel => isolationLevel;\n\n      public override void\n      Commit() { }\n\n      public override void\n      Rollback() =>\n         throw new NotImplementedException();\n\n      protected override void\n      Dispose(bool disposing) {\n\n         if (disposing) {\n            connHolder.Dispose();\n         }\n      }\n\n      public override async ValueTask\n      DisposeAsync() {\n\n         await connHolder.DisposeAsync()\n            .ConfigureAwait(false);\n      }\n   }\n}\n\n/// <summary>\n/// Holds configuration options that customize the behavior of <see cref=\"Database\"/>.\n/// This class cannot be instantiated, to get an instance use the <see cref=\"Database.Configuration\"/> property.\n/// </summary>\n\npublic sealed partial class DatabaseConfiguration {\n\n   static readonly Func<DbCommandBuilder, int, string>\n   _getParameterNameI = (Func<DbCommandBuilder, int, string>)\n      Delegate.CreateDelegate(typeof(Func<DbCommandBuilder, int, string>), typeof(DbCommandBuilder)\n         .GetMethod(\"GetParameterName\", BindingFlags.Instance | BindingFlags.NonPublic, Type.DefaultBinder, [typeof(int)], null)!);\n\n   static readonly Func<DbCommandBuilder, string, string>\n   _getParameterNameS = (Func<DbCommandBuilder, string, string>)\n      Delegate.CreateDelegate(typeof(Func<DbCommandBuilder, string, string>), typeof(DbCommandBuilder)\n         .GetMethod(\"GetParameterName\", BindingFlags.Instance | BindingFlags.NonPublic, Type.DefaultBinder, [typeof(string)], null)!);\n\n   static readonly Func<DbCommandBuilder, int, string>\n   _getParameterPlaceholder = (Func<DbCommandBuilder, int, string>)\n      Delegate.CreateDelegate(typeof(Func<DbCommandBuilder, int, string>), typeof(DbCommandBuilder)\n         .GetMethod(\"GetParameterPlaceholder\", BindingFlags.Instance | BindingFlags.NonPublic, Type.DefaultBinder, [typeof(int)], null)!);\n\n   string?\n   _quotePrefix;\n\n   string?\n   _quoteSuffix;\n\n   Func<string, string>?\n   _parameterNameBuilder;\n\n   Func<string, string>?\n   _parameterPlaceholderBuilder;\n\n   string?\n   _lastInsertIdCommand;\n\n   /// <summary>\n   /// Gets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns)\n   /// whose names contain characters such as spaces or reserved tokens.\n   /// </summary>\n\n   [AllowNull]\n   public string\n   QuotePrefix {\n      get => _quotePrefix ?? \"[\";\n      set => _quotePrefix = value;\n   }\n\n   /// <summary>\n   /// Gets or sets the ending character or characters to use when specifying database objects (for example, tables or columns)\n   /// whose names contain characters such as spaces or reserved tokens.\n   /// </summary>\n\n   [AllowNull]\n   public string\n   QuoteSuffix {\n      get => _quoteSuffix ?? \"]\";\n      set => _quoteSuffix = value;\n   }\n\n   /// <summary>\n   /// Specifies a function that prepares a parameter name to be used on <see cref=\"DbParameter.ParameterName\" qualifyHint=\"true\"/>.\n   /// </summary>\n\n   [AllowNull]\n   public Func<string, string>\n   ParameterNameBuilder {\n      get => _parameterNameBuilder ?? DefaultParameterNameBuilder;\n      set => _parameterNameBuilder = value;\n   }\n\n   /// <summary>\n   /// Specifies a function that builds a parameter placeholder to be used in SQL statements.\n   /// </summary>\n\n   [AllowNull]\n   public Func<string, string>\n   ParameterPlaceholderBuilder {\n      get => _parameterPlaceholderBuilder ?? DefaultParameterPlaceholderBuilder;\n      set => _parameterPlaceholderBuilder = value;\n   }\n\n   /// <summary>\n   /// Gets or sets the SQL command that returns the last identity value generated on the database.\n   /// </summary>\n\n   [AllowNull]\n   public string\n   LastInsertIdCommand {\n      get => _lastInsertIdCommand ?? \"SELECT @@IDENTITY\";\n      set => _lastInsertIdCommand = value;\n   }\n\n   /// <summary>\n   /// Specifies the destination to write the SQL query or command. \n   /// </summary>\n\n   public TextWriter?\n   Log { get; set; }\n\n   /// <summary>\n   /// Specifies a timeout to assign to commands. This setting is ignored if less or equal to -1. The default is -1.\n   /// </summary>\n\n   public int\n   CommandTimeout { get; set; } = -1;\n\n   internal SqlDialect\n   SqlDialect { get; set; }\n\n   static string\n   DefaultParameterNameBuilder(string name) => \"@\" + name;\n\n   static string\n   DefaultParameterPlaceholderBuilder(string name) => name;\n\n#pragma warning disable CS8618\n   internal\n   DatabaseConfiguration(string providerInvariantName, Func<DbCommandBuilder?>? cbFn = null) {\n#pragma warning restore CS8618\n\n      switch (providerInvariantName) {\n         case \"Microsoft.Data.SqlClient\":\n            this.LastInsertIdCommand = \"SELECT SCOPE_IDENTITY()\";\n            this.SqlDialect = SqlDialect.TSql;\n            break;\n\n         case \"MySql.Data.MySqlClient\":\n            this.QuotePrefix = \"`\";\n            this.QuoteSuffix = this.QuotePrefix;\n            break;\n\n         case \"System.Data.Odbc\":\n         case \"System.Data.OleDb\":\n            this.ParameterNameBuilder = (name) => name;\n            this.ParameterPlaceholderBuilder = (paramName) => \"?\";\n            break;\n\n         case \"System.Data.SQLite\":\n            this.LastInsertIdCommand = \"SELECT LAST_INSERT_ROWID()\";\n            break;\n\n         default:\n            if (cbFn?.Invoke() is { } cb) {\n               Initialize(cb);\n            }\n            break;\n      }\n   }\n\n   void\n   Initialize(DbCommandBuilder cb) {\n\n      var qp = cb.QuotePrefix;\n      var qs = cb.QuoteSuffix;\n\n      if (!String.IsNullOrEmpty(qp)\n         || !String.IsNullOrEmpty(qs)) {\n\n         this.QuotePrefix = qp ?? String.Empty;\n         this.QuoteSuffix = qs ?? String.Empty;\n      }\n\n      this.ParameterNameBuilder = (name) => _getParameterNameS.Invoke(cb, name);\n\n      var pName = _getParameterNameI.Invoke(cb, 1);\n      var pPlace = _getParameterPlaceholder.Invoke(cb, 1);\n\n      if (!(Object.ReferenceEquals(pName, pPlace)\n         || pName == pPlace)) {\n\n         this.ParameterPlaceholderBuilder = (paramName) => pPlace.Replace(pName, paramName);\n      }\n   }\n}\n\nenum SqlDialect {\n   Default = 0,\n   TSql\n}\n\n/// <summary>\n/// An exception that is thrown when a concurrency violation is encountered while saving to the database. A concurrency violation\n/// occurs when an unexpected number of rows are affected during save. This is usually because the data in the database has\n/// been modified since it was loaded into memory.\n/// </summary>\n\npublic sealed class ChangeConflictException : Exception {\n\n   /// <summary>\n   /// Initializes a new instance of the <see cref=\"ChangeConflictException\"/> class\n   /// with a specified error message.\n   /// </summary>\n   /// <param name=\"message\">The message that describes the error.</param>\n\n   public\n   ChangeConflictException(string message)\n      : base(message) { }\n}\n\nsealed class MappingEnumerable<TResult> : IEnumerable<TResult>, IEnumerable, IEnumerator<TResult>, IEnumerator, IDisposable {\n\n   readonly DbCommand\n   _command;\n\n   readonly Func<DbDataReader, TResult>\n   _mapper;\n\n   readonly TextWriter?\n   _logger;\n\n   readonly bool\n   _prevStateWasClosed;\n\n   bool\n   _used;\n\n   DbDataReader?\n   _reader;\n\n   TResult\n   _current;\n\n   public TResult\n   Current => _current;\n\n   object\n   IEnumerator.Current => Current!;\n\n#pragma warning disable CS8618\n   public\n   MappingEnumerable(DbCommand command, Func<DbDataReader, TResult> mapper, TextWriter? logger) {\n#pragma warning restore CS8618\n\n      var conn = command.Connection\n         ?? throw new ArgumentException(\"command.Connection cannot be null.\", nameof(command));\n\n      _prevStateWasClosed = (conn.State == ConnectionState.Closed);\n\n      _command = command;\n      _mapper = mapper;\n      _logger = logger;\n   }\n\n   public IEnumerator<TResult>\n   GetEnumerator() {\n\n      if (!_used) {\n         _used = true;\n         return this;\n      }\n\n      throw new InvalidOperationException(\"Cannot enumerate more than once.\");\n   }\n\n   IEnumerator\n   IEnumerable.GetEnumerator() =>\n      GetEnumerator();\n\n   public bool\n   MoveNext() {\n\n      if (_reader is null) {\n\n         PossiblyOpenConnection();\n\n         try {\n            _reader = _command.ExecuteReader();\n            Database.Trace(_command, _logger, _reader.RecordsAffected);\n\n         } catch {\n\n            try {\n               Database.Trace(_command, _logger, error: true);\n            } finally {\n               PossiblyCloseConnection();\n            }\n\n            throw;\n         }\n      }\n\n      if (_reader.IsClosed) {\n         // see MappingContext.LoadMany()\n         return false;\n      }\n\n      try {\n         if (_reader.Read()) {\n            _current = _mapper.Invoke(_reader);\n            return true;\n         }\n\n      } catch {\n\n         PossiblyCloseConnection();\n         throw;\n      }\n\n      PossiblyCloseConnection();\n\n      return false;\n   }\n\n   public void\n   Reset() =>\n      throw new NotSupportedException();\n\n   public void\n   Dispose() {\n\n      _reader?.Dispose();\n\n      PossiblyCloseConnection();\n   }\n\n   void\n   PossiblyOpenConnection() {\n\n      if (_prevStateWasClosed) {\n         _command.Connection?.Open();\n      }\n   }\n\n   void\n   PossiblyCloseConnection() {\n\n      if (_prevStateWasClosed\n         && _command.Connection is { State: not ConnectionState.Closed } conn) {\n\n         conn.Close();\n      }\n   }\n}\n\nsealed class AsyncMappingEnumerable<TResult> : IAsyncEnumerable<TResult>, IAsyncEnumerator<TResult> {\n\n   readonly DbCommand\n   _command;\n\n   readonly Func<DbDataReader, TResult>\n   _mapper;\n\n   readonly TextWriter?\n   _logger;\n\n   readonly bool\n   _prevStateWasClosed;\n\n   bool\n   _used;\n\n   CancellationToken\n   _cancellationToken;\n\n   DbDataReader?\n   _reader;\n\n   TResult\n   _current;\n\n   public TResult\n   Current => _current;\n\n#pragma warning disable CS8618\n   public\n   AsyncMappingEnumerable(DbCommand command, Func<DbDataReader, TResult> mapper, TextWriter? logger) {\n#pragma warning restore CS8618\n\n      var conn = command.Connection\n         ?? throw new ArgumentException(\"command.Connection cannot be null.\", nameof(command));\n\n      _prevStateWasClosed = (conn.State == ConnectionState.Closed);\n\n      _command = command;\n      _mapper = mapper;\n      _logger = logger;\n   }\n\n   public IAsyncEnumerator<TResult>\n   GetAsyncEnumerator(CancellationToken cancellationToken = default) {\n\n      if (!_used) {\n         _cancellationToken = cancellationToken;\n         _used = true;\n         return this;\n      }\n\n      throw new InvalidOperationException(\"Cannot enumerate more than once.\");\n   }\n\n   public async ValueTask<bool>\n   MoveNextAsync() {\n\n      if (_reader is null) {\n\n         await PossiblyOpenConnection()\n            .ConfigureAwait(false);\n\n         try {\n\n            _reader = await _command.ExecuteReaderAsync(_cancellationToken)\n               .ConfigureAwait(false);\n\n            Database.Trace(_command, _logger, _reader.RecordsAffected);\n\n         } catch {\n\n            try {\n               Database.Trace(_command, _logger, error: true);\n            } finally {\n\n               await PossiblyCloseConnection()\n                  .ConfigureAwait(false);\n            }\n\n            throw;\n         }\n      }\n\n      if (_reader.IsClosed) {\n         // see MappingContext.LoadMany()\n         return false;\n      }\n\n      try {\n\n         if (await _reader.ReadAsync(_cancellationToken).ConfigureAwait(false)) {\n            _current = _mapper.Invoke(_reader);\n            return true;\n         }\n\n      } catch {\n\n         await PossiblyCloseConnection()\n            .ConfigureAwait(false);\n\n         throw;\n      }\n\n      await PossiblyCloseConnection()\n         .ConfigureAwait(false);\n\n      return false;\n   }\n\n   async ValueTask\n   PossiblyOpenConnection() {\n\n      if (_prevStateWasClosed\n         && _command.Connection is { } conn) {\n\n         await conn.OpenAsync(_cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   async ValueTask\n   PossiblyCloseConnection() {\n\n      if (_prevStateWasClosed\n         && _command.Connection is { State: not ConnectionState.Closed } conn) {\n\n         await conn.CloseAsync()\n            .ConfigureAwait(false);\n      }\n   }\n\n   public async ValueTask\n   DisposeAsync() {\n\n      if (_reader is { } r) {\n\n         await r.DisposeAsync()\n            .ConfigureAwait(false);\n      }\n\n      await PossiblyCloseConnection()\n         .ConfigureAwait(false);\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/DbExtensions.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0</TargetFrameworks>\n    <LangVersion>12</LangVersion>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <NoWarn>1573</NoWarn>\n    <Description>DbExtensions is a data-access framework with a strong focus on query composition, granularity and code aesthetics. It supports both POCO and dynamic (untyped) mapping.</Description>\n    <PackageTags>ado.net orm micro-orm</PackageTags>\n    <PackageIcon>icon.png</PackageIcon>\n    <EmbedUntrackedSources>true</EmbedUntrackedSources>\n    <PublishRepositoryUrl>true</PublishRepositoryUrl>\n    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>\n    <TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeXmlDoc</TargetsForTfmSpecificBuildOutput>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"System.Linq.AsyncEnumerable\" Version=\"10.0.0\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Include=\"..\\..\\LICENSE.txt\" Pack=\"true\" PackagePath=\"\" Visible=\"false\" />\n    <None Include=\"..\\..\\NOTICE.xml\" Pack=\"true\" PackagePath=\"\" Visible=\"false\" />\n    <None Include=\"..\\..\\icon.png\" Pack=\"true\" PackagePath=\"\" Visible=\"false\" />\n  </ItemGroup>\n\n  <Target Name=\"IncludeXmlDoc\">\n    <ItemGroup>\n      <BuildOutputInPackage Include=\"..\\..\\build\\api-docs\\xml\\$(MSBuildProjectName)\\$(AssemblyName).xml\" />\n    </ItemGroup>\n  </Target>\n\n</Project>\n"
  },
  {
    "path": "src/DbExtensions/DynamicMapper.cs",
    "content": "﻿// Copyright 2013-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Data.Common;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace DbExtensions;\n\n#nullable enable\n\npartial class Database {\n\n   /// <summary>\n   /// Maps the results of the <paramref name=\"query\"/> to dynamic objects.\n   /// The query is deferred-executed.\n   /// </summary>\n   /// <param name=\"query\">The query.</param>\n   /// <returns>The results of the query as dynamic objects.</returns>\n\n   public IEnumerable<dynamic>\n   Map(SqlBuilder query) {\n\n      ArgumentNullException.ThrowIfNull(query);\n\n      var mapper = CreateDynamicMapper();\n\n      return Map(query, r => (dynamic)mapper.DynamicMap(r));\n   }\n\n   /// <inheritdoc cref=\"Map(SqlBuilder)\"/>\n\n   public IAsyncEnumerable<dynamic>\n   AsyncMap(SqlBuilder query) {\n\n      ArgumentNullException.ThrowIfNull(query);\n\n      var mapper = CreateDynamicMapper();\n\n      return AsyncMap(query, r => (dynamic)mapper.DynamicMap(r));\n   }\n\n   internal DynamicMapper\n   CreateDynamicMapper() {\n\n      return new DynamicMapper {\n         Log = this.Configuration.Log\n      };\n   }\n}\n\npartial class SqlSet {\n\n   partial void\n   DynamicMap(bool singleResult, SqlBuilder query, ref IEnumerable<object>? results) {\n\n      var mapper = CreateDynamicMapper(singleResult);\n\n      results = _db.Map(query, mapper.DynamicMap);\n   }\n\n   partial void\n   DynamicAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<object>? results) {\n\n      var mapper = CreateDynamicMapper(singleResult);\n\n      results = _db.AsyncMap(query, mapper.DynamicMap);\n   }\n\n   DynamicMapper\n   CreateDynamicMapper(bool singleResult) {\n\n      var mapper = _db.CreateDynamicMapper();\n      mapper.SingleResult = singleResult;\n\n      return mapper;\n   }\n}\n\nsealed class DynamicMapper : Mapper {\n\n   protected override bool\n   CanUseConstructorMapping => false;\n\n   protected override Node\n   CreateRootNode() => new DynamicNode();\n\n   protected override Node\n   CreateSimpleProperty(Node container, string propertyName, int columnOrdinal) =>\n      new DynamicNode(propertyName, columnOrdinal);\n\n   protected override Node\n   CreateComplexProperty(Node container, string propertyName) =>\n      new DynamicNode(propertyName, isComplex: true);\n\n   protected override Node\n   CreateParameterNode(ParameterInfo paramInfo) =>\n      throw new NotImplementedException();\n\n   protected override Node\n   CreateParameterNode(int columnOrdinal, ParameterInfo paramInfo) =>\n      throw new NotImplementedException();\n\n   public object\n   DynamicMap(DbDataReader record) {\n\n      var node = (DynamicNode)GetRootNode(record);\n      var context = this.MappingContext;\n\n      var instance = node.Create(record, context);\n      node.Load(instance, record, context);\n\n      return instance;\n   }\n}\n\nsealed class DynamicNode : Node {\n\n   static readonly string\n   _typeName = typeof(ExpandoObject).FullName!;\n\n   public override bool\n   IsComplex { get; }\n\n   public override string?\n   PropertyName { get; }\n\n   public override int\n   ColumnOrdinal { get; }\n\n   public override string\n   TypeName => _typeName;\n\n   internal\n   DynamicNode() {\n      this.IsComplex = true;\n   }\n\n   internal\n   DynamicNode(string propertyName, int columnOrdinal = default, bool isComplex = default) {\n\n      ArgumentNullException.ThrowIfNull(propertyName);\n\n      if (propertyName.Length == 0) {\n         throw new ArgumentException(\"Cannot map column using an empty property name.\", nameof(propertyName));\n      }\n\n      if (UInt32.TryParse(propertyName, out _)) {\n         throw new ArgumentException(\"Cannot use constructor mapping, by using numeric column names, unless you specify the type of the object you want to map to.\", nameof(propertyName));\n      }\n\n      this.PropertyName = propertyName;\n      this.ColumnOrdinal = columnOrdinal;\n      this.IsComplex = isComplex;\n   }\n\n   public object?\n   Map(DbDataReader record, MappingContext context) {\n\n      if (this.IsComplex) {\n         return MapComplex(record, context);\n      }\n\n      return MapSimple(record, context);\n   }\n\n   object?\n   MapComplex(DbDataReader record, MappingContext context) {\n\n      if (AllColumnsNull(record)) {\n         return null;\n      }\n\n      var value = Create(record, context);\n      Load(value, record, context);\n\n      return value;\n   }\n\n   bool\n   AllColumnsNull(DbDataReader record) {\n\n      if (this.IsComplex) {\n\n         return (!this.HasConstructorParameters\n               || this.ConstructorParameters\n                  .OrderBy(n => n.Value.IsComplex)\n                  .All(n => ((DynamicNode)n.Value).AllColumnsNull(record)))\n            && this.Properties\n               .OrderBy(n => n.IsComplex)\n               .All(n => ((DynamicNode)n).AllColumnsNull(record));\n      }\n\n      return record.IsDBNull(this.ColumnOrdinal);\n   }\n\n   object?\n   MapSimple(DbDataReader record, MappingContext context) {\n\n      var isNull = record.IsDBNull(this.ColumnOrdinal);\n      var value = (isNull) ? null : record.GetValue(this.ColumnOrdinal);\n\n      return value;\n   }\n\n   public object\n   Create(DbDataReader record, MappingContext context) =>\n      new ExpandoObject();\n\n   public void\n   Load(object instance, DbDataReader record, MappingContext context) {\n\n      for (int i = 0; i < this.Properties.Count; i++) {\n\n         var childNode = (DynamicNode)this.Properties[i];\n\n         if (!childNode.IsComplex\n            || childNode.HasConstructorParameters) {\n\n            childNode.Read(instance, record, context);\n            continue;\n         }\n\n         var currentValue = childNode.Get(instance);\n\n         if (currentValue is not null) {\n            childNode.Load(currentValue, record, context);\n         } else {\n            childNode.Read(instance, record, context);\n         }\n      }\n   }\n\n   void\n   Read(object instance, DbDataReader record, MappingContext context) {\n\n      var value = Map(record, context);\n      Set(instance, value, context);\n   }\n\n   object?\n   Get(object instance) {\n\n      var dictionary = (IDictionary<string, object?>)instance;\n\n      if (dictionary.TryGetValue(this.PropertyName!, out var value)) {\n         return value;\n      }\n\n      return null;\n   }\n\n   void\n   Set(object instance, object? value, MappingContext context) {\n      ((IDictionary<string, object?>)instance)[this.PropertyName!] = value;\n   }\n\n   public override ConstructorInfo[]\n   GetConstructors(BindingFlags bindingAttr) =>\n      throw new InvalidOperationException(\"Cannot use constructor mapping, by using numeric column names, unless you specify the type of the object you want to map to.\");\n}\n"
  },
  {
    "path": "src/DbExtensions/Extensions.cs",
    "content": "﻿// Copyright 2009-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Data.Common;\n\nnamespace DbExtensions;\n\n#nullable enable\n\n/// <summary>\n/// Provides extension methods for common ADO.NET objects.\n/// </summary>\n\npublic static class Extensions {\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Boolean\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Boolean\n   GetBoolean(this DbDataReader reader, string name) =>\n      reader.GetBoolean(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Byte\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Byte\n   GetByte(this DbDataReader reader, string name) =>\n      reader.GetByte(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Char\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Char\n   GetChar(this DbDataReader reader, string name) =>\n      reader.GetChar(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"DateTime\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static DateTime\n   GetDateTime(this DbDataReader reader, string name) =>\n      reader.GetDateTime(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Decimal\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Decimal\n   GetDecimal(this DbDataReader reader, string name) =>\n      reader.GetDecimal(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Double\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Double\n   GetDouble(this DbDataReader reader, string name) =>\n      reader.GetDouble(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Single\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Single\n   GetFloat(this DbDataReader reader, string name) =>\n      reader.GetFloat(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as an <see cref=\"Int16\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int16\n   GetInt16(this DbDataReader reader, string name) =>\n      reader.GetInt16(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as an <see cref=\"Int32\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int32\n   GetInt32(this DbDataReader reader, string name) =>\n      reader.GetInt32(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as an <see cref=\"Int64\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int64\n   GetInt64(this DbDataReader reader, string name) =>\n      reader.GetInt64(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"String\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static String\n   GetString(this DbDataReader reader, string name) =>\n      reader.GetString(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column.\n   /// </summary>\n   /// <param name=\"reader\">The data reader.</param>\n   /// <param name=\"name\">The name of the column to find.</param>\n   /// <returns>The value of the column.</returns>\n\n   public static Object\n   GetValue(this DbDataReader reader, string name) =>\n      reader.GetValue(reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Boolean&gt;\"/> of <see cref=\"Boolean\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Boolean?\n   GetNullableBoolean(this DbDataReader reader, string name) =>\n      GetNullableBoolean(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Boolean&gt;\"/> of <see cref=\"Boolean\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Boolean?\n   GetNullableBoolean(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Boolean?) : reader.GetBoolean(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Byte&gt;\"/> of <see cref=\"Byte\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Byte?\n   GetNullableByte(this DbDataReader reader, string name) =>\n      GetNullableByte(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Byte&gt;\"/> of <see cref=\"Byte\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Byte?\n   GetNullableByte(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Byte?) : reader.GetByte(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Char&gt;\"/> of <see cref=\"Char\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Char?\n   GetNullableChar(this DbDataReader reader, string name) =>\n      GetNullableChar(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Char&gt;\"/> of <see cref=\"Char\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Char?\n   GetNullableChar(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Char?) : reader.GetChar(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;DateTime&gt;\"/> of <see cref=\"DateTime\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static DateTime?\n   GetNullableDateTime(this DbDataReader reader, string name) =>\n      GetNullableDateTime(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;DateTime&gt;\"/> of <see cref=\"DateTime\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static DateTime?\n   GetNullableDateTime(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(DateTime?) : reader.GetDateTime(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Decimal&gt;\"/> of <see cref=\"Decimal\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Decimal?\n   GetNullableDecimal(this DbDataReader reader, string name) =>\n      GetNullableDecimal(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Decimal&gt;\"/> of <see cref=\"Decimal\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Decimal?\n   GetNullableDecimal(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Decimal?) : reader.GetDecimal(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Double&gt;\"/> of <see cref=\"Double\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Double?\n   GetNullableDouble(this DbDataReader reader, string name) =>\n      GetNullableDouble(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Double&gt;\"/> of <see cref=\"Double\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Double?\n   GetNullableDouble(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Double?) : reader.GetDouble(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Single&gt;\"/> of <see cref=\"Single\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Single?\n   GetNullableFloat(this DbDataReader reader, string name) =>\n      GetNullableFloat(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Single&gt;\"/> of <see cref=\"Single\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Single?\n   GetNullableFloat(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Single?) : reader.GetFloat(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Guid&gt;\"/> of <see cref=\"Guid\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Guid?\n   GetNullableGuid(this DbDataReader reader, string name) =>\n      GetNullableGuid(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Guid&gt;\"/> of <see cref=\"Guid\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Guid?\n   GetNullableGuid(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Guid?) : reader.GetGuid(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int16&gt;\"/> of <see cref=\"Int16\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int16?\n   GetNullableInt16(this DbDataReader reader, string name) =>\n      GetNullableInt16(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int16&gt;\"/> of <see cref=\"Int16\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Int16?\n   GetNullableInt16(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Int16?) : reader.GetInt16(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int32&gt;\"/> of <see cref=\"Int32\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int32?\n   GetNullableInt32(this DbDataReader reader, string name) =>\n      GetNullableInt32(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int32&gt;\"/> of <see cref=\"Int32\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Int32?\n   GetNullableInt32(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Int32?) : reader.GetInt32(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int64&gt;\"/> of <see cref=\"Int64\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Int64?\n   GetNullableInt64(this DbDataReader reader, string name) =>\n      GetNullableInt64(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"Nullable&lt;Int64&gt;\"/> of <see cref=\"Int64\"/>.\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static Int64?\n   GetNullableInt64(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(Int64?) : reader.GetInt64(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"String\"/>, or null (Nothing in Visual Basic).\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static String?\n   GetStringOrNull(this DbDataReader reader, string name) =>\n      GetStringOrNull(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as a <see cref=\"String\"/>, or null (Nothing in Visual Basic).\n   /// </summary>\n   /// <inheritdoc cref=\"GetValueOrNull(DbDataReader, Int32)\"/>\n\n   public static String?\n   GetStringOrNull(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? default(String) : reader.GetString(i);\n\n   /// <summary>\n   /// Gets the value of the specified column as an <see cref=\"Object\"/>, or null (Nothing in Visual Basic).\n   /// </summary>\n   /// <inheritdoc cref=\"GetValue(DbDataReader, String)\"/>\n\n   public static Object?\n   GetValueOrNull(this DbDataReader reader, string name) =>\n      GetValueOrNull(reader, reader.GetOrdinal(name));\n\n   /// <summary>\n   /// Gets the value of the specified column as an <see cref=\"Object\"/>, or null (Nothing in Visual Basic).\n   /// </summary>\n   /// <param name=\"reader\">The data reader.</param>\n   /// <param name=\"i\">The zero-based column ordinal.</param>\n   /// <returns>The value of the column.</returns>\n\n   public static Object?\n   GetValueOrNull(this DbDataReader reader, int i) =>\n      (reader.IsDBNull(i)) ? null : reader.GetValue(i);\n}\n"
  },
  {
    "path": "src/DbExtensions/Mapper.cs",
    "content": "﻿// Copyright 2010-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Data.Common;\nusing System.Diagnostics.CodeAnalysis;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\n\nnamespace DbExtensions;\n\n#nullable enable\n\nabstract partial class Mapper {\n\n   internal static readonly char\n   _pathSeparator = '$';\n\n   Node?\n   _rootNode;\n\n   MappingContext?\n   _mappingContext;\n\n   public TextWriter?\n   Log { get; set; }\n\n   public bool\n   SingleResult { get; set; }\n\n   protected MappingContext\n   MappingContext {\n      get {\n         if (_mappingContext is null) {\n\n            _mappingContext = new() {\n               Log = Log,\n               SingleResult = SingleResult\n            };\n\n            InitializeMappingContext2(_mappingContext);\n         }\n         return _mappingContext;\n      }\n   }\n\n   protected abstract bool\n   CanUseConstructorMapping { get; }\n\n   protected\n   Mapper() { }\n\n   void\n   ReadMapping(DbDataReader record, Node rootNode) {\n\n      var groups =\n         (from i in Enumerable.Range(0, record.FieldCount)\n          let columnName = record.GetName(i)\n          let path = columnName.Split(_pathSeparator)\n          let property = (path.Length == 1) ? columnName : path[^1]\n          let assoc = (path.Length == 1) ? String.Empty : path[^2]\n          let parent = (path.Length <= 2) ? String.Empty : path[^3]\n          let propertyInfo = new { ColumnOrdinal = i, PropertyName = property }\n          group propertyInfo by new { depth = path.Length - 1, parent, assoc } into t\n          orderby t.Key.depth, t.Key.parent, t.Key.assoc\n          select new MapGroup(\n             t.Key.depth,\n             t.Key.assoc,\n             t.Key.parent,\n             t.ToDictionary(p => p.ColumnOrdinal, p => p.PropertyName)))\n         .ToArray();\n\n      var topGroup = groups.Where(m => m.Depth == 0).SingleOrDefault()\n         ?? new MapGroup(0, String.Empty, String.Empty, new Dictionary<int, string>());\n\n      ReadMapping(record, groups, topGroup, rootNode);\n   }\n\n   void\n   ReadMapping(DbDataReader record, MapGroup[] groups, MapGroup currentGroup, Node instance) {\n\n      var constructorParameters = new Dictionary<uint, MapParam>();\n      var unmapped = new Dictionary<string, int>();\n      var unmappedGroups = new Dictionary<string, MapGroup>();\n\n      // simple properties\n\n      foreach (var pair in currentGroup.Properties) {\n\n         var propertyName = pair.Value;\n         var columnOrdinal = pair.Key;\n         var property = CreateSimpleProperty(instance, propertyName, columnOrdinal);\n\n         if (property is not null) {\n            instance.Properties.Add(property);\n            continue;\n         }\n\n         if (UInt32.TryParse(propertyName, out var paramIndex)) {\n            if (!constructorParameters.TryAdd(paramIndex, new MapParam(columnOrdinal))) {\n               ThrowDuplicateConstructorArgument(paramIndex, columnOrdinal, record);\n            }\n         } else {\n            unmapped.Add(propertyName, columnOrdinal);\n            this.Log?.WriteLine($\"-- WARNING: Couldn't find property '{propertyName}' on type '{instance.TypeName}'. Ignoring column.\");\n         }\n      }\n\n      // complex properties\n\n      foreach (var nextLevel in groups\n            .Where(m => m.Depth == currentGroup.Depth + 1 && m.Parent == currentGroup.Name)) {\n\n         var propertyName = nextLevel.Name;\n         var property = CreateComplexProperty(instance, propertyName);\n\n         if (property is not null) {\n\n            ReadMapping(record, groups, nextLevel, property);\n\n            instance.Properties.Add(property);\n            continue;\n         }\n\n         if (UInt32.TryParse(propertyName, out var paramIndex)) {\n            if (!constructorParameters.TryAdd(paramIndex, new MapParam(nextLevel))) {\n               ThrowDuplicateConstructorArgument(paramIndex, default, record);\n            }\n         } else {\n            unmappedGroups.Add(propertyName, nextLevel);\n            this.Log?.WriteLine($\"-- WARNING: Couldn't find property '{propertyName}' on type '{instance.TypeName}'. Ignoring column(s).\");\n         }\n      }\n\n      if (!this.CanUseConstructorMapping) {\n         return;\n      }\n\n      var constructors = instance\n         .GetConstructors(BindingFlags.Public | BindingFlags.Instance);\n\n      if (constructorParameters.Count > 0) {\n\n         // choose constructor based on positional arguments\n\n         var ctor = ChooseConstructor(constructors, instance, constructorParameters.Count);\n         var parameters = ctor.GetParameters();\n\n         var i = -1;\n\n         foreach (var pair in constructorParameters.OrderBy(p => p.Key)) {\n\n            i++;\n\n            var paramIndex = pair.Key;\n            var mapParam = pair.Value;\n            var param = parameters[i];\n            Node paramNode;\n\n            if (mapParam.ColumnOrdinal.HasValue) {\n               paramNode = CreateParameterNode(mapParam.ColumnOrdinal.Value, param);\n\n            } else {\n\n               paramNode = CreateParameterNode(param);\n               ReadMapping(record, groups, mapParam.Group!, paramNode);\n            }\n\n            if (!instance.ConstructorParameters.TryAdd(paramIndex, paramNode)) {\n               ThrowDuplicateConstructorArgument(param, mapParam.ColumnOrdinal, record);\n            }\n         }\n\n         instance.Constructor = ctor;\n\n      } else {\n\n         ParameterInfo[] parameters;\n\n         if (constructors.Length == 1\n            && (parameters = constructors[0].GetParameters()).Length > 0) {\n\n            // if there's a single constructor, try to bind unmaped\n            // columns to constructor parameters by name\n\n            foreach (var param in parameters) {\n\n               var paramIndex = (uint)param.Position;\n\n               if (unmapped.TryGetValue(param.Name!, out var columnOrdinal)) {\n\n                  var paramNode = CreateParameterNode(columnOrdinal, param);\n\n                  if (!instance.ConstructorParameters.TryAdd(paramIndex, paramNode)) {\n                     ThrowDuplicateConstructorArgument(param, columnOrdinal, record);\n                  }\n\n                  continue;\n               }\n\n               var property = instance.Properties\n                  .FirstOrDefault(p => !p.IsComplex && p.PropertyName == param.Name);\n\n               if (property is not null) {\n\n                  var paramNode = CreateParameterNode(property.ColumnOrdinal, param);\n\n                  instance.Properties.Remove(property);\n\n                  if (!instance.ConstructorParameters.TryAdd(paramIndex, paramNode)) {\n                     ThrowDuplicateConstructorArgument(param, paramNode.ColumnOrdinal, record);\n                  }\n\n                  continue;\n               }\n\n               if (unmappedGroups.TryGetValue(param.Name!, out var group)) {\n\n                  var paramNode = CreateParameterNode(param);\n                  ReadMapping(record, groups, group, paramNode);\n\n                  if (!instance.ConstructorParameters.TryAdd(paramIndex, paramNode)) {\n                     ThrowDuplicateConstructorArgument(param, default, record);\n                  }\n               }\n            }\n\n            if (parameters.Length != instance.ConstructorParameters.Count) {\n               throw new InvalidOperationException(\n                  $\"There are missing arguments for constructor with {parameters.Length} parameter(s) for type '{instance.TypeName}'.\");\n            }\n\n            instance.Constructor = constructors[0];\n         }\n      }\n   }\n\n   [DoesNotReturn]\n   static void\n   ThrowDuplicateConstructorArgument(uint paramIndex, int? columnOrdinal, DbDataReader record) {\n\n      var message = new StringBuilder();\n      message.Append($\"Already specified a positional argument {paramIndex}\");\n\n      if (columnOrdinal.HasValue) {\n         message.Append($\" ('{record.GetName(columnOrdinal.Value)}')\");\n      }\n\n      message.Append('.');\n\n      throw new InvalidOperationException(message.ToString());\n   }\n\n   [DoesNotReturn]\n   static void\n   ThrowDuplicateConstructorArgument(ParameterInfo param, int? columnOrdinal, DbDataReader record) {\n\n      var message = new StringBuilder();\n      message.Append($\"Already specified an argument for parameter '{param.Name}'\");\n\n      if (columnOrdinal.HasValue) {\n         message.Append($\" ('{record.GetName(columnOrdinal.Value)}')\");\n      }\n\n      message.Append('.');\n\n      throw new InvalidOperationException(message.ToString());\n   }\n\n   private protected Node\n   GetRootNode(DbDataReader record) {\n\n      if (_rootNode is null) {\n\n         var node = CreateRootNode();\n         ReadMapping(record, node);\n\n         _rootNode = node;\n      }\n\n      return _rootNode;\n   }\n\n   partial void\n   InitializeMappingContext2(MappingContext context);\n\n   protected abstract Node\n   CreateRootNode();\n\n   protected abstract Node?\n   CreateSimpleProperty(Node container, string propertyName, int columnOrdinal);\n\n   protected abstract Node?\n   CreateComplexProperty(Node container, string propertyName);\n\n   protected abstract Node\n   CreateParameterNode(ParameterInfo paramInfo);\n\n   protected abstract Node\n   CreateParameterNode(int columnOrdinal, ParameterInfo paramInfo);\n\n   static ConstructorInfo\n   ChooseConstructor(ConstructorInfo[] constructors, Node node, int parameterLength) {\n\n      constructors = constructors\n         .Where(c => c.GetParameters().Length == parameterLength)\n         .ToArray();\n\n      if (constructors.Length == 0) {\n         throw new InvalidOperationException(\n            $\"Couldn't find a public constructor with {parameterLength} parameter(s) for type '{node.TypeName}'.\");\n      }\n\n      if (constructors.Length > 1) {\n         throw new InvalidOperationException(\n            $\"Found more than one public constructors with {parameterLength} parameter(s) for type '{node.TypeName}'. Please use another constructor.\");\n      }\n\n      return constructors[0];\n   }\n\n   sealed class MapGroup(int depth, string name, string parent, Dictionary<int, string> properties) {\n\n      public readonly int\n      Depth = depth;\n\n      public readonly string\n      Name = name;\n\n      public readonly string\n      Parent = parent;\n\n      public readonly Dictionary<int, string>\n      Properties = properties;\n   }\n\n   readonly struct MapParam {\n\n      public readonly int?\n      ColumnOrdinal;\n\n      public readonly MapGroup?\n      Group;\n\n      public\n      MapParam(int columnOrdinal) {\n\n         this.ColumnOrdinal = columnOrdinal;\n         this.Group = null;\n      }\n\n      public\n      MapParam(MapGroup group) {\n\n         this.ColumnOrdinal = null;\n         this.Group = group;\n      }\n   }\n}\n\nsealed partial class MappingContext {\n\n   public TextWriter?\n   Log;\n\n   public bool\n   SingleResult;\n}\n\nabstract class Node {\n\n   Dictionary<uint, Node>?\n   _constructorParameters;\n\n   List<Node>?\n   _properties;\n\n   public abstract bool\n   IsComplex { get; }\n\n   public abstract string?\n   PropertyName { get; }\n\n   public abstract int\n   ColumnOrdinal { get; }\n\n   public abstract string\n   TypeName { get; }\n\n   public ConstructorInfo?\n   Constructor { get; internal set; }\n\n   public Dictionary<uint, Node>\n   ConstructorParameters =>\n      _constructorParameters ??= new Dictionary<uint, Node>();\n\n   public List<Node>\n   Properties =>\n      _properties ??= new List<Node>();\n\n   public bool\n   HasConstructorParameters =>\n      _constructorParameters?.Count > 0;\n\n   public bool\n   HasProperties =>\n      _properties?.Count > 0;\n\n   public abstract ConstructorInfo[]\n   GetConstructors(BindingFlags bindingAttr);\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/Accessors.cs",
    "content": "﻿// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\nusing System.Reflection;\nusing System.Reflection.Emit;\nusing System.Runtime.CompilerServices;\n\nnamespace DbExtensions.Metadata;\n\ndelegate V DGet<T, V>(T t);\ndelegate void DSet<T, V>(T t, V v);\ndelegate void DRSet<T, V>(ref T t, V v);\n\nstatic class FieldAccessor {\n\n   [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]\n   internal static MetaAccessor\n   Create(Type objectType, FieldInfo fi) {\n\n      if (!fi.ReflectedType.IsAssignableFrom(objectType)) {\n         throw Error.InvalidFieldInfo(objectType, fi.FieldType, fi);\n      }\n\n      Delegate dget = null;\n      Delegate drset = null;\n\n      if (!objectType.IsGenericType) {\n\n         var mget = new DynamicMethod(\n            \"xget_\" + fi.Name,\n            fi.FieldType,\n            [objectType],\n            true);\n\n         var gen = mget.GetILGenerator();\n         gen.Emit(OpCodes.Ldarg_0);\n         gen.Emit(OpCodes.Ldfld, fi);\n         gen.Emit(OpCodes.Ret);\n         dget = mget.CreateDelegate(typeof(DGet<,>).MakeGenericType(objectType, fi.FieldType));\n\n         var mset = new DynamicMethod(\n            \"xset_\" + fi.Name,\n            typeof(void),\n            [objectType.MakeByRefType(), fi.FieldType],\n            true);\n\n         gen = mset.GetILGenerator();\n         gen.Emit(OpCodes.Ldarg_0);\n\n         if (!objectType.IsValueType) {\n            gen.Emit(OpCodes.Ldind_Ref);\n         }\n\n         gen.Emit(OpCodes.Ldarg_1);\n         gen.Emit(OpCodes.Stfld, fi);\n         gen.Emit(OpCodes.Ret);\n         drset = mset.CreateDelegate(typeof(DRSet<,>).MakeGenericType(objectType, fi.FieldType));\n      }\n\n      return (MetaAccessor)Activator.CreateInstance(\n         typeof(Accessor<,>).MakeGenericType(objectType, fi.FieldType),\n         BindingFlags.Instance | BindingFlags.NonPublic, null,\n         [fi, dget, drset], null);\n   }\n\n   sealed class Accessor<T, V> : MetaAccessor<T, V> {\n\n      readonly DGet<T, V>\n      _dget;\n\n      readonly DRSet<T, V>\n      _drset;\n      readonly FieldInfo _fi;\n\n      internal\n      Accessor(FieldInfo fi, DGet<T, V> dget, DRSet<T, V> drset) {\n         _fi = fi;\n         _dget = dget;\n         _drset = drset;\n      }\n\n      public override V\n      GetValue(T instance) {\n\n         if (_dget is not null) {\n            return _dget.Invoke(instance);\n         }\n\n         return (V)_fi.GetValue(instance);\n      }\n\n      public override void\n      SetValue(ref T instance, V value) {\n\n         if (_drset is not null) {\n            _drset.Invoke(ref instance, value);\n         } else {\n            _fi.SetValue(instance, value);\n         }\n      }\n   }\n}\n\nstatic class PropertyAccessor {\n\n   internal static MetaAccessor\n   Create(Type objectType, PropertyInfo pi, MetaAccessor storageAccessor) {\n\n      var dset = default(Delegate);\n      var drset = default(Delegate);\n      var dgetType = typeof(DGet<,>).MakeGenericType(objectType, pi.PropertyType);\n      var getMethod = pi.GetGetMethod(true);\n\n      var dget = Delegate.CreateDelegate(dgetType, getMethod, true)\n         ?? throw Error.CouldNotCreateAccessorToProperty(objectType, pi.PropertyType, pi);\n\n      if (pi.CanWrite) {\n\n         if (!objectType.IsValueType) {\n            dset = Delegate.CreateDelegate(typeof(DSet<,>).MakeGenericType(objectType, pi.PropertyType), pi.GetSetMethod(true), true);\n         } else {\n\n            var mset = new DynamicMethod(\n               \"xset_\" + pi.Name,\n               typeof(void),\n               [objectType.MakeByRefType(), pi.PropertyType],\n               true);\n\n            var gen = mset.GetILGenerator();\n            gen.Emit(OpCodes.Ldarg_0);\n            gen.Emit(OpCodes.Ldind_Ref);\n            gen.Emit(OpCodes.Ldarg_1);\n            gen.Emit(OpCodes.Call, pi.GetSetMethod(true));\n            gen.Emit(OpCodes.Ret);\n            drset = mset.CreateDelegate(typeof(DRSet<,>).MakeGenericType(objectType, pi.PropertyType));\n         }\n      }\n\n      var saType = (storageAccessor is not null) ?\n         storageAccessor.Type\n         : pi.PropertyType;\n\n      return (MetaAccessor)Activator.CreateInstance(\n         typeof(Accessor<,,>).MakeGenericType(objectType, pi.PropertyType, saType),\n         BindingFlags.Instance | BindingFlags.NonPublic, null,\n         [pi, dget, dset, drset, storageAccessor], null);\n   }\n\n   internal static MetaCollectionAccessor\n   CreateCollection(Type objectType, Type elementType, PropertyInfo pi) {\n\n      var propAccessor = Create(objectType, pi, null);\n      var colType = pi.PropertyType;\n\n      var addMethod = colType.GetMethod(\"Add\", BindingFlags.Instance | BindingFlags.Public, null, [elementType], null)\n         ?? throw new InvalidOperationException($\"Couldn't find a public 'Add' method on '{colType.FullName}'.\");\n\n      var addFn = Delegate.CreateDelegate(typeof(Action<,>)\n         .MakeGenericType(colType, elementType), addMethod);\n\n      return (MetaCollectionAccessor)Activator.CreateInstance(\n         typeof(MetaCollectionAccessor<,,>).MakeGenericType(objectType, colType, elementType),\n         BindingFlags.Instance | BindingFlags.NonPublic,\n         null,\n         [propAccessor, addFn],\n         null)!;\n   }\n\n   sealed class Accessor<T, V, V2> : MetaAccessor<T, V> where V2 : V {\n\n      readonly PropertyInfo\n      _pi;\n\n      readonly DGet<T, V>\n      _dget;\n\n      readonly DSet<T, V>\n      _dset;\n\n      readonly DRSet<T, V>\n      _drset;\n\n      readonly MetaAccessor<T, V2>\n      _storage;\n\n      internal\n      Accessor(PropertyInfo pi, DGet<T, V> dget, DSet<T, V> dset, DRSet<T, V> drset, MetaAccessor<T, V2> storage) {\n\n         _pi = pi;\n         _dget = dget;\n         _dset = dset;\n         _drset = drset;\n         _storage = storage;\n      }\n\n      public override V\n      GetValue(T instance) =>\n         _dget.Invoke(instance);\n\n      public override void\n      SetValue(ref T instance, V value) {\n\n         if (_dset is not null) {\n            _dset.Invoke(instance, value);\n\n         } else if (_drset is not null) {\n            _drset.Invoke(ref instance, value);\n\n         } else if (_storage is not null) {\n            _storage.SetValue(ref instance, (V2)value);\n\n         } else {\n            throw Error.UnableToAssignValueToReadonlyProperty(_pi);\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/AttributedMetaModel.cs",
    "content": "// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing System.Reflection;\nusing System.Threading;\n\nnamespace DbExtensions.Metadata;\n\nsealed class AttributedMetaModel : MetaModel {\n\n   readonly ReaderWriterLock\n   _lock = new();\n\n   readonly Dictionary<Type, MetaType>\n   _metaTypes = new();\n\n   readonly Dictionary<Type, MetaTable>\n   _metaTables = new();\n\n   internal override MappingSource\n   MappingSource { get; }\n\n   internal override Type\n   ContextType { get; }\n\n   internal override string\n   DatabaseName { get; }\n\n   internal\n   AttributedMetaModel(MappingSource mappingSource, Type contextType) {\n\n      this.MappingSource = mappingSource;\n      this.ContextType = contextType;\n\n      var das = (DatabaseAttribute[])this.ContextType.GetCustomAttributes(typeof(DatabaseAttribute), false);\n\n      this.DatabaseName = (das is not null && das.Length > 0) ?\n         das[0].Name\n         : this.ContextType.Name;\n   }\n\n   public override IEnumerable<MetaTable>\n   GetTables() {\n\n      _lock.AcquireReaderLock(Timeout.Infinite);\n\n      try {\n         return _metaTables.Values\n            .Where(x => x is not null)\n            .Distinct();\n      } finally {\n         _lock.ReleaseReaderLock();\n      }\n   }\n\n   public override MetaTable\n   GetTable(Type rowType, MetaTableConfiguration config) {\n\n      ArgumentNullException.ThrowIfNull(rowType);\n\n      MetaTable table;\n\n      _lock.AcquireReaderLock(Timeout.Infinite);\n\n      try {\n         if (_metaTables.TryGetValue(rowType, out table)) {\n            return table;\n         }\n      } finally {\n         _lock.ReleaseReaderLock();\n      }\n\n      _lock.AcquireWriterLock(Timeout.Infinite);\n\n      try {\n         table = GetTableNoLocks(rowType, config);\n      } finally {\n         _lock.ReleaseWriterLock();\n      }\n\n      return table;\n   }\n\n   internal MetaTable\n   GetTableNoLocks(Type rowType, MetaTableConfiguration config) {\n\n      MetaTable table;\n\n      if (!_metaTables.TryGetValue(rowType, out table)) {\n\n         var root = GetRoot(rowType) ?? rowType;\n         var attrs = (TableAttribute[])root.GetCustomAttributes(typeof(TableAttribute), true);\n\n         if (attrs.Length == 0) {\n            _metaTables.Add(rowType, null);\n         } else {\n\n            if (!_metaTables.TryGetValue(root, out table)) {\n\n               table = new AttributedMetaTable(this, attrs[0], root, config);\n\n               foreach (var mt in table.RowType.InheritanceTypes) {\n                  _metaTables.Add(mt.Type, table);\n               }\n            }\n\n            // catch case of derived type that is not part of inheritance\n\n            if (table.RowType.GetInheritanceType(rowType) is null) {\n               _metaTables.Add(rowType, null);\n               return null;\n            }\n         }\n      }\n\n      return table;\n   }\n\n   static Type\n   GetRoot(Type derivedType) {\n\n      while (derivedType is not null && derivedType != typeof(object)) {\n\n         var attrs = (TableAttribute[])derivedType.GetCustomAttributes(typeof(TableAttribute), false);\n\n         if (attrs.Length > 0) {\n            return derivedType;\n         }\n\n         derivedType = derivedType.BaseType;\n      }\n\n      return null;\n   }\n\n   public override MetaType\n   GetMetaType(Type type, MetaTableConfiguration config) {\n\n      ArgumentNullException.ThrowIfNull(type);\n\n      MetaType mtype = null;\n\n      _lock.AcquireReaderLock(Timeout.Infinite);\n\n      try {\n         if (_metaTypes.TryGetValue(type, out mtype)) {\n            return mtype;\n         }\n      } finally {\n         _lock.ReleaseReaderLock();\n      }\n\n      // Attributed meta model allows us to learn about tables we did not\n      // statically know about\n\n      var tab = GetTable(type, config);\n\n      if (tab is not null) {\n         return tab.RowType.GetInheritanceType(type);\n      }\n\n      _lock.AcquireWriterLock(Timeout.Infinite);\n\n      try {\n         if (!_metaTypes.TryGetValue(type, out mtype)) {\n            mtype = new UnmappedType(this, type);\n            _metaTypes.Add(type, mtype);\n         }\n      } finally {\n         _lock.ReleaseWriterLock();\n      }\n\n      return mtype;\n   }\n}\n\nsealed class AttributedMetaTable : MetaTable {\n\n   public override MetaModel\n   Model { get; }\n\n   public override string\n   TableName { get; }\n\n   public override MetaType\n   RowType { get; }\n\n   internal MetaTableConfiguration\n   Configuration { get; private set; }\n\n   internal\n   AttributedMetaTable(AttributedMetaModel model, TableAttribute attr, Type rowType, MetaTableConfiguration config) {\n\n      // set this first\n      this.Configuration = new MetaTableConfiguration(config);\n\n      this.Model = model;\n      this.TableName = String.IsNullOrEmpty(attr.Name) ? rowType.Name : attr.Name;\n      this.RowType = new AttributedRootType(model, this, rowType);\n   }\n}\n\nsealed class AttributedRootType : AttributedMetaType {\n\n   readonly Dictionary<Type, MetaType>\n   _types;\n\n   readonly Dictionary<object, MetaType>\n   _codeMap;\n\n   internal override bool\n   HasInheritance => _types is not null;\n\n   internal override ReadOnlyCollection<MetaType>\n   InheritanceTypes { get; }\n\n   internal override MetaType\n   InheritanceDefault { get; }\n\n   internal\n   AttributedRootType(AttributedMetaModel model, AttributedMetaTable table, Type type)\n      : base(model, table, type, null) {\n\n      // check for inheritance and create all other types\n      var inheritanceInfo = (InheritanceMappingAttribute[])\n         type.GetCustomAttributes(typeof(InheritanceMappingAttribute), true);\n\n      if (inheritanceInfo.Length > 0) {\n\n         if (this.Discriminator is null) {\n            throw Error.NoDiscriminatorFound(type);\n         }\n\n         if (!MappingSystem.IsSupportedDiscriminatorType(this.Discriminator.Type)) {\n            throw Error.DiscriminatorClrTypeNotSupported(this.Discriminator.DeclaringType.Name, this.Discriminator.Name, this.Discriminator.Type);\n         }\n\n         _types = new Dictionary<Type, MetaType>();\n         _types.Add(type, this); // add self\n         _codeMap = new Dictionary<object, MetaType>();\n\n         // initialize inheritance types\n\n         foreach (var attr in inheritanceInfo) {\n\n            if (!type.IsAssignableFrom(attr.Type)) {\n               throw Error.InheritanceTypeDoesNotDeriveFromRoot(attr.Type, type);\n            }\n\n            if (attr.Type.IsAbstract) {\n               throw Error.AbstractClassAssignInheritanceDiscriminator(attr.Type);\n            }\n\n            var mt = CreateInheritedType(type, attr.Type);\n\n            if (attr.Code is null) {\n               throw Error.InheritanceCodeMayNotBeNull();\n            }\n\n            if (mt._inheritanceCode is not null) {\n               throw Error.InheritanceTypeHasMultipleDiscriminators(attr.Type);\n            }\n\n            //var codeValue = DBConvert.ChangeType(*/attr.Code/*, this.Discriminator.Type);\n            var codeValue = attr.Code;\n\n            foreach (var d in _codeMap.Keys) {\n\n               // if the keys are equal, or if they are both strings containing only spaces\n               // they are considered equal\n\n               if ((codeValue.GetType() == typeof(string)\n                     && ((string)codeValue).Trim().Length == 0\n                     && d.GetType() == typeof(string)\n                     && ((string)d).Trim().Length == 0)\n                  || Object.Equals(d, codeValue)) {\n\n                  throw Error.InheritanceCodeUsedForMultipleTypes(codeValue);\n               }\n            }\n\n            mt._inheritanceCode = codeValue;\n            _codeMap.Add(codeValue, mt);\n\n            if (attr.IsDefault) {\n\n               if (this.InheritanceDefault is not null) {\n                  throw Error.InheritanceTypeHasMultipleDefaults(type);\n               }\n\n               this.InheritanceDefault = mt;\n            }\n         }\n\n         if (this.InheritanceDefault is null) {\n            throw Error.InheritanceHierarchyDoesNotDefineDefault(type);\n         }\n      }\n\n      if (_types is not null) {\n         this.InheritanceTypes = _types.Values.ToList().AsReadOnly();\n      } else {\n         this.InheritanceTypes = new List<MetaType>(1) { this }.AsReadOnly();\n      }\n\n      Validate();\n   }\n\n   void\n   Validate() {\n\n      var memberToColumn = new Dictionary<object, string>();\n\n      foreach (var type in this.InheritanceTypes) {\n\n         if (type != this) {\n\n            var attrs = (TableAttribute[])type.Type.GetCustomAttributes(typeof(TableAttribute), false);\n\n            if (attrs.Length > 0) {\n               throw Error.InheritanceSubTypeIsAlsoRoot(type.Type);\n            }\n         }\n\n         foreach (var mem in type.PersistentDataMembers) {\n\n            if (mem.IsDeclaredBy(type)) {\n\n               if (mem.IsDiscriminator && !this.HasInheritance) {\n                  throw Error.NonInheritanceClassHasDiscriminator(type);\n               }\n\n               if (!mem.IsAssociation) {\n\n                  // validate that no database column is mapped twice\n\n                  if (!String.IsNullOrEmpty(mem.MappedName)) {\n\n                     var dn = InheritanceRules.DistinguishedMemberName(mem.Member);\n\n                     if (memberToColumn.TryGetValue(dn, out var column)) {\n                        if (column != mem.MappedName) {\n                           throw Error.MemberMappedMoreThanOnce(mem.Member.Name);\n                        }\n                     } else {\n                        memberToColumn.Add(dn, mem.MappedName);\n                     }\n                  }\n               }\n            }\n         }\n      }\n   }\n\n   AttributedMetaType\n   CreateInheritedType(Type root, Type type) {\n\n      MetaType metaType;\n\n      if (!_types.TryGetValue(type, out metaType)) {\n\n         metaType = new AttributedMetaType(this.Model, this.Table, type, this);\n         _types.Add(type, metaType);\n\n         if (type != root && type.BaseType != typeof(object)) {\n            CreateInheritedType(root, type.BaseType);\n         }\n      }\n\n      return (AttributedMetaType)metaType;\n   }\n\n   internal override MetaType\n   GetInheritanceType(Type type) {\n\n      if (type == this.Type) {\n         return this;\n      }\n\n      var metaType = default(MetaType);\n\n      _types?.TryGetValue(type, out metaType);\n\n      return metaType;\n   }\n}\n\nclass AttributedMetaType : MetaType {\n\n   Dictionary<MetaPosition, MetaDataMember>\n   _dataMemberMap;\n\n   ReadOnlyCollection<MetaDataMember>\n   _dataMembers;\n\n   ReadOnlyCollection<MetaAssociation>\n   _associations;\n\n   MetaDataMember\n   _dbGeneratedIdentity;\n\n   MetaDataMember\n   _version;\n\n   bool\n   _inheritanceBaseSet;\n\n   MetaType\n   _inheritanceBase;\n\n   internal object\n   _inheritanceCode;\n\n   MetaDataMember\n   _discriminator;\n\n   ReadOnlyCollection<MetaType>\n   _derivedTypes;\n\n   readonly object\n   _locktarget = new(); // Hold locks on private object rather than public MetaType.\n\n   public override MetaModel\n   Model { get; }\n\n   public override MetaTable\n   Table { get; }\n\n   public override Type\n   Type { get; }\n\n   public override MetaDataMember\n   DBGeneratedIdentityMember => _dbGeneratedIdentity;\n\n   public override MetaDataMember\n   VersionMember => _version;\n\n   public override string\n   Name => Type.Name;\n\n   public override bool\n   IsEntity => Table?.RowType.IdentityMembers.Count > 0;\n\n   public override bool\n   CanInstantiate => !Type.IsAbstract && (this == InheritanceRoot || HasInheritanceCode);\n\n   public override bool\n   HasUpdateCheck => PersistentDataMembers.Any(m => m.UpdateCheck != UpdateCheck.Never);\n\n   public override ReadOnlyCollection<MetaDataMember>\n   DataMembers => _dataMembers;\n\n   public override ReadOnlyCollection<MetaDataMember>\n   PersistentDataMembers { get; }\n\n   public override ReadOnlyCollection<MetaDataMember>\n   IdentityMembers { get; }\n\n   public override ReadOnlyCollection<MetaAssociation>\n   Associations {\n      get {\n\n         // LOCKING: Associations are late-expanded so that cycles are broken.\n\n         if (_associations is null) {\n            lock (_locktarget) {\n               _associations ??= DataMembers.Where(m => m.IsAssociation)\n                  .Select(m => m.Association)\n                  .ToList()\n                  .AsReadOnly();\n            }\n         }\n\n         return _associations;\n      }\n   }\n\n   internal override MetaType\n   InheritanceRoot { get; }\n\n   internal override MetaDataMember\n   Discriminator => _discriminator;\n\n   internal override bool\n   HasInheritance => InheritanceRoot.HasInheritance;\n\n   internal override bool\n   HasInheritanceCode => InheritanceCode is not null;\n\n   internal override object\n   InheritanceCode => _inheritanceCode;\n\n   internal override MetaType\n   InheritanceDefault => InheritanceRoot.InheritanceDefault;\n\n   internal override bool\n   IsInheritanceDefault => InheritanceDefault == this;\n\n   internal override ReadOnlyCollection<MetaType>\n   InheritanceTypes => InheritanceRoot.InheritanceTypes;\n\n   internal override MetaType\n   InheritanceBase {\n      get {\n\n         // LOCKING: Cannot initialize at construction\n\n         if (!_inheritanceBaseSet\n            && _inheritanceBase is null) {\n\n            lock (_locktarget) {\n               if (_inheritanceBase is null) {\n                  _inheritanceBase = InheritanceBaseFinder.FindBase(this);\n                  _inheritanceBaseSet = true;\n               }\n            }\n         }\n\n         return _inheritanceBase;\n      }\n   }\n\n   internal override ReadOnlyCollection<MetaType>\n   DerivedTypes {\n      get {\n\n         // LOCKING: Cannot initialize at construction because derived types\n         // won't exist yet.\n\n         if (_derivedTypes is null) {\n            lock (_locktarget) {\n               if (_derivedTypes is null) {\n\n                  var dTypes = new List<MetaType>();\n\n                  foreach (var mt in InheritanceTypes) {\n                     if (mt.Type.BaseType == Type) {\n                        dTypes.Add(mt);\n                     }\n                  }\n\n                  _derivedTypes = dTypes.AsReadOnly();\n               }\n            }\n         }\n\n         return _derivedTypes;\n      }\n   }\n\n   internal\n   AttributedMetaType(MetaModel model, MetaTable table, Type type, MetaType inheritanceRoot) {\n\n      this.Model = model;\n      this.Table = table;\n      this.Type = type;\n      this.InheritanceRoot = inheritanceRoot ?? this;\n\n      // Not lazy-loading to simplify locking and enhance performance \n      // (because no lock will be required for the common read scenario).\n\n      InitDataMembers();\n\n      this.IdentityMembers = this.DataMembers.Where(m => m.IsPrimaryKey).ToList().AsReadOnly();\n      this.PersistentDataMembers = this.DataMembers.Where(m => m.IsPersistent).ToList().AsReadOnly();\n   }\n\n   void\n   ValidatePrimaryKeyMember(MetaDataMember mm) {\n\n      //if the type is a sub-type, no member declared in the type can be primary key\n\n      if (mm.IsPrimaryKey\n         && this.InheritanceRoot != this\n         && mm.Member.DeclaringType == this.Type) {\n\n         throw (Error.PrimaryKeyInSubTypeNotSupported(this.Type.Name, mm.Name));\n      }\n   }\n\n   void\n   InitDataMembers() {\n\n      if (_dataMembers is null) {\n\n         _dataMemberMap = new Dictionary<MetaPosition, MetaDataMember>();\n\n         InitDataMembersImpl(this.Type);\n\n         _dataMembers = new List<MetaDataMember>(_dataMemberMap.Values).AsReadOnly();\n      }\n   }\n\n   void\n   InitDataMembersImpl(Type containerType, MetaComplexProperty containerCp = null) {\n\n      var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;\n\n      var fis = TypeSystem.GetAllFields(containerType, flags)\n         .ToArray();\n\n      if (fis is not null) {\n\n         for (int i = 0, n = fis.Length; i < n; i++) {\n\n            var fi = fis[i];\n            var mm = new AttributedMetaDataMember(this, fi, _dataMemberMap.Count, null);\n            ValidatePrimaryKeyMember(mm);\n\n            // must be public or persistent\n            if (!mm.IsPersistent && !fi.IsPublic) {\n               continue;\n            }\n\n            _dataMemberMap.Add(new MetaPosition(fi), mm);\n\n            // must be persistent for the rest\n\n            if (!mm.IsPersistent) {\n               continue;\n            }\n\n            InitSpecialMember(mm);\n         }\n      }\n\n      var pis = TypeSystem.GetAllProperties(containerType, flags)\n         .ToArray();\n\n      if (pis is not null) {\n\n         for (int i = 0, n = pis.Length; i < n; i++) {\n\n            var pi = pis[i];\n\n            var mm = new AttributedMetaDataMember(this, pi, _dataMemberMap.Count, containerCp);\n            ValidatePrimaryKeyMember(mm);\n\n            // must be public or persistent\n\n            var isPublic =\n               (pi.CanRead && pi.GetGetMethod(false) is not null)\n                  && (!pi.CanWrite || pi.GetSetMethod(false) is not null);\n\n            if (!mm.IsPersistent && !isPublic) {\n               continue;\n            }\n\n            if (!mm.IsPersistent) {\n\n               var cpAttr = (ComplexPropertyAttribute)Attribute.GetCustomAttribute(pi, typeof(ComplexPropertyAttribute));\n\n               if (cpAttr is not null) {\n\n                  var complexPropType = pi.PropertyType;\n\n                  if (!complexPropType.IsClass) {\n                     throw new InvalidOperationException(\"A persistent complex property must be a class.\");\n                  }\n\n                  if (complexPropType.IsAbstract) {\n                     throw new InvalidOperationException(\"A persistent complex property cannot be an abstract type.\");\n                  }\n\n                  var metaCp = new MetaComplexProperty(this, pi, cpAttr, containerCp);\n\n                  InitDataMembersImpl(complexPropType, metaCp);\n\n                  continue;\n               }\n            }\n\n            _dataMemberMap.Add(new MetaPosition(pi), mm);\n\n            // must be persistent for the rest\n\n            if (!mm.IsPersistent) {\n               continue;\n            }\n\n            InitSpecialMember(mm);\n         }\n      }\n   }\n\n   void\n   InitSpecialMember(MetaDataMember mm) {\n\n      // Can only have one auto gen member that is also an identity member,\n      // except if that member is a computed column (since they are implicitly auto gen)\n\n      if (mm.IsDbGenerated\n         && mm.IsPrimaryKey\n         && String.IsNullOrEmpty(mm.Expression)) {\n\n         if (_dbGeneratedIdentity is not null) {\n            throw Error.TwoMembersMarkedAsPrimaryKeyAndDBGenerated(mm.Member, _dbGeneratedIdentity.Member);\n         }\n\n         _dbGeneratedIdentity = mm;\n      }\n\n      if (mm.IsPrimaryKey\n         && !MappingSystem.IsSupportedIdentityType(mm.Type)) {\n\n         throw Error.IdentityClrTypeNotSupported(mm.DeclaringType, mm.Name, mm.Type);\n      }\n\n      if (mm.IsVersion) {\n\n         if (_version is not null) {\n            throw Error.TwoMembersMarkedAsRowVersion(mm.Member, _version.Member);\n         }\n\n         _version = mm;\n      }\n\n      if (mm.IsDiscriminator) {\n\n         if (_discriminator is not null) {\n            throw Error.TwoMembersMarkedAsInheritanceDiscriminator(mm.Member, _discriminator.Member);\n         }\n\n         _discriminator = mm;\n      }\n   }\n\n   public override MetaDataMember\n   GetDataMember(MemberInfo mi) {\n\n      ArgumentNullException.ThrowIfNull(mi);\n\n      if (_dataMemberMap.TryGetValue(new MetaPosition(mi), out var mm)) {\n         return mm;\n      }\n\n      // DON'T look to see if we are trying to get a member from an inherited type.\n      // The calling code should know to look in the inherited type.\n\n      if (mi.DeclaringType.IsInterface) {\n         throw Error.MappingOfInterfacesMemberIsNotSupported(mi.DeclaringType.Name, mi.Name);\n      }\n\n      // the member is not mapped in the base class\n\n      throw Error.UnmappedClassMember(mi.DeclaringType.Name, mi.Name);\n   }\n\n   internal override MetaType\n   GetInheritanceType(Type inheritanceType) {\n\n      if (inheritanceType == this.Type) {\n         return this;\n      }\n\n      return this.InheritanceRoot.GetInheritanceType(inheritanceType);\n   }\n\n   internal override MetaType\n   GetTypeForInheritanceCode(object key) {\n\n      if (this.InheritanceRoot.Discriminator.Type == typeof(string)) {\n\n         var skey = (string)key;\n\n         foreach (var mt in this.InheritanceRoot.InheritanceTypes) {\n\n            if (String.Compare((string)mt.InheritanceCode, skey, StringComparison.OrdinalIgnoreCase) == 0) {\n               return mt;\n            }\n         }\n\n      } else {\n\n         foreach (var mt in this.InheritanceRoot.InheritanceTypes) {\n            if (Object.Equals(mt.InheritanceCode, key)) {\n               return mt;\n            }\n         }\n      }\n\n      return null;\n   }\n\n   public override string\n   ToString() => this.Name;\n}\n\nsealed class AttributedMetaDataMember : MetaDataMember {\n\n   readonly Type\n   _memberDeclaringType;\n\n   bool\n   _hasAccessors;\n\n   MetaAccessor\n   _accPublic;\n\n   MetaAccessor\n   _accPrivate;\n\n   readonly IDataAttribute\n   _attr;\n\n   readonly ColumnAttribute\n   _attrColumn;\n\n   readonly AssociationAttribute\n   _attrAssoc;\n\n   AttributedMetaAssociation\n   _assoc;\n\n   readonly bool\n   _isNullableType;\n\n   readonly object\n   _locktarget = new(); // Hold locks on private object rather than public MetaType.\n\n   readonly MetaComplexProperty\n   _containerCp;\n\n   public override MetaType\n   DeclaringType { get; }\n\n   public override MemberInfo\n   Member { get; }\n\n   public override MemberInfo\n   StorageMember { get; }\n\n   public override string\n   Name => Member.Name;\n\n   public override int\n   Ordinal { get; }\n\n   public override Type\n   Type { get; }\n\n   public override Type\n   ConvertToType => _attrColumn?.ConvertTo;\n\n   public override bool\n   IsPersistent => _attrColumn is not null || _attrAssoc is not null;\n\n   public override bool\n   IsAssociation => _attrAssoc is not null;\n\n   public override bool\n   IsPrimaryKey => _attrColumn?.IsPrimaryKey ?? false;\n\n   public override bool\n   IsVersion => _attrColumn?.IsVersion ?? false;\n\n   public override string\n   DbType => _attrColumn?.DbType;\n\n   public override string\n   Expression => _attrColumn?.Expression;\n\n   public override UpdateCheck\n   UpdateCheck => _attrColumn?.UpdateCheck ?? UpdateCheck.Never;\n\n   public override string\n   MappedName {\n      get {\n         var n = _attrColumn?.Name\n            ?? _attrAssoc?.Name\n            ?? Member.Name;\n\n         if (_containerCp is not null) {\n            return _containerCp.FullMappedName + _containerCp.Separator + n;\n         }\n\n         return n;\n      }\n   }\n\n   public override string\n   QueryPath =>\n      (_containerCp is not null) ?\n         _containerCp.QueryPath + MetaComplexProperty.QueryPathSeparator + Name\n         : Name;\n\n   internal override bool\n   IsDiscriminator => _attrColumn?.IsDiscriminator ?? false;\n\n   /// <summary>\n   /// Returns true if the member is explicitly marked as auto gen, or if the\n   /// member is computed or generated by the database server.\n   /// </summary>\n\n   public override bool\n   IsDbGenerated {\n      get {\n         return _attrColumn is not null &&\n            (_attrColumn.IsDbGenerated || !String.IsNullOrEmpty(_attrColumn.Expression)) || IsVersion;\n      }\n   }\n\n   public override MetaAccessor\n   MemberAccessor {\n      get {\n         InitAccessors();\n         return _accPublic;\n      }\n   }\n\n   public override MetaAccessor\n   StorageAccessor {\n      get {\n         InitAccessors();\n         return _accPrivate;\n      }\n   }\n\n   public override bool\n   CanBeNull {\n      get {\n\n         if (_attrColumn is null) {\n            return true;\n         }\n\n         if (!_attrColumn.CanBeNullSet) {\n            return _isNullableType || !Type.IsValueType;\n         }\n\n         return _attrColumn.CanBeNull;\n      }\n   }\n\n   public override AutoSync\n   AutoSync {\n      get {\n         if (_attrColumn is not null) {\n\n            // auto-gen keys are always and only synced on insert\n\n            if (IsDbGenerated && IsPrimaryKey) {\n               return AutoSync.OnInsert;\n            }\n\n            // if the user has explicitly set it, use their value\n\n            if (_attrColumn.AutoSync != AutoSync.Default) {\n               return _attrColumn.AutoSync;\n            }\n\n            // database generated members default to always\n\n            if (IsDbGenerated) {\n               return AutoSync.Always;\n            }\n         }\n\n         return AutoSync.Never;\n      }\n   }\n\n   public override MetaAssociation\n   Association {\n      get {\n\n         if (IsAssociation) {\n\n            // LOCKING: This deferral isn't an optimization. It can't be done in the constructor\n            // because there may be loops in the association graph.\n\n            if (_assoc is null) {\n               lock (_locktarget) {\n                  _assoc ??= new AttributedMetaAssociation(this, _attrAssoc);\n               }\n            }\n         }\n\n         return _assoc;\n      }\n   }\n\n   internal\n   AttributedMetaDataMember(AttributedMetaType metaType, MemberInfo mi, int ordinal, MetaComplexProperty containerCp) {\n\n      _memberDeclaringType = mi.DeclaringType;\n      this.DeclaringType = metaType;\n      this.Member = mi;\n      this.Ordinal = ordinal;\n      this.Type = TypeSystem.GetMemberType(mi);\n      _isNullableType = TypeSystem.IsNullableType(this.Type);\n      _attrColumn = (ColumnAttribute)Attribute.GetCustomAttribute(mi, typeof(ColumnAttribute));\n      _attrAssoc = (AssociationAttribute)Attribute.GetCustomAttribute(mi, typeof(AssociationAttribute));\n      _attr = (_attrColumn is not null) ? (IDataAttribute)_attrColumn : (IDataAttribute)_attrAssoc;\n\n      if (_attr is not null && _attr.Storage is not null) {\n\n         var mis = mi.DeclaringType.GetMember(_attr.Storage, BindingFlags.Instance | BindingFlags.NonPublic);\n\n         if (mis is null || mis.Length != 1) {\n            throw Error.BadStorageProperty(_attr.Storage, mi.DeclaringType, mi.Name);\n         }\n\n         this.StorageMember = mis[0];\n      }\n\n      var storageType = (this.StorageMember is not null) ?\n         TypeSystem.GetMemberType(this.StorageMember)\n         : this.Type;\n\n      if (_attrColumn is not null\n         && _attrColumn.IsDbGenerated\n         && _attrColumn.IsPrimaryKey) {\n\n         // auto-gen identities must be synced on insert\n\n         if ((_attrColumn.AutoSync != AutoSync.Default)\n            && (_attrColumn.AutoSync != AutoSync.OnInsert)) {\n\n            throw Error.IncorrectAutoSyncSpecification(mi.Name);\n         }\n      }\n\n      _containerCp = containerCp;\n   }\n\n   void\n   InitAccessors() {\n\n      if (!_hasAccessors) {\n\n         var association = this.Association;\n\n         lock (_locktarget) {\n            if (!_hasAccessors) {\n\n               if (association is { IsMany: true }) {\n\n                  var elementType = association.OtherType.Type;\n                  var pi = (PropertyInfo)this.Member;\n\n                  _accPublic = _accPrivate =\n                     PropertyAccessor.CreateCollection(this.Member.ReflectedType, elementType, pi);\n\n               } else if (this.StorageMember is not null) {\n                  _accPrivate = MakeMemberAccessor(this.Member.ReflectedType, this.StorageMember, null);\n                  _accPublic = MakeMemberAccessor(this.Member.ReflectedType, this.Member, _accPrivate);\n               } else {\n                  _accPublic = _accPrivate = MakeMemberAccessor(this.Member.ReflectedType, this.Member, null);\n               }\n\n               _hasAccessors = true;\n            }\n         }\n      }\n   }\n\n   static MetaAccessor\n   MakeMemberAccessor(Type accessorType, MemberInfo mi, MetaAccessor storage) {\n\n      var fi = mi as FieldInfo;\n      MetaAccessor acc;\n\n      if (fi is not null) {\n         acc = FieldAccessor.Create(accessorType, fi);\n      } else {\n         var pi = (PropertyInfo)mi;\n         acc = PropertyAccessor.Create(accessorType, pi, storage);\n      }\n\n      return acc;\n   }\n\n   public override object\n   GetValueForDatabase(object instance) {\n\n      if (_containerCp is not null) {\n\n         instance = _containerCp.GetValueFromRoot(instance);\n\n         if (instance is null) {\n            return null;\n         }\n      }\n\n      return base.GetValueForDatabase(instance);\n   }\n\n   public override bool\n   IsDeclaredBy(MetaType declaringMetaType) {\n\n      ArgumentNullException.ThrowIfNull(declaringMetaType);\n\n      return declaringMetaType.Type == _memberDeclaringType;\n   }\n\n   public override string\n   ToString() =>\n      this.DeclaringType.ToString() + \":\" + this.Member.ToString();\n}\n\nsealed class MetaComplexProperty {\n\n   internal static readonly string\n   QueryPathSeparator = Mapper._pathSeparator.ToString();\n\n   readonly ComplexPropertyAttribute\n   _cpAttr;\n\n   MetaAccessor\n   _accPublic;\n\n   bool\n   _hasAccessors;\n\n   readonly object\n   _locktarget = new();\n\n   public PropertyInfo\n   Member { get; }\n\n   public string\n   Separator => _cpAttr.Separator;\n\n   public string\n   MappedName => _cpAttr.Name ?? Member.Name;\n\n   public string\n   FullMappedName =>\n      (Parent is not null) ?\n         Parent.FullMappedName + Parent.Separator + MappedName\n         : MappedName;\n\n   public string\n   QueryPath =>\n      (Parent is not null) ?\n         Parent.QueryPath + QueryPathSeparator + Member.Name\n         : Member.Name;\n\n   public MetaComplexProperty\n   Parent { get; }\n\n   public MetaAccessor\n   MemberAccessor {\n      get {\n         InitAccessors();\n         return _accPublic;\n      }\n   }\n\n   public\n   MetaComplexProperty(AttributedMetaType metaType, PropertyInfo member, ComplexPropertyAttribute cpAttr, MetaComplexProperty parent) {\n\n      this.Member = member;\n      _cpAttr = cpAttr;\n      this.Parent = parent;\n\n      string defaultSeparator;\n\n      if (cpAttr.Separator is null\n         && (defaultSeparator = ((AttributedMetaTable)metaType.Table).Configuration.DefaultComplexPropertySeparator) is not null) {\n\n         _cpAttr = new ComplexPropertyAttribute(_cpAttr) {\n            Separator = defaultSeparator\n         };\n      }\n   }\n\n   void\n   InitAccessors() {\n\n      if (!_hasAccessors) {\n         lock (_locktarget) {\n            if (!_hasAccessors) {\n\n               _accPublic = PropertyAccessor.Create(this.Member.ReflectedType, this.Member, null);\n               _hasAccessors = true;\n            }\n         }\n      }\n   }\n\n   public object\n   GetValueFromRoot(object root) {\n\n      var cpStack = new Stack<MetaComplexProperty>();\n      cpStack.Push(this);\n\n      var current = this;\n\n      while (current.Parent is not null) {\n         cpStack.Push(current.Parent);\n         current = current.Parent;\n      }\n\n      object obj = root;\n\n      while (cpStack.Count > 0) {\n\n         var cp = cpStack.Pop();\n         obj = cp.MemberAccessor.GetBoxedValue(obj);\n\n         if (obj is null) {\n            break;\n         }\n      }\n\n      return obj;\n   }\n}\n\nsealed class AttributedMetaAssociation : MetaAssociationImpl {\n\n   public override MetaType\n   OtherType { get; }\n\n   public override MetaDataMember\n   ThisMember { get; }\n\n   public override MetaDataMember\n   OtherMember { get; }\n\n   public override ReadOnlyCollection<MetaDataMember>\n   ThisKey { get; }\n\n   public override ReadOnlyCollection<MetaDataMember>\n   OtherKey { get; }\n\n   public override bool\n   ThisKeyIsPrimaryKey { get; }\n\n   public override bool\n   OtherKeyIsPrimaryKey { get; }\n\n   public override bool\n   IsMany { get; }\n\n   public override bool\n   IsForeignKey { get; }\n\n   public override bool\n   IsUnique { get; }\n\n   public override bool\n   IsNullable { get; }\n\n   public override string\n   DeleteRule { get; }\n\n   public override bool\n   DeleteOnNull { get; }\n\n   internal\n   AttributedMetaAssociation(AttributedMetaDataMember member, AssociationAttribute attr) {\n\n      this.ThisMember = member;\n      this.IsMany = TypeSystem.IsSequenceType(this.ThisMember.Type);\n\n      var ot = (this.IsMany) ?\n         TypeSystem.GetElementType(this.ThisMember.Type)\n         : this.ThisMember.Type;\n\n      this.OtherType = this.ThisMember.DeclaringType.Model.GetMetaType(ot, ((AttributedMetaTable)this.ThisMember.DeclaringType.Table).Configuration);\n      this.ThisKey = (attr.ThisKey is not null) ? MakeKeys(this.ThisMember.DeclaringType, attr.ThisKey) : this.ThisMember.DeclaringType.IdentityMembers;\n      this.OtherKey = (attr.OtherKey is not null) ? MakeKeys(this.OtherType, attr.OtherKey) : this.OtherType.IdentityMembers;\n      this.ThisKeyIsPrimaryKey = AreEqual(this.ThisKey, this.ThisMember.DeclaringType.IdentityMembers);\n      this.OtherKeyIsPrimaryKey = AreEqual(this.OtherKey, this.OtherType.IdentityMembers);\n      this.IsForeignKey = attr.IsForeignKey;\n\n      this.IsUnique = attr.IsUnique;\n      this.DeleteRule = attr.DeleteRule;\n      this.DeleteOnNull = attr.DeleteOnNull;\n\n      // if any key members are not nullable, the association is not nullable\n\n      foreach (var mm in this.ThisKey) {\n\n         if (!mm.CanBeNull) {\n            this.IsNullable = false;\n            break;\n         }\n      }\n\n      // validate DeleteOnNull specification\n\n      if (this.DeleteOnNull == true) {\n         if (!(this.IsForeignKey\n            && !this.IsMany\n            && !this.IsNullable)) {\n\n            throw Error.InvalidDeleteOnNullSpecification(member);\n         }\n      }\n\n      // validate the number of ThisKey columns is the same as the number of OtherKey columns\n\n      if (this.ThisKey.Count != this.OtherKey.Count\n         && this.ThisKey.Count > 0\n         && this.OtherKey.Count > 0) {\n\n         throw Error.MismatchedThisKeyOtherKey(member.Name, member.DeclaringType.Name);\n      }\n\n      // determine reverse reference member\n\n      foreach (var omm in this.OtherType.PersistentDataMembers) {\n\n         var oattr = (AssociationAttribute)Attribute.GetCustomAttribute(omm.Member, typeof(AssociationAttribute));\n\n         if (oattr is null\n            || omm == this.ThisMember) {\n\n            continue;\n         }\n\n         if (attr.Name is not null\n            && oattr.Name == attr.Name) {\n\n            this.OtherMember = omm;\n            break;\n         }\n\n         var otherMemberIsMany = TypeSystem.IsSequenceType(omm.Type);\n         var otherMemberType = (otherMemberIsMany) ?\n            TypeSystem.GetElementType(omm.Type)\n            : omm.Type;\n\n         if (member.DeclaringType.Type == otherMemberType) {\n            this.OtherMember = omm;\n            break;\n         }\n      }\n   }\n}\n\nabstract class MetaAssociationImpl : MetaAssociation {\n\n   /// <summary>\n   /// Given a MetaType and a set of key fields, return the set of MetaDataMembers\n   /// corresponding to the key.\n   /// </summary>\n\n   protected static ReadOnlyCollection<MetaDataMember>\n   MakeKeys(MetaType mtype, string keyFields) {\n\n      var names = keyFields.Split(',');\n      var members = new MetaDataMember[names.Length];\n\n      for (int i = 0; i < names.Length; i++) {\n\n         names[i] = names[i].Trim();\n\n         var rmis = mtype.Type.GetMember(names[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);\n\n         if (rmis is null || rmis.Length != 1) {\n            throw Error.BadKeyMember(names[i], keyFields, mtype.Name);\n         }\n\n         members[i] = mtype.GetDataMember(rmis[0]);\n\n         if (members[i] is null) {\n            throw Error.BadKeyMember(names[i], keyFields, mtype.Name);\n         }\n      }\n\n      return new List<MetaDataMember>(members).AsReadOnly();\n   }\n\n   /// <summary>\n   /// Compare two sets of keys for equality.\n   /// </summary>\n\n   protected static bool\n   AreEqual(IEnumerable<MetaDataMember> key1, IEnumerable<MetaDataMember> key2) {\n\n      using (var e1 = key1.GetEnumerator()) {\n         using (var e2 = key2.GetEnumerator()) {\n\n            bool m1, m2;\n\n            for (m1 = e1.MoveNext(), m2 = e2.MoveNext(); m1 && m2; m1 = e1.MoveNext(), m2 = e2.MoveNext()) {\n               if (e1.Current != e2.Current) {\n                  return false;\n               }\n            }\n\n            if (m1 != m2) {\n               return false;\n            }\n         }\n      }\n\n      return true;\n   }\n\n   public override string\n   ToString() =>\n      $\"{this.ThisMember.DeclaringType.Name} ->{(this.IsMany ? \"*\" : null)} {this.OtherType.Name}\";\n}\n\nsealed class UnmappedType : MetaType {\n\n   readonly static ReadOnlyCollection<MetaType>\n   _emptyTypes = new List<MetaType>().AsReadOnly();\n\n   readonly static ReadOnlyCollection<MetaDataMember>\n   _emptyDataMembers = new List<MetaDataMember>().AsReadOnly();\n\n   readonly static ReadOnlyCollection<MetaAssociation>\n   _emptyAssociations = new List<MetaAssociation>().AsReadOnly();\n\n   Dictionary<object, MetaDataMember>\n   _dataMemberMap;\n\n   ReadOnlyCollection<MetaDataMember>\n   _dataMembers;\n\n   ReadOnlyCollection<MetaType>\n   _inheritanceTypes;\n\n   readonly object\n   _locktarget = new(); // Hold locks on private object rather than public MetaType.\n\n   public override MetaModel\n   Model { get; }\n\n   public override Type\n   Type { get; }\n\n   public override MetaTable\n   Table => null;\n\n   public override string\n   Name => Type.Name;\n\n   public override bool\n   IsEntity => false;\n\n   public override bool\n   CanInstantiate => !Type.IsAbstract;\n\n   public override MetaDataMember\n   DBGeneratedIdentityMember => null;\n\n   public override MetaDataMember\n   VersionMember => null;\n\n   internal override MetaDataMember\n   Discriminator => null;\n\n   public override bool\n   HasUpdateCheck => false;\n\n   public override ReadOnlyCollection<MetaDataMember>\n   DataMembers {\n      get {\n         InitDataMembers();\n         return _dataMembers;\n      }\n   }\n\n   public override ReadOnlyCollection<MetaDataMember>\n   PersistentDataMembers => _emptyDataMembers;\n\n   public override ReadOnlyCollection<MetaDataMember>\n   IdentityMembers {\n      get {\n         InitDataMembers();\n         return _dataMembers;\n      }\n   }\n\n   public override ReadOnlyCollection<MetaAssociation>\n   Associations => _emptyAssociations;\n\n   internal override ReadOnlyCollection<MetaType>\n   InheritanceTypes {\n      get {\n\n         if (_inheritanceTypes is null) {\n            lock (_locktarget) {\n               _inheritanceTypes ??= new List<MetaType>(1) { this }.AsReadOnly();\n            }\n         }\n\n         return _inheritanceTypes;\n      }\n   }\n\n   internal override ReadOnlyCollection<MetaType>\n   DerivedTypes => _emptyTypes;\n\n   internal override bool\n   HasInheritance => false;\n\n   internal override bool\n   HasInheritanceCode => false;\n\n   internal override object\n   InheritanceCode => null;\n\n   internal override MetaType\n   InheritanceRoot => this;\n\n   internal override MetaType\n   InheritanceBase => null;\n\n   internal override MetaType\n   InheritanceDefault => null;\n\n   internal override bool\n   IsInheritanceDefault => false;\n\n   internal\n   UnmappedType(MetaModel model, Type type) {\n\n      this.Model = model;\n      this.Type = type;\n   }\n\n   internal override MetaType\n   GetInheritanceType(Type inheritanceType) {\n\n      if (inheritanceType == this.Type) {\n         return this;\n      }\n\n      return null;\n   }\n\n   internal override MetaType\n   GetTypeForInheritanceCode(object key) =>\n      null;\n\n   public override MetaDataMember\n   GetDataMember(MemberInfo mi) {\n\n      ArgumentNullException.ThrowIfNull(mi);\n\n      InitDataMembers();\n\n      if (_dataMemberMap is null) {\n         lock (_locktarget) {\n            if (_dataMemberMap is null) {\n\n               var map = new Dictionary<object, MetaDataMember>();\n\n               foreach (var mm in _dataMembers) {\n                  map.Add(InheritanceRules.DistinguishedMemberName(mm.Member), mm);\n               }\n\n               _dataMemberMap = map;\n            }\n         }\n      }\n\n      var dn = InheritanceRules.DistinguishedMemberName(mi);\n\n      _dataMemberMap.TryGetValue(dn, out var mdm);\n\n      return mdm;\n   }\n\n   void\n   InitDataMembers() {\n\n      if (_dataMembers is null) {\n         lock (_locktarget) {\n            if (_dataMembers is null) {\n\n               var dMembers = new List<MetaDataMember>();\n               var ordinal = 0;\n\n               var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;\n\n               foreach (var fi in this.Type.GetFields(flags)) {\n                  var mm = new UnmappedDataMember(this, fi, ordinal);\n                  dMembers.Add(mm);\n                  ordinal++;\n               }\n\n               foreach (var pi in this.Type.GetProperties(flags)) {\n                  var mm = new UnmappedDataMember(this, pi, ordinal);\n                  dMembers.Add(mm);\n                  ordinal++;\n               }\n\n               _dataMembers = dMembers.AsReadOnly();\n            }\n         }\n      }\n   }\n\n   public override string\n   ToString() => this.Name;\n}\n\nsealed class UnmappedDataMember : MetaDataMember {\n\n   MetaAccessor\n   _accPublic;\n\n   readonly object\n   _lockTarget = new();\n\n   public override MetaType\n   DeclaringType { get; }\n\n   public override MemberInfo\n   Member { get; }\n\n   public override int\n   Ordinal { get; }\n\n   public override Type\n   Type { get; }\n\n   public override Type\n   ConvertToType { get; }\n\n   public override MemberInfo\n   StorageMember => Member;\n\n   public override string Name =>\n   Member.Name;\n\n   public override MetaAccessor\n   MemberAccessor {\n      get {\n         InitAccessors();\n         return _accPublic;\n      }\n   }\n\n   public override MetaAccessor\n   StorageAccessor {\n      get {\n         InitAccessors();\n         return _accPublic;\n      }\n   }\n\n   public override bool\n   IsPersistent => false;\n\n   public override bool\n   IsAssociation => false;\n\n   public override bool\n   IsPrimaryKey => false;\n\n   public override bool\n   IsDbGenerated => false;\n\n   public override bool\n   IsVersion => false;\n\n   internal override bool\n   IsDiscriminator => false;\n\n   public override bool\n   CanBeNull => !Type.IsValueType || TypeSystem.IsNullableType(Type);\n\n   public override string\n   DbType => null;\n\n   public override string\n   Expression => null;\n\n   public override string\n   MappedName => Member.Name;\n\n   public override UpdateCheck\n   UpdateCheck => UpdateCheck.Never;\n\n   public override AutoSync\n   AutoSync => AutoSync.Never;\n\n   public override MetaAssociation\n   Association => null;\n\n   internal\n   UnmappedDataMember(MetaType declaringType, MemberInfo mi, int ordinal) {\n\n      this.DeclaringType = declaringType;\n      this.Member = mi;\n      this.Ordinal = ordinal;\n      this.Type = TypeSystem.GetMemberType(mi);\n   }\n\n   void\n   InitAccessors() {\n\n      if (_accPublic is null) {\n         lock (_lockTarget) {\n            _accPublic ??= MakeMemberAccessor(this.Member.ReflectedType, this.Member);\n         }\n      }\n   }\n\n   public override bool\n   IsDeclaredBy(MetaType metaType) {\n\n      ArgumentNullException.ThrowIfNull(metaType);\n\n      return metaType.Type == this.Member.DeclaringType;\n   }\n\n   static MetaAccessor\n   MakeMemberAccessor(Type accessorType, MemberInfo mi) {\n\n      MetaAccessor acc;\n\n      if (mi is FieldInfo fi) {\n         acc = FieldAccessor.Create(accessorType, fi);\n      } else {\n         PropertyInfo pi = (PropertyInfo)mi;\n         acc = PropertyAccessor.Create(accessorType, pi, null);\n      }\n\n      return acc;\n   }\n}\n\nstatic class InheritanceBaseFinder {\n\n   internal static MetaType\n   FindBase(MetaType derivedType) {\n\n      if (derivedType.Type == typeof(object)) {\n         return null;\n      }\n\n      var clrType = derivedType.Type; // start\n      var rootClrType = derivedType.InheritanceRoot.Type; // end\n\n      MetaType metaType;\n\n      while (true) {\n\n         if (clrType == typeof(object)\n            || clrType == rootClrType) {\n\n            return null;\n         }\n\n         clrType = clrType.BaseType;\n         metaType = derivedType.InheritanceRoot.GetInheritanceType(clrType);\n\n         if (metaType is not null) {\n            return metaType;\n         }\n      }\n   }\n}\n\n/// <summary>\n/// This class defines the rules for inheritance behaviors. The rules:\n/// \n///  (1) The same field may not be mapped to different database columns.    \n///      The DistinguishedMemberName and AreSameMember methods describe what 'same' means between two MemberInfos.\n///  (2) Discriminators held in fixed-length fields in the database don't need\n///      to be manually padded in inheritance mapping [InheritanceMapping(Code='x')]. \n///  \n/// </summary>\n\nstatic class InheritanceRules {\n\n   /// <summary>\n   /// Creates a name that is the same when the member should be considered 'same'\n   /// for the purposes of the inheritance feature.\n   /// </summary>\n\n   internal static object\n   DistinguishedMemberName(MemberInfo mi) {\n\n      var pi = mi as PropertyInfo;\n      var fi = mi as FieldInfo;\n\n      if (fi is not null) {\n\n         // Human readable variant:\n         // return \"fi:\" + mi.Name + \":\" + mi.DeclaringType;\n         return new MetaPosition(mi);\n\n      } else if (pi is not null) {\n\n         var meth = default(MethodInfo);\n\n         if (pi.CanRead) {\n            meth = pi.GetGetMethod();\n         }\n\n         if (meth is null && pi.CanWrite) {\n            meth = pi.GetSetMethod();\n         }\n\n         var isVirtual = meth is not null && meth.IsVirtual;\n\n         // Human readable variant:\n         // return \"pi:\" + mi.Name + \":\" + (isVirtual ? \"virtual\" : mi.DeclaringType.ToString());\n\n         if (isVirtual) {\n            return mi.Name;\n         } else {\n            return new MetaPosition(mi);\n         }\n\n      } else {\n         throw Error.ArgumentOutOfRange(nameof(mi));\n      }\n   }\n\n   /// <summary>\n   /// Compares two MemberInfos for 'same-ness'.\n   /// </summary>\n\n   internal static bool\n   AreSameMember(MemberInfo mi1, MemberInfo mi2) =>\n      DistinguishedMemberName(mi1).Equals(DistinguishedMemberName(mi2));\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/Error.cs",
    "content": "// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\n\nnamespace DbExtensions.Metadata;\n\nstatic class Error {\n\n   internal static Exception\n   ArgumentOutOfRange(string paramName) {\n      return new ArgumentOutOfRangeException(paramName);\n   }\n\n   internal static Exception\n   InvalidFieldInfo(object p0, object p1, object p2) {\n      return new ArgumentException($\"Could not create FieldAccessor&lt;{p0},{p1}&gt; from FieldInfo '{p2}'.\");\n   }\n\n   internal static Exception\n   CouldNotCreateAccessorToProperty(object p0, object p1, object p2) {\n      return new ArgumentException($\"Could not create PropertyAccessor&lt;{p0},{p1}&gt; to {p2}.\");\n   }\n\n   internal static Exception\n   UnableToAssignValueToReadonlyProperty(object p0) {\n      return new InvalidOperationException($\"Unable to assign value to read only property '{p0}'.\");\n   }\n\n   internal static Exception\n   NoDiscriminatorFound(object p0) {\n      return new InvalidOperationException($\"The inheritance type '{p0}' does not declare a discriminator column.\");\n   }\n\n   internal static Exception\n   InheritanceTypeDoesNotDeriveFromRoot(object p0, object p1) {\n      return new InvalidOperationException($\"Inheritance type '{p0}' does not derive from inheritance root type '{p1}'.\");\n   }\n\n   internal static Exception\n   AbstractClassAssignInheritanceDiscriminator(object p0) {\n      return new InvalidOperationException($\"Abstract class '{p0}' should not be assigned an inheritance discriminator key.\");\n   }\n\n   internal static Exception\n   CannotGetInheritanceDefaultFromNonInheritanceClass() {\n      return new InvalidOperationException(\"Mapping Problem: Cannot get inheritance default from class not mapped into an inheritance hierarchy.\");\n   }\n\n   internal static Exception\n   InheritanceCodeMayNotBeNull() {\n      return new InvalidOperationException(\"Inheritance code value may not be null.\");\n   }\n\n   internal static Exception\n   InheritanceTypeHasMultipleDiscriminators(object p0) {\n      return new InvalidOperationException($\"The inherited type '{p0}' cannot have multiple discriminator key values.\");\n   }\n\n   internal static Exception\n   InheritanceCodeUsedForMultipleTypes(object p0) {\n      return new InvalidOperationException($\"The inheritance code '{p0}' is used for multiple types.\");\n   }\n\n   internal static Exception\n   InheritanceTypeHasMultipleDefaults(object p0) {\n      return new InvalidOperationException($\"The inheritance type '{p0}' has multiple defaults.\");\n   }\n\n   internal static Exception\n   InheritanceHierarchyDoesNotDefineDefault(object p0) {\n      return new InvalidOperationException($\"The inheritance hierarchy rooted at '{p0}' does not define a default.\");\n   }\n\n   internal static Exception\n   InheritanceSubTypeIsAlsoRoot(object p0) {\n      return new InvalidOperationException($\"The inheritance subtype '{p0}' is also declared as a root type.\");\n   }\n\n   internal static Exception\n   NonInheritanceClassHasDiscriminator(object p0) {\n      return new InvalidOperationException($\"The inheritance type '{p0}' has a discriminator but is not part of a mapped inheritance hierarchy.\");\n   }\n\n   internal static Exception\n   MemberMappedMoreThanOnce(object p0) {\n      return new InvalidOperationException($\"The member '{p0}' is mapped more than once.\");\n   }\n\n   internal static Exception\n   BadStorageProperty(object p0, object p1, object p2) {\n      return new InvalidOperationException($\"Bad Storage property: '{p0}' on member '{p1}.{p2}'.\");\n   }\n\n   internal static Exception\n   IncorrectAutoSyncSpecification(object p0) {\n      return new InvalidOperationException($\"Incorrect AutoSync specification for member '{p0}'.\");\n   }\n\n   internal static Exception\n   BadKeyMember(object p0, object p1, object p2) {\n      return new InvalidOperationException($\"Could not find key member '{p0}' of key '{p1}' on type '{p2}'. The key may be wrong or the field or property on '{p2}' has changed names.\");\n   }\n\n   internal static Exception\n   UnableToResolveRootForType(object p0) {\n      return new InvalidOperationException($\"Mapping Problem: Unable to resolve root for type '{p0}'.\");\n   }\n\n   internal static Exception\n   CouldNotFindTypeFromMapping(object p0) {\n      return new InvalidOperationException($\"Mapping Problem: Cannot find type '{p0}' from mapping.\");\n   }\n\n   internal static Exception\n   TwoMembersMarkedAsPrimaryKeyAndDBGenerated(object p0, object p1) {\n      return new InvalidOperationException($\"Members '{p0}' and '{p1}' both marked as IsPrimaryKey and IsDbGenerated.\");\n   }\n\n   internal static Exception\n   TwoMembersMarkedAsRowVersion(object p0, object p1) {\n      return new InvalidOperationException($\"Members '{p0}' and '{p1}' both marked as row version.\");\n   }\n\n   internal static Exception\n   TwoMembersMarkedAsInheritanceDiscriminator(object p0, object p1) {\n      return new InvalidOperationException($\"Members '{p0}' and '{p1}' both marked as inheritance discriminator.\");\n   }\n\n   internal static Exception\n   CouldNotFindRuntimeTypeForMapping(object p0) {\n      return new InvalidOperationException($\"Mapping Problem: Cannot find runtime type for type mapping '{p0}'.\");\n   }\n\n   internal static Exception\n   UnexpectedNull(object p0) {\n      return new InvalidOperationException($\"Unexpected null '{p0}'.\");\n   }\n\n   internal static Exception\n   InvalidDeleteOnNullSpecification(object p0) {\n      return new InvalidOperationException($\"Invalid DeleteOnNull specification for member '{p0}'. DeleteOnNull can only be true for singleton association members mapped to non-nullable foreign key columns.\");\n   }\n\n   internal static Exception\n   MappedMemberHadNoCorrespondingMemberInType(object p0, object p1) {\n      return new NotSupportedException($\"The column or association '{p0}' in the mapping had no corresponding member in type '{p1}'. Mapping members from above root type is not supported.\");\n   }\n\n   internal static Exception\n   DiscriminatorClrTypeNotSupported(object p0, object p1, object p2) {\n      return new NotSupportedException($\"Discriminator '{p0}.{p1}' may not be type '{p2}'.\");\n   }\n\n   internal static Exception\n   IdentityClrTypeNotSupported(object p0, object p1, object p2) {\n      return new NotSupportedException($\"Invalid type mapping for Identity member '{p0}.{p1}'. Type '{p2}' is not supported for identity members.\");\n   }\n\n   internal static Exception\n   PrimaryKeyInSubTypeNotSupported(object p0, object p1) {\n      return new NotSupportedException($\"The subtype '{p0}' cannot contain the primary key member '{p1}'.\");\n   }\n\n   internal static Exception\n   MismatchedThisKeyOtherKey(object p0, object p1) {\n      return new InvalidOperationException($\"The number of ThisKey columns is different from the number of OtherKey columns for the association property '{p0}' in the type '{p1}'.\");\n   }\n\n   internal static Exception\n   MappingOfInterfacesMemberIsNotSupported(object p0, object p1) {\n      return new NotSupportedException($\"The mapping of interface member {p0}.{p1} is not supported.\");\n   }\n\n   internal static Exception\n   UnmappedClassMember(object p0, object p1) {\n      return new InvalidOperationException($\"Class member {p0}.{p1} is unmapped.\");\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/MappingSource.cs",
    "content": "// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace DbExtensions.Metadata;\n\n/// <summary>\n/// Represents a source for mapping information.\n/// </summary>\n\nabstract class MappingSource {\n\n   MetaModel\n   _primaryModel;\n\n   ReaderWriterLock\n   _rwlock;\n\n   Dictionary<Type, MetaModel>\n   _secondaryModels;\n\n   /// <summary>\n   /// Gets the MetaModel representing a DataContext and all it's \n   /// accessible tables, functions and entities.\n   /// </summary>\n\n   public MetaModel\n   GetModel(Type dataContextType) {\n\n      ArgumentNullException.ThrowIfNull(dataContextType);\n\n      var model = default(MetaModel);\n\n      if (_primaryModel is null) {\n         model = CreateModel(dataContextType);\n         Interlocked.CompareExchange(ref _primaryModel, model, null);\n      }\n\n      // if the primary one matches, use it!\n\n      if (_primaryModel.ContextType == dataContextType) {\n         return _primaryModel;\n      }\n\n      // the rest of this only happens if you are using the mapping source for\n      // more than one context type\n\n      // build a map if one is not already defined\n\n      if (_secondaryModels is null) {\n         Interlocked.CompareExchange(ref _secondaryModels, new Dictionary<Type, MetaModel>(), null);\n      }\n\n      // if we haven't created a read/writer lock, make one now\n\n      if (_rwlock is null) {\n         Interlocked.CompareExchange(ref _rwlock, new ReaderWriterLock(), null);\n      }\n\n      // lock the map and look inside\n\n      MetaModel foundModel;\n      _rwlock.AcquireReaderLock(Timeout.Infinite);\n\n      try {\n         if (_secondaryModels.TryGetValue(dataContextType, out foundModel)) {\n            return foundModel;\n         }\n      } finally {\n         _rwlock.ReleaseReaderLock();\n      }\n\n      // if it wasn't found, lock for write and try again\n\n      _rwlock.AcquireWriterLock(Timeout.Infinite);\n\n      try {\n\n         if (_secondaryModels.TryGetValue(dataContextType, out foundModel)) {\n            return foundModel;\n         }\n\n         model ??= CreateModel(dataContextType);\n\n         _secondaryModels.Add(dataContextType, model);\n\n      } finally {\n         _rwlock.ReleaseWriterLock();\n      }\n\n      return model;\n   }\n\n   /// <summary>\n   /// Creates a new instance of a MetaModel.  This method is called by GetModel().\n   /// Override this method when defining a new type of MappingSource.\n   /// </summary>\n   /// <param name=\"dataContextType\"></param>\n   /// <returns></returns>\n\n   protected abstract MetaModel\n   CreateModel(Type dataContextType);\n}\n\n/// <summary>\n/// A mapping source that uses attributes on the context to create the mapping model.\n/// </summary>\n\nsealed class AttributeMappingSource : MappingSource {\n\n   protected override MetaModel\n   CreateModel(Type dataContextType) {\n\n      ArgumentNullException.ThrowIfNull(dataContextType);\n\n      return new AttributedMetaModel(this, dataContextType);\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/MappingSystem.cs",
    "content": "﻿// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\n\nnamespace DbExtensions.Metadata;\n\n/// <summary>\n/// Shared rules governing the mapping system.\n/// </summary>\n\nstatic class MappingSystem {\n\n   /// <summary>\n   /// Return true if this is a clr type supported as an inheritance discriminator.\n   /// </summary>\n   /// <param name=\"type\"></param>\n   /// <returns></returns>\n\n   internal static bool\n   IsSupportedDiscriminatorType(Type type) {\n\n      if (type.IsGenericType\n         && type.GetGenericTypeDefinition() == typeof(Nullable<>)) {\n\n         type = type.GetGenericArguments()[0];\n      }\n\n      switch (Type.GetTypeCode(type)) {\n         case TypeCode.Byte:\n         case TypeCode.SByte:\n         case TypeCode.Int16:\n         case TypeCode.Int32:\n         case TypeCode.Int64:\n         case TypeCode.UInt16:\n         case TypeCode.UInt32:\n         case TypeCode.UInt64:\n         case TypeCode.Char:\n         case TypeCode.String:\n         case TypeCode.Boolean:\n            return true;\n      }\n\n      return false;\n   }\n\n   /// <summary>\n   /// Return true if this is a CLR type supported as an identity member.  Since identity\n   /// management (caching) relies on key members being hashable, only types implementing\n   /// GetHashCode are supported.  Also, the runtime relies on identity members being comparable,\n   /// so only types implementing Equals are supported.\n   /// </summary>\n\n   internal static bool\n   IsSupportedIdentityType(Type type) {\n\n      if (type.IsGenericType\n         && type.GetGenericTypeDefinition() == typeof(Nullable<>)) {\n\n         type = type.GetGenericArguments()[0];\n      }\n\n      if (type == typeof(Guid)\n         || type == typeof(DateTime)\n         || type == typeof(DateTimeOffset)\n         || type == typeof(TimeSpan)) {\n\n         return true;\n      }\n\n      switch (Type.GetTypeCode(type)) {\n         case TypeCode.Byte:\n         case TypeCode.SByte:\n         case TypeCode.Int16:\n         case TypeCode.Int32:\n         case TypeCode.Int64:\n         case TypeCode.UInt16:\n         case TypeCode.UInt32:\n         case TypeCode.UInt64:\n         case TypeCode.Char:\n         case TypeCode.String:\n         case TypeCode.Boolean:\n         case TypeCode.Decimal:\n         case TypeCode.Single:\n         case TypeCode.Double:\n            return true;\n      }\n\n      return false;\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/MetaModel.cs",
    "content": "// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Globalization;\nusing System.Linq.Expressions;\nusing System.Reflection;\n\nnamespace DbExtensions.Metadata;\n\n/// <summary>\n/// A MetaModel is an abstraction representing the mapping between a database and domain objects\n/// </summary>\n\nabstract class MetaModel {\n\n   /// <summary>\n   ///  The mapping source that originated this model.\n   /// </summary>\n\n   internal abstract MappingSource\n   MappingSource { get; }\n\n   /// <summary>\n   /// The type of DataContext type this model describes.\n   /// </summary>\n\n   internal abstract Type\n   ContextType { get; }\n\n   /// <summary>\n   /// The name of the database.\n   /// </summary>\n\n   internal abstract string\n   DatabaseName { get; }\n\n   /// <summary>\n   /// Gets the MetaTable associated with a given type.\n   /// </summary>\n   /// <param name=\"rowType\">The CLR row type.</param>\n   /// <returns>The MetaTable if one exists, otherwise null.</returns>\n\n   public abstract MetaTable\n   GetTable(Type rowType, MetaTableConfiguration config);\n\n   /// <summary>\n   /// Get an enumeration of all tables.\n   /// </summary>\n   /// <returns>An enumeration of all the MetaTables</returns>\n\n   public abstract IEnumerable<MetaTable>\n   GetTables();\n\n   /// <summary>\n   /// This method discovers the MetaType for the given Type.\n   /// </summary>\n\n   public abstract MetaType\n   GetMetaType(Type type, MetaTableConfiguration config);\n}\n\n/// <summary>\n/// A MetaTable represents an abstraction of a database table (or view)\n/// </summary>\n\nabstract class MetaTable {\n\n   /// <summary>\n   /// The MetaModel containing this MetaTable.\n   /// </summary>\n\n   public abstract MetaModel\n   Model { get; }\n\n   /// <summary>\n   /// The name of the table as defined by the database.\n   /// </summary>\n\n   public abstract string\n   TableName { get; }\n\n   /// <summary>\n   /// The MetaType describing the type of the rows of the table.\n   /// </summary>\n\n   public abstract MetaType\n   RowType { get; }\n}\n\nsealed class MetaTableConfiguration {\n\n   public string\n   DefaultComplexPropertySeparator { get; internal set; }\n\n   public\n   MetaTableConfiguration() { }\n\n   internal\n   MetaTableConfiguration(MetaTableConfiguration other) {\n      this.DefaultComplexPropertySeparator = other.DefaultComplexPropertySeparator;\n   }\n}\n\n\n/// <summary>\n/// A MetaType represents the mapping of a domain object type onto a database table's columns.\n/// </summary>\n\nabstract class MetaType {\n\n   /// <summary>\n   /// The MetaModel containing this MetaType.\n   /// </summary>\n\n   public abstract MetaModel\n   Model { get; }\n\n   /// <summary>\n   /// The MetaTable using this MetaType for row definition.\n   /// </summary>\n\n   public abstract MetaTable\n   Table { get; }\n\n   /// <summary>\n   /// The underlying CLR type.\n   /// </summary>\n\n   public abstract Type\n   Type { get; }\n\n   /// <summary>\n   /// The name of the MetaType (same as the CLR type's name).\n   /// </summary>\n\n   public abstract string\n   Name { get; }\n\n   /// <summary>\n   /// True if the MetaType is an entity type.\n   /// </summary>\n\n   public abstract bool\n   IsEntity { get; }\n\n   /// <summary>\n   /// True if the underlying type can be instantiated as the result of a query.\n   /// </summary>\n\n   public abstract bool\n   CanInstantiate { get; }\n\n   /// <summary>\n   /// The member that represents the auto-generated identity column, or null if there is none.\n   /// </summary>\n\n   public abstract MetaDataMember\n   DBGeneratedIdentityMember { get; }\n\n   /// <summary>\n   /// The member that represents the row-version or timestamp column, or null if there is none.\n   /// </summary>\n\n   public abstract MetaDataMember\n   VersionMember { get; }\n\n   /// <summary>\n   /// The member that represents the inheritance discriminator column, or null if there is none.\n   /// </summary>\n\n   internal abstract MetaDataMember\n   Discriminator { get; }\n\n   /// <summary>\n   /// True if the type has any persistent member with an UpdateCheck policy other than Never.\n   /// </summary>\n\n   public abstract bool\n   HasUpdateCheck { get; }\n\n   /// <summary>\n   /// True if the type is part of a mapped inheritance hierarchy.\n   /// </summary>\n\n   internal abstract bool\n   HasInheritance { get; }\n\n   /// <summary>\n   /// True if this type defines an inheritance code.\n   /// </summary>\n\n   internal abstract bool\n   HasInheritanceCode { get; }\n\n   /// <summary>\n   /// The inheritance code defined by this type.\n   /// </summary>\n\n   internal abstract object\n   InheritanceCode { get; }\n\n   /// <summary>\n   /// True if this type is used as the default of an inheritance hierarchy.\n   /// </summary>\n\n   internal abstract bool\n   IsInheritanceDefault { get; }\n\n   /// <summary>\n   /// The root type of the inheritance hierarchy.\n   /// </summary>\n\n   internal abstract MetaType\n   InheritanceRoot { get; }\n\n   /// <summary>\n   /// The base metatype in the inheritance hierarchy.\n   /// </summary>\n\n   internal abstract MetaType\n   InheritanceBase { get; }\n\n   /// <summary>\n   /// The type that is the default of the inheritance hierarchy.\n   /// </summary>\n\n   internal abstract MetaType\n   InheritanceDefault { get; }\n\n   /// <summary>\n   /// Gets the MetaType for an inheritance sub type.\n   /// </summary>\n   /// <param name=\"type\">The root or sub type of the inheritance hierarchy.</param>\n   /// <returns>The MetaType.</returns>\n\n   internal abstract MetaType\n   GetInheritanceType(Type type);\n\n   /// <summary>\n   /// Gets type associated with the specified inheritance code.\n   /// </summary>\n   /// <param name=\"code\">The inheritance code</param>\n   /// <returns>The MetaType.</returns>\n\n   internal abstract MetaType\n   GetTypeForInheritanceCode(object code);\n\n   /// <summary>\n   /// Gets an enumeration of all types defined by an inheritance hierarchy.\n   /// </summary>\n   /// <returns>Enumeration of MetaTypes.</returns>\n\n   internal abstract ReadOnlyCollection<MetaType>\n   InheritanceTypes { get; }\n\n   /// <summary>\n   /// Gets an enumeration of the immediate derived types in an inheritance hierarchy.\n   /// </summary>\n   /// <returns>Enumeration of MetaTypes.</returns>\n\n   internal abstract ReadOnlyCollection<MetaType>\n   DerivedTypes { get; }\n\n   /// <summary>\n   /// Gets an enumeration of all the data members (fields and properties).\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaDataMember>\n   DataMembers { get; }\n\n   /// <summary>\n   /// Gets an enumeration of all the persistent data members (fields and properties mapped into database columns).\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaDataMember>\n   PersistentDataMembers { get; }\n\n   /// <summary>\n   /// Gets an enumeration of all the data members that define up the unique identity of the type.\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaDataMember>\n   IdentityMembers { get; }\n\n   /// <summary>\n   /// Gets an enumeration of all the associations.\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaAssociation>\n   Associations { get; }\n\n   /// <summary>\n   /// Gets the MetaDataMember associated with the specified member.\n   /// </summary>\n   /// <param name=\"member\">The CLR member.</param>\n   /// <returns>The MetaDataMember if there is one, otherwise null.</returns>\n\n   public abstract MetaDataMember\n   GetDataMember(MemberInfo member);\n}\n\n/// <summary>\n/// A MetaDataMember represents the mapping between a domain object's field or property into a database table's column.\n/// </summary>\n\nabstract class MetaDataMember {\n\n   /// <summary>\n   /// The MetaType containing this data member.\n   /// </summary>\n\n   public abstract MetaType\n   DeclaringType { get; }\n\n   /// <summary>\n   /// The underlying MemberInfo.\n   /// </summary>\n\n   public abstract MemberInfo\n   Member { get; }\n\n   /// <summary>\n   /// The member that actually stores this member's data.\n   /// </summary>\n\n   public abstract MemberInfo\n   StorageMember { get; }\n\n   /// <summary>\n   /// The name of the member, same as the MemberInfo name.\n   /// </summary>\n\n   public abstract string\n   Name { get; }\n\n   /// <summary>\n   /// The name of the column (or constraint) in the database.\n   /// </summary>\n\n   public abstract string\n   MappedName { get; }\n\n   public virtual string\n   QueryPath => Name;\n\n   /// <summary>\n   /// The oridinal position of this member in the default layout of query results.\n   /// </summary>\n\n   public abstract int\n   Ordinal { get; }\n\n   /// <summary>\n   /// The type of this member.\n   /// </summary>\n\n   public abstract Type\n   Type { get; }\n\n   public abstract Type\n   ConvertToType { get; }\n\n   /// <summary>\n   /// True if this member is declared by the specified type.\n   /// </summary>\n   /// <param name=\"type\">Type to check.</param>\n\n   public abstract bool\n   IsDeclaredBy(MetaType type);\n\n   /// <summary>\n   /// The accessor used to get/set the value of this member.\n   /// </summary>\n\n   public abstract MetaAccessor\n   MemberAccessor { get; }\n\n   /// <summary>\n   /// The accessor used to get/set the storage value of this member.\n   /// </summary>\n\n   public abstract MetaAccessor\n   StorageAccessor { get; }\n\n   /// <summary>\n   /// True if this member is mapped to a column (or constraint).\n   /// </summary>\n\n   public abstract bool\n   IsPersistent { get; }\n\n   /// <summary>\n   /// True if this member defines an association relationship.\n   /// </summary>\n\n   public abstract bool\n   IsAssociation { get; }\n\n   /// <summary>\n   /// True if this member is part of the type's identity.\n   /// </summary>\n\n   public abstract bool\n   IsPrimaryKey { get; }\n\n   /// <summary>\n   /// True if this member is automatically generated by the database.\n   /// </summary>\n\n   public abstract bool\n   IsDbGenerated { get; }\n\n   /// <summary>\n   /// True if this member represents the row version or timestamp.\n   /// </summary>\n\n   public abstract bool\n   IsVersion { get; }\n\n   /// <summary>\n   /// True if this member represents the inheritance discriminator.\n   /// </summary>\n\n   internal abstract bool\n   IsDiscriminator { get; }\n\n   /// <summary>\n   /// True if this member's value can be assigned the null value.\n   /// </summary>\n\n   public abstract bool\n   CanBeNull { get; }\n\n   /// <summary>\n   /// The type of the database column.\n   /// </summary>\n\n   public abstract string\n   DbType { get; }\n\n   /// <summary>\n   /// Expression defining a computed column.\n   /// </summary>\n\n   public abstract string\n   Expression { get; }\n\n   /// <summary>\n   /// The optimistic concurrency check policy for this member.\n   /// </summary>\n\n   public abstract UpdateCheck\n   UpdateCheck { get; }\n\n   /// <summary>\n   /// Specifies for inserts and updates when this member should be read back after the\n   /// operation completes.\n   /// </summary>\n\n   public abstract AutoSync\n   AutoSync { get; }\n\n   /// <summary>\n   /// The MetaAssociation corresponding to this member, or null if there is none.\n   /// </summary>\n\n   public abstract MetaAssociation\n   Association { get; }\n\n   public virtual object\n   GetValueForDatabase(object instance) {\n\n      var value = this.MemberAccessor.GetBoxedValue(instance);\n\n      return ConvertValueForDatabase(value);\n   }\n\n   public object\n   ConvertValueForDatabase(object value) {\n\n      if (value is null\n         || this.ConvertToType is null) {\n\n         return value;\n      }\n\n      return Convert.ChangeType(value, this.ConvertToType, CultureInfo.InvariantCulture);\n   }\n}\n\n/// <summary>\n/// A MetaAssociation represents an association relationship between two entity types.\n/// </summary>\n\nabstract class MetaAssociation {\n\n   /// <summary>\n   /// The type on the other end of the association.\n   /// </summary>\n\n   public abstract MetaType\n   OtherType { get; }\n\n   /// <summary>\n   /// The member on this side that represents the association.\n   /// </summary>\n\n   public abstract MetaDataMember\n   ThisMember { get; }\n\n   /// <summary>\n   /// The member on the other side of this association that represents the reverse association (may be null).\n   /// </summary>\n\n   public abstract MetaDataMember\n   OtherMember { get; }\n\n   /// <summary>\n   /// A list of members representing the values on this side of the association.\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaDataMember>\n   ThisKey { get; }\n\n   /// <summary>\n   /// A list of members representing the values on the other side of the association.\n   /// </summary>\n\n   public abstract ReadOnlyCollection<MetaDataMember>\n   OtherKey { get; }\n\n   /// <summary>\n   /// True if the association is OneToMany.\n   /// </summary>\n\n   public abstract bool\n   IsMany { get; }\n\n   /// <summary>\n   /// True if the other type is the parent of this type.\n   /// </summary>\n\n   public abstract bool\n   IsForeignKey { get; }\n\n   /// <summary>\n   /// True if the association is unique (defines a uniqueness constraint).\n   /// </summary>\n\n   public abstract bool\n   IsUnique { get; }\n\n   /// <summary>\n   /// True if the association may be null (key values).\n   /// </summary>\n\n   public abstract bool\n   IsNullable { get; }\n\n   /// <summary>\n   /// True if the ThisKey forms the identity (primary key) of the this type.\n   /// </summary>\n\n   public abstract bool\n   ThisKeyIsPrimaryKey { get; }\n\n   /// <summary>\n   /// True if the OtherKey forms the identity (primary key) of the other type.\n   /// </summary>\n\n   public abstract bool\n   OtherKeyIsPrimaryKey { get; }\n\n   /// <summary>\n   /// Specifies the behavior when the child is deleted (e.g. CASCADE, SET NULL).\n   /// Returns null if no action is specified on delete.\n   /// </summary>\n\n   public abstract string\n   DeleteRule { get; }\n\n   /// <summary>\n   /// Specifies whether the object should be deleted when this association\n   /// is set to null.\n   /// </summary>\n\n   public abstract bool\n   DeleteOnNull { get; }\n\n   public void\n   LoadCollection(object container, IEnumerable elements) {\n\n      var accessor = (MetaCollectionAccessor)this.ThisMember.MemberAccessor;\n      var collection = accessor.GetOrCreateBoxed(container);\n\n      var setOtherMember = this.OtherMember is { Association.IsMany: false };\n\n      foreach (var element in elements) {\n\n         if (setOtherMember) {\n            var elementObj = element;\n            this.OtherMember.MemberAccessor.SetBoxedValue(ref elementObj, container);\n         }\n\n         accessor.AddBoxedElement(ref collection, element);\n      }\n   }\n}\n\n/// <summary>\n/// A MetaAccessor\n/// </summary>\n\nabstract class MetaAccessor {\n\n   /// <summary>\n   /// The type of the member accessed by this accessor.\n   /// </summary>\n\n   public abstract Type\n   Type { get; }\n\n   /// <summary>\n   /// Gets the value as an object.\n   /// </summary>\n   /// <param name=\"instance\">The instance to get the value from.</param>\n   /// <returns>Value.</returns>\n\n   public abstract object\n   GetBoxedValue(object instance);\n\n   /// <summary>\n   /// Sets the value as an object.\n   /// </summary>\n   /// <param name=\"instance\">The instance to set the value into.</param>\n   /// <param name=\"value\">The value to set.</param>\n\n   public abstract void\n   SetBoxedValue(ref object instance, object value);\n\n   /// <summary>\n   /// True if the instance has a loaded or assigned value.\n   /// </summary>\n\n   internal virtual bool\n   HasValue(object instance) => true;\n\n   /// <summary>\n   /// True if the instance has an assigned value.\n   /// </summary>\n\n   internal virtual bool\n   HasAssignedValue(object instance) => true;\n\n   /// <summary>\n   /// True if the instance has a value loaded from a deferred source.\n   /// </summary>\n\n   internal virtual bool\n   HasLoadedValue(object instance) => false;\n}\n\n/// <summary>\n/// A strongly-typed MetaAccessor. Used for reading from and writing to\n/// CLR objects.\n/// </summary>\n/// <typeparam name=\"TEntity\">The type of the object</typeparam>\n/// <typeparam name=\"TMember\">The type of the accessed member</typeparam>\n\nabstract class MetaAccessor<TEntity, TMember> : MetaAccessor {\n\n   /// <summary>\n   /// The underlying CLR type.\n   /// </summary>\n\n   public override Type\n   Type => typeof(TMember);\n\n   /// <summary>\n   /// Set the boxed value on an instance.\n   /// </summary>\n\n   public override void\n   SetBoxedValue(ref object instance, object value) {\n\n      var tInst = (TEntity)instance;\n      SetValue(ref tInst, (TMember)value);\n      instance = tInst;\n   }\n\n   /// <summary>\n   /// Retrieve the boxed value.\n   /// </summary>\n\n   public override object\n   GetBoxedValue(object instance) =>\n      GetValue((TEntity)instance);\n\n   /// <summary>\n   /// Gets the strongly-typed value.\n   /// </summary>\n\n   public abstract TMember\n   GetValue(TEntity instance);\n\n   /// <summary>\n   /// Sets the strongly-typed value\n   /// </summary>\n\n   public abstract void\n   SetValue(ref TEntity instance, TMember value);\n}\n\nabstract class MetaCollectionAccessor : MetaAccessor {\n\n   public abstract Type\n   ElementType { get; }\n\n   public abstract void\n   AddBoxedElement(ref object collection, object element);\n\n   public abstract object\n   GetOrCreateBoxed(object instance);\n}\n\nsealed class MetaCollectionAccessor<TContainer, TCollection, TElement> : MetaCollectionAccessor {\n\n   readonly MetaAccessor<TContainer, TCollection>\n   _propAccessor;\n\n   readonly Action<TCollection, TElement>\n   _addFn;\n\n   readonly Func<TCollection>\n   _factory;\n\n   public override Type\n   Type => _propAccessor.Type;\n\n   public override Type\n   ElementType => typeof(TElement);\n\n   internal\n   MetaCollectionAccessor(\n         MetaAccessor<TContainer, TCollection> propAccessor,\n         Action<TCollection, TElement> addFn) {\n\n      _propAccessor = propAccessor;\n      _addFn = addFn;\n      _factory = CreateFactory();\n   }\n\n   static Func<TCollection>\n   CreateFactory() {\n\n      var newExpr = Expression.New(typeof(TCollection));\n      var lambdaExpr = Expression.Lambda<Func<TCollection>>(newExpr);\n\n      return lambdaExpr.Compile();\n   }\n\n   public override object\n   GetOrCreateBoxed(object instance) {\n\n      var container = (TContainer)instance;\n      var collection = GetValue(container);\n\n      if (collection is null) {\n         collection = _factory.Invoke();\n         SetValue(ref container, collection);\n      }\n\n      return collection;\n   }\n\n   public TCollection\n   GetValue(TContainer instance) =>\n      _propAccessor.GetValue(instance);\n\n   public void\n   SetValue(ref TContainer instance, TCollection value) =>\n      _propAccessor.SetValue(ref instance, value);\n\n   public void\n   AddElement(ref TCollection collection, TElement element) =>\n      _addFn.Invoke(collection, element);\n\n   public override void\n   SetBoxedValue(ref object instance, object value) =>\n      _propAccessor.SetBoxedValue(ref instance, value);\n\n   public override object\n   GetBoxedValue(object instance) =>\n      _propAccessor.GetBoxedValue(instance);\n\n   public override void\n   AddBoxedElement(ref object collection, object element) {\n\n      var TCol = (TCollection)collection;\n      AddElement(ref TCol, (TElement)element);\n      collection = TCol!;\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Metadata/TypeSystem.cs",
    "content": "// Copyright 2016-2022 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#region Based on code from .NET Framework\n#endregion\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Reflection;\n\nnamespace DbExtensions.Metadata;\n\nstatic class TypeSystem {\n\n   internal static bool\n   IsSequenceType(Type seqType) {\n\n      return seqType != typeof(string)\n         && seqType != typeof(byte[])\n         && seqType != typeof(char[])\n         && FindIEnumerable(seqType) is not null;\n   }\n\n   static Type\n   FindIEnumerable(Type seqType) {\n\n      if (seqType is null || seqType == typeof(string)) {\n         return null;\n      }\n\n      if (seqType.IsArray) {\n         return typeof(IEnumerable<>).MakeGenericType(seqType.GetElementType());\n      }\n\n      if (seqType.IsGenericType) {\n\n         foreach (var arg in seqType.GetGenericArguments()) {\n\n            var ienum = typeof(IEnumerable<>).MakeGenericType(arg);\n\n            if (ienum.IsAssignableFrom(seqType)) {\n               return ienum;\n            }\n         }\n      }\n\n      var ifaces = seqType.GetInterfaces();\n\n      if (ifaces is not null && ifaces.Length > 0) {\n\n         foreach (var iface in ifaces) {\n\n            var ienum = FindIEnumerable(iface);\n\n            if (ienum is not null) {\n               return ienum;\n            }\n         }\n      }\n\n      if (seqType.BaseType is not null\n         && seqType.BaseType != typeof(object)) {\n\n         return FindIEnumerable(seqType.BaseType);\n      }\n\n      return null;\n   }\n\n   internal static Type\n   GetElementType(Type seqType) {\n\n      var ienum = FindIEnumerable(seqType);\n\n      if (ienum is null) {\n         return seqType;\n      }\n\n      return ienum.GetGenericArguments()[0];\n   }\n\n   internal static bool\n   IsNullableType(Type type) {\n\n      return type is not null\n         && type.IsGenericType\n         && type.GetGenericTypeDefinition() == typeof(Nullable<>);\n   }\n\n   internal static Type\n   GetMemberType(MemberInfo mi) {\n\n      if (mi is FieldInfo fi) {\n         return fi.FieldType;\n      }\n\n      if (mi is PropertyInfo pi) {\n         return pi.PropertyType;\n      }\n\n      if (mi is EventInfo ei) {\n         return ei.EventHandlerType;\n      }\n\n      return null;\n   }\n\n   internal static IEnumerable<FieldInfo>\n   GetAllFields(Type type, BindingFlags flags) {\n\n      var seen = new Dictionary<MetaPosition, FieldInfo>();\n\n      var currentType = type;\n\n      do {\n\n         foreach (var fi in currentType.GetFields(flags)) {\n            if (fi.IsPrivate || type == currentType) {\n               var mp = new MetaPosition(fi);\n               seen[mp] = fi;\n            }\n         }\n\n         currentType = currentType.BaseType;\n\n      } while (currentType is not null);\n\n      return seen.Values;\n   }\n\n   internal static IEnumerable<PropertyInfo>\n   GetAllProperties(Type type, BindingFlags flags) {\n\n      var seen = new Dictionary<MetaPosition, PropertyInfo>();\n      var currentType = type;\n\n      do {\n\n         foreach (var pi in currentType.GetProperties(flags)) {\n            if (type == currentType || IsPrivate(pi)) {\n               var mp = new MetaPosition(pi);\n               seen[mp] = pi;\n            }\n         }\n\n         currentType = currentType.BaseType;\n\n      } while (currentType is not null);\n\n      return seen.Values;\n   }\n\n   static bool\n   IsPrivate(PropertyInfo pi) {\n\n      var mi = pi.GetGetMethod() ?? pi.GetSetMethod();\n\n      if (mi is not null) {\n         return mi.IsPrivate;\n      }\n\n      return true;\n   }\n}\n\n/// <summary>\n/// Hashable MetaDataToken+Assembly. This type uniquely describes a metadata element\n/// like a MemberInfo. MetaDataToken by itself is not sufficient because its only\n/// unique within a single assembly.\n/// </summary>\n\nstruct MetaPosition : IEqualityComparer<MetaPosition>, IEqualityComparer {\n\n   readonly int\n   _metadataToken;\n\n   readonly Assembly\n   _assembly;\n\n   internal\n   MetaPosition(MemberInfo mi)\n      : this(mi.DeclaringType.Assembly, mi.MetadataToken) { }\n\n   private\n   MetaPosition(Assembly assembly, int metadataToken) {\n      _assembly = assembly;\n      _metadataToken = metadataToken;\n   }\n\n   // Equality is implemented here according to the advice in\n   // CLR via C# 2ed, J. Richter, p 146. In particular, ValueType.Equals\n   // should not be called for perf reasons.\n\n   public override bool\n   Equals(object obj) {\n\n      if (obj is null) {\n         return false;\n      }\n\n      if (obj.GetType() != GetType()) {\n         return false;\n      }\n\n      return AreEqual(this, (MetaPosition)obj);\n   }\n\n   public override int\n   GetHashCode() => _metadataToken;\n\n   public bool\n   Equals(MetaPosition x, MetaPosition y) =>\n      AreEqual(x, y);\n\n   public int\n   GetHashCode(MetaPosition obj) =>\n      obj._metadataToken;\n\n   bool\n   IEqualityComparer.Equals(object x, object y) =>\n      Equals((MetaPosition)x, (MetaPosition)y);\n\n   int\n   IEqualityComparer.GetHashCode(object obj) =>\n      GetHashCode((MetaPosition)obj);\n\n   static bool\n   AreEqual(MetaPosition x, MetaPosition y) {\n\n      return (x._metadataToken == y._metadataToken)\n         && (x._assembly == y._assembly);\n   }\n\n   // Since MetaPositions are immutable, we overload the equality operator\n   // to test for value equality, rather than reference equality\n\n   public static bool operator\n   ==(MetaPosition x, MetaPosition y) =>\n      AreEqual(x, y);\n\n   public static bool operator\n   !=(MetaPosition x, MetaPosition y) =>\n      !AreEqual(x, y);\n}\n"
  },
  {
    "path": "src/DbExtensions/PocoMapper.cs",
    "content": "﻿// Copyright 2010-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data.Common;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace DbExtensions;\n\n#nullable enable\n\npartial class Database {\n\n   /// <summary>\n   /// Maps the results of the <paramref name=\"query\"/> to <typeparamref name=\"TResult\"/> objects.\n   /// The query is deferred-executed.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type of objects to map the results to.</typeparam>\n   /// <param name=\"query\">The query.</param>\n   /// <returns>The results of the query as <typeparamref name=\"TResult\"/> objects.</returns>\n\n   public IEnumerable<TResult>\n   Map<TResult>(SqlBuilder query) {\n\n      ArgumentNullException.ThrowIfNull(query);\n\n      var mapper = CreatePocoMapper(typeof(TResult));\n\n      return Map(query, r => (TResult)mapper.PocoMap(r));\n   }\n\n   /// <inheritdoc cref=\"Map&lt;TResult>(SqlBuilder)\"/>\n\n   public IAsyncEnumerable<TResult>\n   AsyncMap<TResult>(SqlBuilder query) {\n\n      ArgumentNullException.ThrowIfNull(query);\n\n      var mapper = CreatePocoMapper(typeof(TResult));\n\n      return AsyncMap(query, r => (TResult)mapper.PocoMap(r));\n   }\n\n   /// <summary>\n   /// Maps the results of the <paramref name=\"query\"/> to objects of type\n   /// specified by the <paramref name=\"resultType\"/> parameter.\n   /// The query is deferred-executed.\n   /// </summary>\n   /// <param name=\"query\">The query.</param>\n   /// <param name=\"resultType\">The type of objects to map the results to.</param>\n   /// <returns>The results of the query as objects of type specified by the <paramref name=\"resultType\"/> parameter.</returns>\n\n   public IEnumerable<object>\n   Map(SqlBuilder query, Type resultType) {\n\n      ArgumentNullException.ThrowIfNull(query);\n      ArgumentNullException.ThrowIfNull(resultType);\n\n      var mapper = CreatePocoMapper(resultType);\n\n      return Map(query, mapper.PocoMap);\n   }\n\n   /// <inheritdoc cref=\"Map(SqlBuilder, Type)\"/>\n\n   public IAsyncEnumerable<object>\n   AsyncMap(SqlBuilder query, Type resultType) {\n\n      ArgumentNullException.ThrowIfNull(query);\n      ArgumentNullException.ThrowIfNull(resultType);\n\n      var mapper = CreatePocoMapper(resultType);\n\n      return AsyncMap(query, mapper.PocoMap);\n   }\n\n   internal PocoMapper\n   CreatePocoMapper(Type type) {\n\n      return new PocoMapper(type) {\n         Log = this.Configuration.Log,\n      };\n   }\n}\n\npartial class SqlSet {\n\n   Dictionary<string[], Action<object>>?\n   _manyIncludes;\n\n   partial void\n   Initialize2(SqlSet set) {\n\n      if (set._manyIncludes is { } incl) {\n         _manyIncludes = new(incl);\n      }\n\n      Initialize3(set);\n   }\n\n   partial void\n   Initialize3(SqlSet set);\n\n   private protected void\n   AddManyInclude(string[] path, Action<object> loader) {\n      _manyIncludes ??= new();\n      _manyIncludes.Add(path, loader);\n   }\n\n   partial void\n   PocoMap(bool singleResult, SqlBuilder query, ref IEnumerable<object>? results) {\n\n      var mapper = CreatePocoMapper(singleResult);\n\n      results = _db.Map(query, mapper.PocoMap);\n   }\n\n   partial void\n   PocoAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<object>? results) {\n\n      var mapper = CreatePocoMapper(singleResult);\n\n      results = _db.AsyncMap(query, mapper.PocoMap);\n   }\n\n   private protected PocoMapper\n   CreatePocoMapper(bool singleResult) {\n\n      Debug.Assert(_resultType is not null);\n\n      var mapper = _db.CreatePocoMapper(_resultType);\n      mapper.SingleResult = singleResult;\n      mapper.ManyIncludes = _manyIncludes;\n\n      return mapper;\n   }\n}\n\npartial class SqlSet<TResult> {\n\n   /// <summary>This method is used by auto-generated Include methods.</summary>\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public SqlSet<TResult>\n   WithManyInclude(string[] path, Action<object> loader) {\n\n      var clone = (SqlSet<TResult>)Clone();\n      clone.AddManyInclude(path, loader);\n\n      return clone;\n   }\n\n   partial void\n   PocoMap(bool singleResult, SqlBuilder query, ref IEnumerable<TResult>? results) {\n\n      var mapper = CreatePocoMapper(singleResult);\n\n      results = _db.Map(query, r => (TResult)mapper.PocoMap(r));\n   }\n\n   partial void\n   PocoAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<TResult>? results) {\n\n      var mapper = CreatePocoMapper(singleResult);\n\n      results = _db.AsyncMap(query, r => (TResult)mapper.PocoMap(r));\n   }\n}\n\npartial class Mapper {\n\n   partial void\n   InitializeMappingContext2(MappingContext context) {\n\n      if (this is PocoMapper pocoMapper) {\n         context.ManyLoaders = pocoMapper.GetManyLoaders();\n      }\n\n      InitializeMappingContext3(context);\n   }\n\n   partial void\n   InitializeMappingContext3(MappingContext context);\n}\n\nsealed class PocoMapper : Mapper {\n\n   static readonly ConcurrentDictionary<CacheKey, Func<DbDataReader, MappingContext, object>>\n   _compiledMapCache = new();\n\n   static readonly ConcurrentDictionary<CacheKey, Action<DbDataReader, MappingContext, object>>\n   _compiledLoadCache = new();\n\n   readonly Type\n   _type;\n\n   Func<DbDataReader, MappingContext, object>?\n   _compiledMapFn;\n\n   Action<DbDataReader, MappingContext, object>?\n   _compiledLoadFn;\n\n   public Dictionary<string[], Action<object>>?\n   ManyIncludes { get; set; }\n\n   protected override bool\n   CanUseConstructorMapping => true;\n\n   public\n   PocoMapper(Type type) {\n      _type = type;\n   }\n\n   public object\n   PocoMap(DbDataReader record) {\n\n      if (_compiledMapFn is null) {\n\n         var arg = new CacheArg(this, record);\n\n         static Func<DbDataReader, MappingContext, object> fnFactory(CacheKey k, CacheArg arg) =>\n            ((PocoNode)arg.Mapper.GetRootNode(arg.Record)).CompileMap();\n\n         _compiledMapFn = (record.FieldCount > 0) ?\n            _compiledMapCache.GetOrAdd(BuildCacheKey(_type, record), fnFactory, arg)\n            : fnFactory(default, arg);\n      }\n\n      var instance = _compiledMapFn.Invoke(record, this.MappingContext);\n\n      return instance;\n   }\n\n   public void\n   PocoLoad(object instance, DbDataReader record) {\n\n      if (_compiledLoadFn is null) {\n\n         var arg = new CacheArg(this, record);\n\n         static Action<DbDataReader, MappingContext, object> fnFactory(CacheKey k, CacheArg arg) =>\n            ((PocoNode)arg.Mapper.GetRootNode(arg.Record)).CompileLoad();\n\n         _compiledLoadFn = (record.FieldCount > 0) ?\n            _compiledLoadCache.GetOrAdd(BuildCacheKey(_type, record), fnFactory, arg)\n            : fnFactory(default, arg);\n      }\n\n      _compiledLoadFn.Invoke(record, this.MappingContext, instance);\n   }\n\n   static CacheKey\n   BuildCacheKey(Type type, DbDataReader record) {\n\n      var fieldCount = record.FieldCount;\n      string names;\n\n      if (fieldCount == 0) {\n         names = String.Empty;\n      } else if (fieldCount == 1) {\n         names = record.GetName(0);\n      } else {\n\n         var sb = new StringBuilder();\n\n         for (var i = 0; i < fieldCount; i++) {\n\n            if (i > 0) {\n               sb.Append('\\n');\n            }\n\n            sb.Append(record.GetName(i));\n         }\n\n         names = sb.ToString();\n      }\n\n      return new CacheKey(type, names);\n   }\n\n   internal Dictionary<int, List<Action<object>>>?\n   GetManyLoaders() {\n\n      if (this.ManyIncludes is null or { Count: 0 }) {\n         return null;\n      }\n\n      var collectionNodes = new Dictionary<int, List<Action<object>>>();\n\n      foreach (var pair in this.ManyIncludes) {\n\n         var path = pair.Key;\n\n         var containerHash = (path.Length == 1) ?\n            PocoNode.RootNodeHash\n            : String.Join('.', path, 0, path.Length - 1).GetHashCode();\n\n         ref var containerCols = ref CollectionsMarshal.GetValueRefOrAddDefault(collectionNodes, containerHash, out var exists);\n\n         if (!exists) {\n            containerCols = new();\n         }\n\n         containerCols!.Add(pair.Value);\n      }\n\n      return collectionNodes;\n   }\n\n   protected override Node\n   CreateRootNode() =>\n      new PocoNode(_type, default, isComplex: true);\n\n   protected override Node?\n   CreateSimpleProperty(Node container, string propertyName, int columnOrdinal) {\n\n      var pocoContainer = (PocoNode)container;\n      var property = GetProperty(pocoContainer.UnderlyingType, propertyName);\n\n      if (property is null) {\n         return null;\n      }\n\n      return new PocoNode(property, pocoContainer, columnOrdinal);\n   }\n\n   protected override Node?\n   CreateComplexProperty(Node container, string propertyName) {\n\n      var pocoContainer = (PocoNode)container;\n      var property = GetProperty(pocoContainer.UnderlyingType, propertyName);\n\n      if (property is null) {\n         return null;\n      }\n\n      return new PocoNode(property, pocoContainer, isComplex: true);\n   }\n\n   protected override Node\n   CreateParameterNode(int columnOrdinal, ParameterInfo paramInfo) =>\n      new PocoNode(paramInfo, columnOrdinal);\n\n   protected override Node\n   CreateParameterNode(ParameterInfo paramInfo) =>\n      new PocoNode(paramInfo, isComplex: true);\n\n   static PropertyInfo?\n   GetProperty(Type declaringType, string propertyName) {\n\n      var property = declaringType.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);\n\n      if (property is null) {\n         return property;\n      }\n\n      if (!property.CanWrite) {\n         throw new InvalidOperationException($\"'{property.ReflectedType!.FullName}' property '{property.Name}' doesn't have a setter.\");\n      }\n\n      return property;\n   }\n\n   readonly record struct CacheKey(Type Type, string Names);\n\n   readonly record struct CacheArg(PocoMapper Mapper, DbDataReader Record);\n}\n\npartial class MappingContext {\n\n   public Dictionary<int, List<Action<object>>>?\n   ManyLoaders;\n\n   public void\n   LoadMany(int nodeHash, object instance, DbDataReader record) {\n\n      if (this.ManyLoaders?.TryGetValue(nodeHash, out var colLoaders) == true\n         && colLoaders.Count > 0) {\n\n         if (this.SingleResult) {\n            // if the query is expected to return a single result at most\n            // we close the data reader to allow for collections to be loaded\n            // using the same connection (for providers that do not support MARS)\n\n            record.Close();\n         }\n\n         foreach (var loader in colLoaders) {\n            loader.Invoke(instance);\n         }\n      }\n   }\n}\n\nsealed partial class PocoNode : Node {\n\n   int?\n   _propertyHash;\n\n   internal const int\n   RootNodeHash = 0;\n\n   private PocoNode?\n   Container { get; }\n\n   private Type\n   Type { get; }\n\n   public Type\n   UnderlyingType { get; }\n\n   public override int\n   ColumnOrdinal { get; }\n\n   public override string\n   TypeName => UnderlyingType.FullName!;\n\n   public override bool\n   IsComplex { get; }\n\n   private PropertyInfo?\n   Property { get; }\n\n   public override string?\n   PropertyName => Property?.Name;\n\n   public int\n   PropertyHash =>\n      _propertyHash ??= (Property is null ? RootNodeHash\n         : GetPropertyPath().GetHashCode());\n\n   public ParameterInfo?\n   Parameter { get; }\n\n   public bool\n   CanBeNull { get; }\n\n   internal\n   PocoNode(Type type, int columnOrdinal, bool isComplex) {\n\n      var underlyingNvt = Nullable.GetUnderlyingType(type);\n\n      this.Type = type;\n      this.UnderlyingType = underlyingNvt ?? type;\n      this.ColumnOrdinal = columnOrdinal;\n      this.IsComplex = isComplex;\n      this.CanBeNull = !type.IsValueType || underlyingNvt is not null;\n   }\n\n   internal\n   PocoNode(PropertyInfo property, PocoNode container, int columnOrdinal = default, bool isComplex = default)\n      : this(property.PropertyType, columnOrdinal, isComplex) {\n\n      this.Container = container;\n      this.Property = property;\n   }\n\n   internal\n   PocoNode(ParameterInfo parameter, int columnOrdinal = default, bool isComplex = default)\n      : this(parameter.ParameterType, columnOrdinal, isComplex) {\n\n      this.Parameter = parameter;\n   }\n\n   public override ConstructorInfo[]\n   GetConstructors(BindingFlags bindingAttr) =>\n      this.UnderlyingType.GetConstructors(bindingAttr);\n\n   string\n   GetPropertyPath() {\n\n      if (this.Property is null) {\n         return String.Empty;\n      }\n\n      var path = this.PropertyName!;\n      var container = this.Container;\n\n      while (container is { PropertyName: { } containerName }) {\n\n         path = containerName + \".\" + path;\n         container = container.Container;\n      }\n\n      return path;\n   }\n\n   bool\n   IsInParameter() =>\n      this.Parameter is not null\n       || this.Container?.IsInParameter() == true;\n\n   public override string\n   ToString() {\n\n      if (this.Parameter != null) {\n         return this.Parameter.ToString();\n      }\n\n      if (this.Property != null) {\n         return this.Property.DeclaringType!.ToString() + \":\" + this.PropertyName!.ToString();\n      }\n\n      return this.Type.Name;\n   }\n\n   internal Func<DbDataReader, MappingContext, object>\n   CompileMap() {\n\n      var recordParam = Expression.Parameter(typeof(DbDataReader));\n      var contextParam = Expression.Parameter(typeof(MappingContext));\n\n      var statements = new List<Expression>();\n      var varExpr = GenerateExpressionComplex(statements, recordParam, contextParam);\n      statements.Add(Expression.Convert(varExpr, typeof(object)));\n\n      var lambda = Expression.Lambda<Func<DbDataReader, MappingContext, object>>(\n         Expression.Block([varExpr], statements),\n         recordParam,\n         contextParam);\n\n      return lambda.Compile();\n   }\n\n   internal Action<DbDataReader, MappingContext, object>\n   CompileLoad() {\n\n      var recordParam = Expression.Parameter(typeof(DbDataReader));\n      var contextParam = Expression.Parameter(typeof(MappingContext));\n      var instanceParam = Expression.Parameter(typeof(object));\n      var varExpr = Expression.Variable(this.Type);\n\n      var statements = new List<Expression> {\n         Expression.Assign(varExpr, Expression.Convert(instanceParam, varExpr.Type))\n      };\n\n      GenerateLoad(varExpr, statements, recordParam, contextParam);\n\n      var lambda = Expression.Lambda<Action<DbDataReader, MappingContext, object>>(\n         Expression.Block([varExpr], statements),\n         recordParam,\n         contextParam,\n         instanceParam);\n\n      return lambda.Compile();\n   }\n\n   ParameterExpression\n   GenerateExpressionNullable(List<Expression> statements, ParameterExpression recordParam, ParameterExpression contextParam) {\n\n      var varExpr = Expression.Variable(this.Type);\n\n      if (!this.CanBeNull) {\n\n         var buffer = new List<Expression>();\n         var exprVarExpr = GenerateExpression(buffer, recordParam, contextParam);\n\n         if (buffer is [BinaryExpression binExpr and { NodeType: ExpressionType.Assign }]\n            && binExpr.Left == exprVarExpr) {\n\n            statements.Add(Expression.Assign(varExpr, binExpr.Right));\n\n         } else {\n\n            buffer.Add(Expression.Assign(varExpr, exprVarExpr));\n\n            statements.Add(Expression.Block(\n               [exprVarExpr],\n               buffer));\n         }\n\n      } else {\n\n         var isDbNulls = new List<Expression>();\n\n         foreach (var ordinal in GetAllOrdinals()) {\n            isDbNulls.Add(Expression.Call(\n               recordParam,\n               References.IsDbNullMethod,\n               Expression.Constant(ordinal, typeof(int))));\n         }\n\n         var allNullsExpr = isDbNulls[0];\n\n         for (var i = 1; i < isDbNulls.Count; i++) {\n            allNullsExpr = Expression.MakeBinary(ExpressionType.AndAlso, allNullsExpr, isDbNulls[i]);\n         }\n\n         var falseBuffer = new List<Expression>();\n         var exprVarExpr = GenerateExpression(falseBuffer, recordParam, contextParam);\n         var valueExpr = (Expression)exprVarExpr;\n         var simpleExpr = false;\n\n         if (falseBuffer is [BinaryExpression binExpr and { NodeType: ExpressionType.Assign }]\n            && binExpr.Left == exprVarExpr) {\n\n            valueExpr = binExpr.Right;\n            simpleExpr = true;\n         }\n\n         if (this.UnderlyingType.IsValueType) {\n            valueExpr = Expression.Convert(valueExpr, this.Type);\n         }\n\n         var nullExpr = Expression.Constant(null, varExpr.Type);\n\n         if (simpleExpr) {\n\n            statements.Add(Expression.Assign(\n               varExpr,\n               Expression.Condition(\n                  allNullsExpr,\n                  nullExpr,\n                  valueExpr)));\n\n         } else {\n\n            falseBuffer.Add(Expression.Assign(varExpr, valueExpr));\n\n            statements.Add(\n               Expression.IfThenElse(\n                  allNullsExpr,\n                  Expression.Assign(varExpr, nullExpr),\n                  Expression.Block(\n                     [exprVarExpr],\n                     falseBuffer)));\n         }\n      }\n\n      return varExpr;\n   }\n\n   ParameterExpression\n   GenerateExpression(List<Expression> statements, ParameterExpression recordParam, ParameterExpression contextParam) {\n\n      var varExpr = (this.IsComplex) ?\n         GenerateExpressionComplex(statements, recordParam, contextParam)\n         : GenerateExpressionSimple(statements, recordParam);\n\n      return varExpr;\n   }\n\n   ParameterExpression\n   GenerateExpressionComplex(List<Expression> statements, ParameterExpression recordParam, ParameterExpression contextParam) {\n\n      var varExpr = Expression.Variable(this.UnderlyingType);\n\n      if (this.HasConstructorParameters) {\n\n         var vars = new ParameterExpression[this.ConstructorParameters.Count];\n         var buffer = new List<Expression>();\n\n         var i = -1;\n\n         foreach (var pair in this.ConstructorParameters) {\n\n            i++;\n            var paramNode = (PocoNode)pair.Value;\n            vars[i] = paramNode.GenerateExpressionNullable(buffer, recordParam, contextParam);\n         }\n\n         var newExpr = Expression.New(this.Constructor!, vars);\n         buffer.Add(Expression.Assign(varExpr, newExpr));\n\n         statements.Add(Expression.Block(vars, buffer));\n\n      } else {\n\n         var newExpr = Expression.New(this.UnderlyingType);\n         statements.Add(Expression.Assign(varExpr, newExpr));\n      }\n\n      if (this.HasProperties) {\n         GenerateLoad(varExpr, statements, recordParam, contextParam);\n      }\n\n      return varExpr;\n   }\n\n   void\n   GenerateLoad(ParameterExpression targetExpr, List<Expression> statements, ParameterExpression recordParam, ParameterExpression contextParam) {\n\n      var nullExpr = Expression.Constant(null);\n\n      for (var i = 0; i < this.Properties.Count; i++) {\n\n         var prop = (PocoNode)this.Properties[i];\n\n         var memberExpr = Expression.Property(targetExpr, prop.Property!);\n\n         if (!prop.IsComplex\n            || prop.HasConstructorParameters) {\n\n            var buffer = new List<Expression>();\n            var exprVarExpr = prop.GenerateExpressionNullable(buffer, recordParam, contextParam);\n\n            if (buffer is [BinaryExpression binExpr and { NodeType: ExpressionType.Assign }]\n               && binExpr.Left == exprVarExpr) {\n\n               statements.Add(Expression.Assign(memberExpr, binExpr.Right));\n\n            } else {\n\n               buffer.Add(Expression.Assign(memberExpr, exprVarExpr));\n\n               statements.Add(Expression.Block(\n                  [exprVarExpr],\n                  buffer));\n            }\n\n         } else {\n\n            var buffer = new Expression[2];\n\n            var varExpr = Expression.Variable(prop.Type);\n\n            buffer[0] = Expression.Assign(varExpr, memberExpr);\n\n            var trueBuffer = new List<Expression>();\n            prop.GenerateLoad(varExpr, trueBuffer, recordParam, contextParam);\n\n            var falseBuffer = new List<Expression>();\n            var newVarExpr = prop.GenerateExpressionNullable(falseBuffer, recordParam, contextParam);\n            falseBuffer.Add(Expression.Assign(memberExpr, newVarExpr));\n\n            buffer[1] = Expression.IfThenElse(\n               Expression.MakeBinary(ExpressionType.NotEqual, varExpr, nullExpr),\n               (trueBuffer.Count == 1) ? trueBuffer[0] : Expression.Block(trueBuffer),\n               Expression.Block(\n                  [newVarExpr],\n                  falseBuffer));\n\n            statements.Add(Expression.Block(\n               [varExpr],\n               buffer));\n         }\n      }\n\n      if (!IsInParameter()) {\n\n         statements.Add(Expression.Call(\n            contextParam,\n            References.LoadManyMethod,\n            Expression.Constant(this.PropertyHash),\n            targetExpr,\n            recordParam));\n      }\n   }\n\n   ParameterExpression\n   GenerateExpressionSimple(List<Expression> statements, ParameterExpression recordParam) {\n\n      var varExpr = Expression.Variable(this.UnderlyingType);\n      var ordinalExpr = Expression.Constant(this.ColumnOrdinal);\n\n      var convertToType = default(Type);\n\n      GetConvertToType(ref convertToType);\n\n      var columnType = convertToType ?? this.UnderlyingType;\n      var typeCode = Type.GetTypeCode(columnType);\n      var isEnum = this.UnderlyingType.IsEnum;\n\n      Expression valueExpr;\n\n      if (References.RecordGetMethods.TryGetValue(typeCode, out var recordMethod)\n         && (typeCode is not TypeCode.Object || this.Type == typeof(object))) {\n\n         valueExpr = Expression.Call(recordParam, recordMethod, ordinalExpr);\n\n      } else {\n\n         valueExpr = Expression.Call(\n            recordParam,\n            References.GetFieldValueOpenMethod.MakeGenericMethod(columnType),\n            ordinalExpr);\n      }\n\n      var targetType = this.UnderlyingType;\n      var targetTypeExpr = Expression.Constant(targetType, typeof(Type));\n\n      if (convertToType != null) {\n\n         if (convertToType == typeof(string)\n            && isEnum) {\n\n            valueExpr = Expression.Call(\n               References.EnumParseOpenMethod.MakeGenericMethod(targetType),\n               valueExpr);\n\n         } else {\n\n            valueExpr = Expression.Call(\n               References.ConvertChangeTypeMethod,\n               varExpr,\n               targetTypeExpr,\n               Expression.Property(null, References.InvariantCultureProperty));\n         }\n\n      } else if (isEnum) {\n\n         var trueExpr = (Expression)Expression.Call(\n            References.EnumParseOpenMethod.MakeGenericMethod(targetType),\n            Expression.Call(recordParam, References.RecordGetMethods[TypeCode.String], ordinalExpr));\n\n         var falseExpr = valueExpr;\n         falseExpr = Expression.Convert(falseExpr, targetType);\n\n         valueExpr = Expression.Condition(\n            Expression.MakeBinary(\n               ExpressionType.Equal,\n               Expression.Call(recordParam, References.GetFieldTypeMethod, ordinalExpr),\n               Expression.Constant(typeof(string), typeof(Type))),\n            trueExpr,\n            falseExpr);\n      }\n\n      if (valueExpr.Type != varExpr.Type) {\n         valueExpr = Expression.Convert(valueExpr, varExpr.Type);\n      }\n\n      statements.Add(Expression.Assign(varExpr, valueExpr));\n\n      return varExpr;\n   }\n\n   IEnumerable<int>\n   GetAllOrdinals() {\n\n      if (this.IsComplex) {\n\n         if (this.HasConstructorParameters) {\n            foreach (var pair in this.ConstructorParameters) {\n               foreach (var o in ((PocoNode)pair.Value).GetAllOrdinals()) {\n                  yield return o;\n               }\n            }\n         }\n\n         if (this.HasProperties) {\n#pragma warning disable IDE0220\n            foreach (PocoNode prop in this.Properties) {\n#pragma warning restore IDE0220\n               foreach (var o in prop.GetAllOrdinals()) {\n                  yield return o;\n               }\n            }\n         }\n\n         yield break;\n      }\n\n      yield return this.ColumnOrdinal;\n   }\n\n   partial void\n   GetConvertToType(ref Type? convertToType);\n\n   static partial class References {\n\n      public static readonly MethodInfo\n      ConvertChangeTypeMethod = typeof(Convert)\n         .GetMethod(nameof(Convert.ChangeType), BindingFlags.Public | BindingFlags.Static, null, [typeof(object), typeof(Type), typeof(IFormatProvider)], null)!;\n\n      public static readonly MethodInfo\n      EnumParseOpenMethod = typeof(Enum)\n         .GetMethod(nameof(Enum.Parse), 1, BindingFlags.Public | BindingFlags.Static, null, [typeof(string)], null)!;\n\n      public static readonly MethodInfo\n      GetFieldTypeMethod = typeof(DbDataReader)\n         .GetMethod(nameof(DbDataReader.GetFieldType))!;\n\n      public static readonly MethodInfo\n      GetFieldValueOpenMethod = typeof(DbDataReader)\n         .GetMethod(nameof(DbDataReader.GetFieldValue))!;\n\n      public static readonly PropertyInfo\n      InvariantCultureProperty = typeof(CultureInfo)\n         .GetProperty(nameof(CultureInfo.InvariantCulture))!;\n\n      public static readonly MethodInfo\n      IsDbNullMethod = typeof(DbDataReader)\n         .GetMethod(nameof(DbDataReader.IsDBNull))!;\n\n      public static readonly MethodInfo\n      LoadManyMethod = typeof(MappingContext)\n         .GetMethod(nameof(MappingContext.LoadMany))!;\n\n      public static readonly Dictionary<TypeCode, MethodInfo>\n      RecordGetMethods = new() {\n         {  TypeCode.Boolean, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetBoolean))! },\n         {  TypeCode.Byte, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetByte))! },\n         {  TypeCode.Char, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetChar))! },\n         {  TypeCode.DateTime, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetDateTime))! },\n         {  TypeCode.Decimal, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetDecimal))! },\n         {  TypeCode.Double, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetDouble))! },\n         {  TypeCode.Int16, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetInt16))! },\n         {  TypeCode.Int32, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetInt32))! },\n         {  TypeCode.Int64, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetInt64))! },\n         {  TypeCode.Object, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetValue))! },\n         {  TypeCode.Single, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetFloat))! },\n         {  TypeCode.String, typeof(DbDataReader).GetMethod(nameof(DbDataReader.GetString))! },\n      };\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/Properties/AssemblyInfo.cs",
    "content": "﻿using System;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n[assembly: ComVisible(false)]\n[assembly: CLSCompliant(true)]\n[assembly: InternalsVisibleTo(\"DbExtensions.Tests\")]\n[assembly: InternalsVisibleTo(\"DynamicProxyGenAssembly2\")]\n"
  },
  {
    "path": "src/DbExtensions/SqlBuilder.cs",
    "content": "﻿// Copyright 2009-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace DbExtensions;\n\nusing InterpolatedString = InterpolatedStringHandlerArgumentAttribute;\n\n#nullable enable\n\ninterface ISqlFragment {\n\n   IList<object?>\n   ParameterValues { get; }\n\n   string\n   ToString();\n}\n\n/// <summary>\n/// Represents a mutable SQL string.\n/// </summary>\n/// <remarks>For information on how to use SqlBuilder see <see href=\"https://maxtoroq.github.io/DbExtensions/docs/7/SqlBuilder.html\">SqlBuilder Tutorial</see>.</remarks>\n\n[CLSCompliant(true)]\n[DebuggerDisplay($\"{{{nameof(Buffer)}}}\")]\n[InterpolatedStringHandler]\npublic sealed partial class SqlBuilder : ISqlFragment {\n\n   const int\n   _defaultCapacity = 48;\n\n   SqlClause?\n   _nextClause;\n\n   bool?\n   _ifCondition;\n\n   bool?\n   _appendIfCondition;\n\n   /// <summary>\n   /// The underlying <see cref=\"StringBuilder\"/>.\n   /// </summary>\n\n   public StringBuilder\n   Buffer { get; }\n\n   /// <summary>\n   /// The parameter objects to be included in the database command.\n   /// </summary>\n\n   public Collection<object?>\n   ParameterValues { get; }\n\n   IList<object?>\n   ISqlFragment.ParameterValues => ParameterValues;\n\n   /// <summary>\n   /// Gets or sets the current SQL clause, used to identify consecutive \n   /// appends to the same clause.\n   /// </summary>\n\n   public SqlClause?\n   CurrentClause { get; set; }\n\n   /// <summary>\n   /// Gets or sets the next SQL clause. Used by clause continuation methods,\n   /// such as <see cref=\"_(String)\"/> and <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n\n   public SqlClause?\n   NextClause {\n      get => _nextClause;\n      set {\n         _nextClause = value;\n         _ifCondition = null;\n         _appendIfCondition = null;\n      }\n   }\n\n   /// <summary>\n   /// Returns <c>true</c> if the buffer is empty.\n   /// </summary>\n\n   public bool\n   IsEmpty => Buffer.Length == 0;\n\n   internal bool\n   ElseOK => _ifCondition == false;\n\n   internal bool\n   AppendElseOK => _appendIfCondition == false;\n\n   /// <summary>\n   /// Concatenates a specified separator <see cref=\"String\"/> between each element of a \n   /// specified <see cref=\"SqlBuilder\"/> array, yielding a single concatenated <see cref=\"SqlBuilder\"/>.\n   /// </summary>\n   /// <param name=\"separator\">The string to use as a separator.</param>\n   /// <param name=\"values\">An array of <see cref=\"SqlBuilder\"/>.</param>\n   /// <returns>\n   /// A <see cref=\"SqlBuilder\"/> consisting of the elements of <paramref name=\"values\"/> \n   /// interspersed with the <paramref name=\"separator\"/> string.\n   /// </returns>\n\n   public static SqlBuilder\n   JoinSql(string? separator, params SqlBuilder?[] values) {\n\n      ArgumentNullException.ThrowIfNull(values);\n\n      var sql = new SqlBuilder();\n\n      if (values.Length == 0) {\n         return sql;\n      }\n\n      separator ??= String.Empty;\n\n      var first = values[0];\n\n      if (first is not null) {\n         sql.AppendSql(first);\n      }\n\n      for (int i = 1; i < values.Length; i++) {\n\n         sql.Append(separator);\n\n         var val = values[i];\n\n         if (val is not null) {\n            sql.AppendSql(val);\n         }\n      }\n\n      return sql;\n   }\n\n   /// <summary>\n   /// Concatenates the members of a constructed <see cref=\"IEnumerable&lt;SqlBuilder>\"/> collection of type <see cref=\"SqlBuilder\"/>, \n   /// using the specified <paramref name=\"separator\"/> between each member.\n   /// </summary>\n   /// <param name=\"separator\">The string to use as a separator.</param>\n   /// <param name=\"values\">A collection that contains the <see cref=\"SqlBuilder\"/> objects to concatenate.</param>\n   /// <returns>\n   /// A <see cref=\"SqlBuilder\"/> that consists of the members of <paramref name=\"values\"/> delimited \n   /// by the <paramref name=\"separator\"/> string. If <paramref name=\"values\"/> has no members, the method returns\n   /// an empty <see cref=\"SqlBuilder\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   JoinSql(string? separator, IEnumerable<SqlBuilder?> values) {\n\n      ArgumentNullException.ThrowIfNull(values);\n\n      var sql = new SqlBuilder();\n\n      separator ??= String.Empty;\n\n      using (var enumerator = values.GetEnumerator()) {\n\n         if (!enumerator.MoveNext()) {\n            return sql;\n         }\n\n         if (enumerator.Current is not null) {\n            sql.AppendSql(enumerator.Current);\n         }\n\n         while (enumerator.MoveNext()) {\n\n            sql.Append(separator);\n\n            if (enumerator.Current is not null) {\n               sql.AppendSql(enumerator.Current);\n            }\n         }\n      }\n\n      return sql;\n   }\n\n   /// <summary>\n   /// Initializes a new instance of the <see cref=\"SqlBuilder\"/> class.\n   /// </summary>\n\n   public\n   SqlBuilder() {\n\n      this.Buffer = new(_defaultCapacity);\n      this.ParameterValues = new();\n   }\n\n   private\n   SqlBuilder(SqlBuilder other) {\n\n      ArgumentNullException.ThrowIfNull(other);\n\n      // When you clone a builder you most likely want to modify the clone,\n      // therefore use default capacity as min.\n\n      this.Buffer = new(Math.Max(_defaultCapacity, other.Buffer.Capacity));\n      this.Buffer.Append(other.Buffer);\n      this.ParameterValues = new(new List<object?>(other.ParameterValues));\n      this.CurrentClause = other.CurrentClause;\n\n      _nextClause = other._nextClause;\n      _ifCondition = other._ifCondition;\n      _appendIfCondition = other._appendIfCondition;\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public\n   SqlBuilder(int literalLength, int formattedCount) {\n\n      // This constructor is used by interpolated strings.\n      // Capacities are optimized for \"static\" queries.\n\n      var queryLength = literalLength + PlaceholderLengthSum(formattedCount);\n\n      this.Buffer = new(queryLength);\n      this.ParameterValues = new(new List<object?>(formattedCount));\n   }\n\n   static int\n   PlaceholderLengthSum(int formattedCount) {\n\n      var result = 0;\n\n      for (var i = 0; i < formattedCount; i++) {\n         result += i switch {\n            < 10 => 1,\n            < 100 => 2,\n            < 1_000 => 3,\n            < 10_000 => 4,\n            < 100_000 => 5,\n            < 1_000_000 => 6,\n            < 10_000_000 => 7,\n            < 100_000_000 => 8,\n            < 1_000_000_000 => 9,\n            _ => 10\n         } + 2;\n      }\n\n      return result;\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public void\n   AppendLiteral(string value) =>\n      this.Buffer.Append(value);\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public void\n   AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n      AppendPlaceholder(value, format);\n\n   /// <summary>\n   /// Appends the SQL clause identified by <typeparamref name=\"TClause\"/>.\n   /// </summary>\n   /// <typeparam name=\"TClause\">The type of the SQL clause.</typeparam>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   AppendClause<TClause>() where TClause : SqlClause, new() =>\n      AppendClause(SqlClause.Instance<TClause>());\n\n   /// <summary>\n   /// Appends the SQL <paramref name=\"clause\"/>.\n   /// </summary>\n   /// <param name=\"clause\">The clause to append.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   AppendClause(SqlClause clause) {\n\n      ArgumentNullException.ThrowIfNull(clause);\n\n      if (clause is SqlClause.Current) {\n         clause = this.NextClause\n            ?? this.CurrentClause\n            ?? throw new InvalidOperationException();\n      }\n\n      if (clause.Separator is null\n         || !String.Equals(clause.Name, this.CurrentClause?.Name, StringComparison.OrdinalIgnoreCase)) {\n\n         if (!this.IsEmpty) {\n            this.Buffer.AppendLine();\n         }\n\n         if (clause.Name is { } name) {\n            this.Buffer.Append(name)\n               .Append(' ');\n         }\n\n      } else if (clause.Separator is { } sep) {\n         this.Buffer.Append(sep);\n      }\n\n      this.CurrentClause = clause;\n      this.NextClause = null;\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends <paramref name=\"sql\"/> to this instance.\n   /// </summary>\n   /// <param name=\"sql\">A <see cref=\"SqlBuilder\"/>.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   AppendSql(SqlBuilder sql) {\n\n      ArgumentNullException.ThrowIfNull(sql);\n\n      AppendFragment(sql, this.Buffer);\n      return this;\n   }\n\n   internal SqlBuilder\n   AppendFragment(ISqlFragment sql) {\n\n      AppendFragment(sql, this.Buffer);\n      return this;\n   }\n\n   void\n   AppendFragment(ISqlFragment sql, StringBuilder sb) {\n\n      if (sql.ParameterValues.Count == 0) {\n\n         if (sql is SqlBuilder sqlB) {\n            sb.Append(sqlB.Buffer);\n         } else {\n            sb.Append(sql.ToString());\n         }\n\n         return;\n      }\n\n      sb.AppendFormat(\n         CultureInfo.InvariantCulture,\n         sql.ToString(),\n         Enumerable.Range(0, sql.ParameterValues.Count)\n            .Select(x => $\"{{{this.ParameterValues.Count + x}}}\")\n            .ToArray());\n\n      foreach (var param in sql.ParameterValues) {\n         this.ParameterValues.Add(param);\n      }\n   }\n\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> to this instance.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   Append([InterpolatedString(\"\")] ref AppendStringHandler handler) =>\n      this;\n\n   /// <summary>\n   /// Appends <paramref name=\"text\"/> to this instance.\n   /// </summary>\n   /// <param name=\"text\">The string.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   Append(string? text) {\n\n      this.Buffer.Append(text);\n      return this;\n   }\n\n   internal void\n   AppendPlaceholder(object? value, string? format) {\n\n      if (format == \"sql\") {\n         this.Buffer.Append(CultureInfo.InvariantCulture, $\"{value}\");\n         return;\n      }\n\n      if (format == \"list\") {\n\n         var items = (value as IEnumerable<object?>\n            ?? (value as IEnumerable)?.Cast<object?>()\n            ?? [])\n            .DefaultIfEmpty();\n\n         var first = true;\n\n         foreach (var item in items) {\n\n            if (!first) {\n               this.Buffer.Append(',')\n                  .Append(' ');\n            }\n\n            this.Buffer.Append('{')\n               .Append(this.ParameterValues.Count)\n               .Append('}');\n\n            this.ParameterValues.Add(item);\n\n            first = false;\n         }\n\n         return;\n      }\n\n      var sql = value as SqlBuilder;\n\n      if (sql is null) {\n         GetDefiningQueryFromObject(value, ref sql);\n      }\n\n      if (sql is not null) {\n         AppendPlaceholderSql(sql);\n         return;\n      }\n\n      this.Buffer.Append('{')\n         .Append(this.ParameterValues.Count)\n         .Append('}');\n\n      this.ParameterValues.Add(value);\n   }\n\n   void\n   AppendPlaceholderSql(SqlBuilder value) {\n\n      var frag = new StringBuilder()\n         .AppendLine();\n\n      AppendFragment(value, frag);\n      frag.Replace(Environment.NewLine, $\"{Environment.NewLine}\\t\");\n\n      this.Buffer.Append(frag);\n   }\n\n   static partial void\n   GetDefiningQueryFromObject(object? obj, ref SqlBuilder? definingQuery);\n\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> if <paramref name=\"condition\"/> is <c>true</c>.\n   /// </summary>\n   /// <param name=\"condition\"><c>true</c> to append <paramref name=\"handler\"/>; otherwise, <c>false</c>.</param>\n   /// <param name=\"handler\">The interpolated string to append.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   AppendIf(bool condition, [InterpolatedString(\"\", nameof(condition))] ref AppendStringHandler handler) {\n\n      _appendIfCondition = condition;\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> if <paramref name=\"condition\"/> is <c>true</c>\n   /// and an antecedent call to <see cref=\"AppendIf(Boolean, ref AppendStringHandler)\"/>\n   /// or <see cref=\"AppendElseIf(Boolean, ref AppendElseStringHandler)\"/> used a <c>false</c> condition.\n   /// </summary>\n   /// <inheritdoc cref=\"AppendIf(Boolean, ref AppendStringHandler)\"/>\n\n   public SqlBuilder\n   AppendElseIf(bool condition, [InterpolatedString(\"\", nameof(condition))] ref AppendElseStringHandler handler) {\n\n      if (this.AppendElseOK) {\n         _appendIfCondition = condition;\n      }\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> if an antecedent call to\n   /// <see cref=\"AppendIf(Boolean, ref AppendStringHandler)\"/>\n   /// or <see cref=\"AppendElseIf(Boolean, ref AppendElseStringHandler)\"/> used a <c>false</c> condition\n   /// </summary>\n   /// <inheritdoc cref=\"AppendIf(Boolean, ref AppendStringHandler)\" path=\"*[self::param[@name='handler'] or self::returns]\"/>\n\n   public SqlBuilder\n   AppendElse([InterpolatedString(\"\")] ref AppendElseStringHandler handler) {\n\n      if (this.AppendElseOK) {\n         _appendIfCondition = null;\n      }\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends the default line terminator to this instance.\n   /// </summary>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   AppendLine() {\n\n      this.Buffer.AppendLine();\n      return this;\n   }\n\n   /// <summary>\n   /// Inserts a string into this instance at the specified character position.\n   /// </summary>\n   /// <param name=\"index\">The position in this instance where insertion begins.</param>\n   /// <param name=\"value\">The string to insert.</param>\n   /// <returns>A reference to this instance after the insert operation has completed.</returns>\n\n   public SqlBuilder\n   InsertText(int index, string? value) {\n\n      this.Buffer.Insert(index, value);\n      return this;\n   }\n\n   /// <summary>\n   /// Sets the clause identified by <typeparamref name=\"TClause\"/> as the current SQL clause.\n   /// </summary>\n   /// <typeparam name=\"TClause\">The type of the SQL clause.</typeparam>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n   /// <seealso cref=\"CurrentClause\"/>\n\n   public SqlBuilder\n   SetCurrentClause<TClause>() where TClause : SqlClause, new() =>\n      SetCurrentClause(SqlClause.Instance<TClause>());\n\n   /// <summary>\n   /// Sets <paramref name=\"clause\"/> as the current SQL clause.\n   /// </summary>\n   /// <param name=\"clause\">The SQL clause.</param>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n   /// <seealso cref=\"CurrentClause\"/>\n\n   public SqlBuilder\n   SetCurrentClause(SqlClause? clause) {\n\n      this.CurrentClause = clause;\n      return this;\n   }\n\n   /// <summary>\n   /// Sets the clause identified by <typeparamref name=\"TClause\"/> as the next SQL clause.\n   /// </summary>\n   /// <typeparam name=\"TClause\">The type of the SQL clause.</typeparam>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n   /// <seealso cref=\"NextClause\"/>\n\n   public SqlBuilder\n   SetNextClause<TClause>() where TClause : SqlClause, new() =>\n      SetNextClause(SqlClause.Instance<TClause>());\n\n   /// <summary>\n   /// Sets <paramref name=\"clause\"/> as the next SQL clause.\n   /// </summary>\n   /// <param name=\"clause\">The SQL clause.</param>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n   /// <seealso cref=\"NextClause\"/>\n\n   public SqlBuilder\n   SetNextClause(SqlClause? clause) {\n\n      this.NextClause = clause;\n\n      return this;\n   }\n\n   /// <summary>\n   /// Converts the value of this instance to a <see cref=\"String\"/>.\n   /// </summary>\n   /// <returns>A string whose value is the same as this instance.</returns>\n\n   public override string\n   ToString() => this.Buffer.ToString();\n\n   /// <summary>\n   /// Creates and returns a copy of this instance.\n   /// </summary>\n   /// <returns>A new <see cref=\"SqlBuilder\"/> that is equivalent to this instance.</returns>\n\n   public SqlBuilder\n   Clone() => new SqlBuilder(this);\n\n#pragma warning disable IDE1006\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> to the current clause.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the current clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   [CLSCompliant(false)]\n   public SqlBuilder\n   _([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.Current> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the <paramref name=\"text\"/> to the current clause.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the current clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   [CLSCompliant(false)]\n   public SqlBuilder\n   _(string? text) =>\n      AppendClause<SqlClause.Current>().Append(text);\n\n   /// <summary>\n   /// Appends the interpolated string <paramref name=\"handler\"/> to the current clause if <paramref name=\"condition\"/> is <c>true</c>.\n   /// </summary>\n   /// <param name=\"condition\"><c>true</c> to append <paramref name=\"handler\"/> to the current clause; otherwise, <c>false</c>.</param>\n   /// <param name=\"handler\">The interpolated string that represents the body of the current clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   [CLSCompliant(false)]\n   public SqlBuilder\n   _If(bool condition, [InterpolatedString(\"\", nameof(condition))] ref ConditionalStringHandler handler) {\n\n      _ifCondition = condition;\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends <paramref name=\"handler\"/> to the current clause if <paramref name=\"condition\"/> is <c>true</c>\n   /// and an antecedent call to <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>\n   /// or <see cref=\"_ElseIf(Boolean, ref ConditionalElseStringHandler)\"/> used a <c>false</c> condition.\n   /// </summary>\n   /// <inheritdoc cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>\n\n   [CLSCompliant(false)]\n   public SqlBuilder\n   _ElseIf(bool condition, [InterpolatedString(\"\", nameof(condition))] ref ConditionalElseStringHandler handler) {\n\n      if (this.ElseOK) {\n         _ifCondition = condition;\n      }\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends <paramref name=\"handler\"/> to the current clause if an antecedent call to\n   /// <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>\n   /// or <see cref=\"_ElseIf(Boolean, ref ConditionalElseStringHandler)\"/> used a\n   /// <c>false</c> condition\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the current clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   [CLSCompliant(false)]\n   public SqlBuilder\n   _Else([InterpolatedString(\"\")] ref ConditionalElseStringHandler handler) =>\n      this;\n#pragma warning restore IDE1006\n\n   /// <summary>\n   /// Appends the WITH clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the WITH clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WITH([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.WITH> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the WITH clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the WITH clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WITH(string? text) =>\n      AppendClause<SqlClause.WITH>().Append(text);\n\n   /// <summary>\n   /// Appends the WITH clause using the provided <paramref name=\"subQuery\"/> as body named after\n   /// <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the WITH clause.</param>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WITH(string alias, SqlBuilder subQuery) {\n\n      ArgumentNullException.ThrowIfNull(alias);\n      ArgumentNullException.ThrowIfNull(subQuery);\n\n      AppendClause<SqlClause.WITH>();\n\n      this.Buffer.Append(alias)\n         .Append(\" AS (\");\n      AppendPlaceholderSql(subQuery);\n      this.Buffer.Append(')');\n\n      return this;\n   }\n\n   /// <summary>\n   /// Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   SELECT() =>\n      SetNextClause<SqlClause.SELECT>();\n\n   /// <summary>\n   /// Appends the SELECT clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the SELECT clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   SELECT([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.SELECT> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the SELECT clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the SELECT clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   SELECT(string? text) =>\n      AppendClause<SqlClause.SELECT>().Append(text);\n\n   /// <summary>\n   /// Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   FROM() =>\n      SetNextClause<SqlClause.FROM>();\n\n   /// <summary>\n   /// Appends the FROM clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the FROM clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   FROM([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.FROM> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the FROM clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the FROM clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   FROM(string? text) =>\n      AppendClause<SqlClause.FROM>().Append(text);\n\n   /// <summary>\n   /// Appends the FROM clause using the provided <paramref name=\"subQuery\"/> as body named after\n   /// <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the FROM clause.</param>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   FROM(SqlBuilder subQuery, string alias) {\n\n      ArgumentNullException.ThrowIfNull(subQuery);\n      ArgumentNullException.ThrowIfNull(alias);\n\n      AppendClause<SqlClause.FROM>();\n\n      this.Buffer.Append('(');\n      AppendPlaceholderSql(subQuery);\n      this.Buffer.Append(\") AS \")\n         .Append(alias);\n\n      return this;\n   }\n\n   /// <summary>\n   /// Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   JOIN() =>\n      SetNextClause<SqlClause.JOIN>();\n\n   /// <summary>\n   /// Appends the JOIN clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   JOIN([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.JOIN> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the JOIN clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   JOIN(string? text) =>\n      AppendClause<SqlClause.JOIN>().Append(text);\n\n   /// <summary>\n   /// Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   LEFT_JOIN() =>\n      SetNextClause<SqlClause.LEFT_JOIN>();\n\n   /// <summary>\n   /// Appends the LEFT JOIN clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the LEFT JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   LEFT_JOIN([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.LEFT_JOIN> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the LEFT JOIN clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the LEFT JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   LEFT_JOIN(string? text) =>\n      AppendClause<SqlClause.LEFT_JOIN>().Append(text);\n\n   /// <summary>\n   /// Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   RIGHT_JOIN() =>\n      SetNextClause<SqlClause.RIGHT_JOIN>();\n\n   /// <summary>\n   /// Appends the RIGHT JOIN clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the RIGHT JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   RIGHT_JOIN([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.RIGHT_JOIN> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the RIGHT JOIN clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the RIGHT JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   RIGHT_JOIN(string? text) =>\n      AppendClause<SqlClause.RIGHT_JOIN>().Append(text);\n\n   /// <summary>\n   /// Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   INNER_JOIN() =>\n      SetNextClause<SqlClause.INNER_JOIN>();\n\n   /// <summary>\n   /// Appends the INNER JOIN clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the INNER JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   INNER_JOIN([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.INNER_JOIN> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the INNER JOIN clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the INNER JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   INNER_JOIN(string? text) =>\n      AppendClause<SqlClause.INNER_JOIN>().Append(text);\n\n   /// <summary>\n   /// Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   CROSS_JOIN() =>\n      SetNextClause<SqlClause.CROSS_JOIN>();\n\n   /// <summary>\n   /// Appends the CROSS JOIN clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the CROSS JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   CROSS_JOIN([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.CROSS_JOIN> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the CROSS JOIN clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the CROSS JOIN clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   CROSS_JOIN(string? text) =>\n      AppendClause<SqlClause.CROSS_JOIN>().Append(text);\n\n   /// <summary>\n   /// Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   WHERE() =>\n      SetNextClause<SqlClause.WHERE>();\n\n   /// <summary>\n   /// Appends the WHERE clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the WHERE clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WHERE([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.WHERE> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the WHERE clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the WHERE clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WHERE(string? text) =>\n      AppendClause<SqlClause.WHERE>().Append(text);\n\n   /// <summary>\n   /// Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   GROUP_BY() =>\n      SetNextClause<SqlClause.GROUP_BY>();\n\n   /// <summary>\n   /// Appends the GROUP BY clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the GROUP BY clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   GROUP_BY([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.GROUP_BY> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the GROUP BY clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the GROUP BY clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   GROUP_BY(string? text) =>\n      AppendClause<SqlClause.GROUP_BY>().Append(text);\n\n   /// <summary>\n   /// Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   HAVING() =>\n      SetNextClause<SqlClause.HAVING>();\n\n   /// <summary>\n   /// Appends the HAVING clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the HAVING clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   HAVING([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.HAVING> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the HAVING clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the HAVING clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   HAVING(string? text) =>\n      AppendClause<SqlClause.HAVING>().Append(text);\n\n   /// <summary>\n   /// Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   ORDER_BY() =>\n      SetNextClause<SqlClause.ORDER_BY>();\n\n   /// <summary>\n   /// Appends the ORDER BY clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the ORDER BY clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   ORDER_BY([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.ORDER_BY> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the ORDER BY clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the ORDER BY clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   ORDER_BY(string? text) =>\n      AppendClause<SqlClause.ORDER_BY>().Append(text);\n\n   /// <summary>\n   /// Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   LIMIT() =>\n      SetNextClause<SqlClause.LIMIT>();\n\n   /// <summary>\n   /// Appends the LIMIT clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the LIMIT clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   LIMIT([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.LIMIT> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the LIMIT clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the LIMIT clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   LIMIT(string? text) =>\n      AppendClause<SqlClause.LIMIT>().Append(text);\n\n   /// <summary>\n   /// Appends the LIMIT clause using the provided <paramref name=\"maxRecords\"/> parameter.\n   /// </summary>\n   /// <param name=\"maxRecords\">The value to use as parameter.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   LIMIT(int maxRecords) {\n\n      AppendClause<SqlClause.LIMIT>();\n\n      this.Buffer.Append('{')\n         .Append(this.ParameterValues.Count)\n         .Append('}');\n\n      this.ParameterValues.Add(maxRecords);\n\n      return this;\n   }\n\n   /// <summary>\n   /// Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods,\n   /// such as <see cref=\"_If(Boolean, ref ConditionalStringHandler)\"/>.\n   /// </summary>\n   /// <returns>A reference to this instance after the operation has completed.</returns>\n\n   public SqlBuilder\n   OFFSET() =>\n      SetNextClause<SqlClause.OFFSET>();\n\n   /// <summary>\n   /// Appends the OFFSET clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the OFFSET clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   OFFSET([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.OFFSET> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the OFFSET clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the OFFSET clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   OFFSET(string? text) =>\n      AppendClause<SqlClause.OFFSET>().Append(text);\n\n   /// <summary>\n   /// Appends the OFFSET clause using the provided <paramref name=\"startIndex\"/> parameter.\n   /// </summary>\n   /// <param name=\"startIndex\">The value to use as parameter.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   OFFSET(int startIndex) {\n\n      AppendClause<SqlClause.OFFSET>();\n\n      this.Buffer.Append('{')\n         .Append(this.ParameterValues.Count)\n         .Append('}');\n\n      this.ParameterValues.Add(startIndex);\n\n      return this;\n   }\n\n   /// <summary>\n   /// Appends the UNION clause.\n   /// </summary>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   UNION() =>\n      AppendClause<SqlClause.UNION>();\n\n   /// <summary>\n   /// Appends the INSERT INTO clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the INSERT INTO clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   INSERT_INTO([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.INSERT_INTO> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the INSERT INTO clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the INSERT INTO clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   INSERT_INTO(string? text) =>\n      AppendClause<SqlClause.INSERT_INTO>().Append(text);\n\n   /// <summary>\n   /// Appends the DELETE FROM clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the DELETE FROM clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   DELETE_FROM([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.DELETE_FROM> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the DELETE FROM clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the DELETE FROM clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   DELETE_FROM(string? text) =>\n      AppendClause<SqlClause.DELETE_FROM>().Append(text);\n\n   /// <summary>\n   /// Appends the UPDATE clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the UPDATE clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   UPDATE([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.UPDATE> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the UPDATE clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the UPDATE clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   UPDATE(string? text) =>\n      AppendClause<SqlClause.UPDATE>().Append(text);\n\n   /// <summary>\n   /// Appends the SET clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the SET clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   SET([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.SET> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the SET clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The text that represents the body of the SET clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   SET(string? text) =>\n      AppendClause<SqlClause.SET>().Append(text);\n\n   /// <summary>\n   /// Appends the VALUES clause using the provided interpolated string <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The interpolated string that represents the body of the VALUES clause.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   VALUES([InterpolatedString(\"\")] ref ClauseStringHandler<SqlClause.VALUES> handler) =>\n      this;\n\n   /// <summary>\n   /// Appends the VALUES clause using the provided parameters.\n   /// </summary>\n   /// <param name=\"args\">The parameters of the clause body.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   VALUES(params object?[] args) {\n\n      ArgumentNullException.ThrowIfNull(args);\n\n      if (args.Length == 0) {\n         throw new ArgumentException($\"{nameof(args)} cannot be empty\", nameof(args));\n      }\n\n      AppendClause<SqlClause.VALUES>();\n\n      this.Buffer.Append('(');\n\n      for (int i = 0; i < args.Length; i++) {\n\n         if (i > 0) {\n            this.Buffer.Append(',')\n               .Append(' ');\n         }\n\n         this.Buffer.Append('{')\n            .Append(this.ParameterValues.Count)\n            .Append('}');\n\n         this.ParameterValues.Add(args[i]);\n      }\n\n      this.Buffer.Append(')');\n\n      return this;\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct AppendStringHandler {\n\n      internal SqlBuilder\n      Builder { get; }\n\n      /// <exclude/>\n\n      public\n      AppendStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         this.Builder = sqlBuilder;\n      }\n\n      /// <exclude/>\n\n      public\n      AppendStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, bool condition, out bool shouldAppend) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         this.Builder = sqlBuilder;\n\n         shouldAppend = condition;\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         this.Builder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         this.Builder.AppendPlaceholder(value, format);\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct AppendElseStringHandler {\n\n      internal SqlBuilder\n      Builder { get; }\n\n      /// <exclude/>\n\n      public\n      AppendElseStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, out bool shouldAppend)\n         : this(literalLength, formattedCount, sqlBuilder, true, out shouldAppend) { }\n\n      /// <exclude/>\n\n      public\n      AppendElseStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, bool condition, out bool shouldAppend) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         this.Builder = sqlBuilder;\n\n         condition = condition\n            && sqlBuilder.AppendElseOK;\n\n         shouldAppend = condition;\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         this.Builder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         this.Builder.AppendPlaceholder(value, format);\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct ClauseStringHandler<TClause> where TClause : SqlClause, new() {\n\n      internal SqlBuilder\n      Builder { get; }\n\n      /// <exclude/>\n\n      public\n      ClauseStringHandler(int literalLength, int formattedCount)\n         : this(literalLength, formattedCount, new()) { }\n\n      /// <exclude/>\n\n      public\n      ClauseStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         this.Builder = sqlBuilder;\n\n         sqlBuilder.AppendClause<TClause>();\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         this.Builder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         this.Builder.AppendPlaceholder(value, format);\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct ConditionalStringHandler {\n\n      readonly SqlBuilder\n      _sqlBuilder;\n\n      /// <exclude/>\n\n      public\n      ConditionalStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, bool condition, out bool shouldAppend) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         _sqlBuilder = sqlBuilder;\n\n         shouldAppend = condition;\n\n         if (shouldAppend) {\n            sqlBuilder.AppendClause<SqlClause.Current>();\n         }\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         _sqlBuilder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         _sqlBuilder.AppendPlaceholder(value, format);\n   }\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct ConditionalElseStringHandler {\n\n      readonly SqlBuilder\n      _sqlBuilder;\n\n      /// <exclude/>\n\n      public\n      ConditionalElseStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, out bool shouldAppend)\n         : this(literalLength, formattedCount, sqlBuilder, true, out shouldAppend) { }\n\n      /// <exclude/>\n\n      public\n      ConditionalElseStringHandler(int literalLength, int formattedCount, SqlBuilder sqlBuilder, bool condition, out bool shouldAppend) {\n\n         ArgumentNullException.ThrowIfNull(sqlBuilder);\n\n         _sqlBuilder = sqlBuilder;\n\n         condition = condition\n            && sqlBuilder.ElseOK;\n\n         shouldAppend = condition;\n\n         if (shouldAppend) {\n            sqlBuilder.AppendClause<SqlClause.Current>();\n         }\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         _sqlBuilder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         _sqlBuilder.AppendPlaceholder(value, format);\n   }\n}\n\n/// <summary>\n/// Provides a set of static (Shared in Visual Basic) methods to create <see cref=\"SqlBuilder\"/>\n/// instances.\n/// </summary>\n\npublic static partial class SQL {\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the WITH clause using the provided string interpolated <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The body of the WITH clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.WITH(ref SqlBuilder.ClauseStringHandler&lt;SqlClause.WITH>)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   WITH(ref SqlBuilder.ClauseStringHandler<SqlClause.WITH> handler) =>\n      handler.Builder;\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the WITH clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The body of the WITH clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.WITH(String)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   WITH(string? text) =>\n      new SqlBuilder().WITH(text);\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the WITH clause using the provided <paramref name=\"subQuery\"/>\n   /// and <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the WITH clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.WITH(string, SqlBuilder)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   WITH(string alias, SqlBuilder subQuery) {\n\n      ArgumentNullException.ThrowIfNull(alias);\n      ArgumentNullException.ThrowIfNull(subQuery);\n\n      return new SqlBuilder().WITH(alias, subQuery);\n   }\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the SELECT clause using the provided string interpolated <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The body of the SELECT clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.SELECT(ref SqlBuilder.ClauseStringHandler&lt;SqlClause.SELECT>)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   SELECT(ref SqlBuilder.ClauseStringHandler<SqlClause.SELECT> handler) =>\n      handler.Builder;\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the SELECT clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The body of the SELECT clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.SELECT(String)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   SELECT(string? text) =>\n      new SqlBuilder().SELECT(text);\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the INSERT INTO clause using the provided string interpolated <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The body of the INSERT INTO clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.INSERT_INTO(ref SqlBuilder.ClauseStringHandler&lt;SqlClause.INSERT_INTO>)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   INSERT_INTO(ref SqlBuilder.ClauseStringHandler<SqlClause.INSERT_INTO> handler) =>\n      handler.Builder;\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the INSERT INTO clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The body of the INSERT INTO clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.INSERT_INTO(String)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   INSERT_INTO(string? text) =>\n      new SqlBuilder().INSERT_INTO(text);\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the UPDATE clause using the provided string interpolated <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The body of the UPDATE clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.UPDATE(ref SqlBuilder.ClauseStringHandler&lt;SqlClause.UPDATE>)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   UPDATE(ref SqlBuilder.ClauseStringHandler<SqlClause.UPDATE> handler) =>\n      handler.Builder;\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the UPDATE clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The body of the UPDATE clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.UPDATE(String)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   UPDATE(string? text) =>\n      new SqlBuilder().UPDATE(text);\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the DELETE FROM clause using the provided string interpolated <paramref name=\"handler\"/>.\n   /// </summary>\n   /// <param name=\"handler\">The body of the DELETE FROM clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.DELETE_FROM(ref SqlBuilder.ClauseStringHandler&lt;SqlClause.DELETE_FROM>)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   DELETE_FROM(ref SqlBuilder.ClauseStringHandler<SqlClause.DELETE_FROM> handler) =>\n      handler.Builder;\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the DELETE FROM clause using the provided <paramref name=\"text\"/>.\n   /// </summary>\n   /// <param name=\"text\">The body of the DELETE FROM clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.DELETE_FROM(String)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   DELETE_FROM(string? text) =>\n      new SqlBuilder().DELETE_FROM(text);\n\n   // Object Members\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public static new bool\n   Equals(object? objectA, object? objectB) =>\n      Object.Equals(objectA, objectB);\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public static new bool\n   ReferenceEquals(object? objectA, object? objectB) =>\n      Object.ReferenceEquals(objectA, objectB);\n}\n\n/// <summary>\n/// Provides information about a SQL clause. Used by <see cref=\"SqlBuilder\"/>.\n/// </summary>\n/// <param name=\"Name\">The name of the clause.</param>\n/// <param name=\"Separator\">The string to use for consecutive calls.</param>\n\npublic abstract record class SqlClause(string? Name, string? Separator) {\n\n   /// <summary>\n   /// The \"current\" clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class Current() : SqlClause(null, null);\n\n   /// <summary>\n   /// The WITH clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class WITH() : SqlClause(\"WITH\", null);\n\n   /// <summary>\n   /// The SELECT clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class SELECT() : SqlClause(\"SELECT\", \", \");\n\n   /// <summary>\n   /// The FROM clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class FROM() : SqlClause(\"FROM\", \", \");\n\n   /// <summary>\n   /// The JOIN clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class JOIN() : SqlClause(\"JOIN\", null);\n\n   /// <summary>\n   /// The LEFT JOIN clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class LEFT_JOIN() : SqlClause(\"LEFT JOIN\", null);\n\n   /// <summary>\n   /// The RIGHT JOIN clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class RIGHT_JOIN() : SqlClause(\"RIGHT JOIN\", null);\n\n   /// <summary>\n   /// The INNER JOIN clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class INNER_JOIN() : SqlClause(\"INNER JOIN\", null);\n\n   /// <summary>\n   /// The CROSS JOIN clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class CROSS_JOIN() : SqlClause(\"CROSS JOIN\", null);\n\n   /// <summary>\n   /// The WHERE clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class WHERE() : SqlClause(\"WHERE\", \" AND \");\n\n   /// <summary>\n   /// The GROUP BY clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class GROUP_BY() : SqlClause(\"GROUP BY\", \", \");\n\n   /// <summary>\n   /// The HAVING clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class HAVING() : SqlClause(\"HAVING\", \" AND \");\n\n   /// <summary>\n   /// The ORDER BY clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class ORDER_BY() : SqlClause(\"ORDER BY\", \", \");\n\n   /// <summary>\n   /// The LIMIT clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class LIMIT() : SqlClause(\"LIMIT\", null);\n\n   /// <summary>\n   /// The OFFSET clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class OFFSET() : SqlClause(\"OFFSET\", null);\n\n   /// <summary>\n   /// The UNION clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class UNION() : SqlClause(\"UNION\", null);\n\n   /// <summary>\n   /// The INSERT INTO clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class INSERT_INTO() : SqlClause(\"INSERT INTO\", null);\n\n   /// <summary>\n   /// The DELETE FROM clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class DELETE_FROM() : SqlClause(\"DELETE FROM\", null);\n\n   /// <summary>\n   /// The UPDATE clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class UPDATE() : SqlClause(\"UPDATE\", null);\n\n   /// <summary>\n   /// The SET clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class SET() : SqlClause(\"SET\", \", \");\n\n   /// <summary>\n   /// The VALUES clause.\n   /// </summary>\n   /// <exclude/>\n\n   public sealed record class VALUES() : SqlClause(\"VALUES\", \",\" +  Environment.NewLine);\n\n   /// <summary>\n   /// Gets a singleton instance of the clause identified by <typeparamref name=\"TClause\"/>.\n   /// </summary>\n   /// <typeparam name=\"TClause\">The type of the clause.</typeparam>\n   /// <returns>An instance of <typeparamref name=\"TClause\"/>.</returns>\n\n   public static TClause\n   Instance<TClause>() where TClause : SqlClause, new() =>\n      InstanceClass<TClause>.Value;\n\n   static class InstanceClass<TClause> where TClause : SqlClause, new() {\n\n      internal static readonly TClause\n      Value = new();\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/SqlSet.Async.cs",
    "content": "﻿// Copyright 2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace DbExtensions;\n\n#nullable enable\n\npartial class SqlSet {\n\n   private protected virtual IAsyncEnumerable<object>\n   AsyncMap(bool singleResult) {\n\n      var query = GetDefiningQuery(clone: false);\n      var results = default(IAsyncEnumerable<object>);\n\n      if (_resultType is not null) {\n\n         PocoAsyncMap(singleResult, query, ref results);\n\n         return results\n            ?? throw new InvalidOperationException(\"Cannot enumerate this set.\");\n      }\n\n      DynamicAsyncMap(singleResult, query, ref results);\n\n      return results\n         ?? throw new InvalidOperationException(\"Cannot enumerate this set unless you specify a result type.\");\n   }\n\n   partial void\n   PocoAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<object>? results);\n\n   partial void\n   DynamicAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<object>? results);\n\n   // ISqlSet Members\n\n   /// <inheritdoc cref=\"AsEnumerable()\"/>\n\n   public IAsyncEnumerable<object>\n   AsAsyncEnumerable() =>\n      AsAsyncEnumerable(singleResult: false);\n\n   IAsyncEnumerable<object>\n   AsAsyncEnumerable(bool singleResult) =>\n      AsyncMap(singleResult);\n\n   /// <inheritdoc cref=\"All(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   AllAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(predicate);\n\n      return !await AnyAsync(String.Concat(\"NOT (\", predicate, \")\"), cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"All(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   AllAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      var builder = predicate.Fragment;\n      builder.Buffer.Insert(0, \"NOT (\")\n         .Append(')');\n\n      return !await AnyAsync(predicate, cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Any()\"/>\n   /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> to monitor for cancellation requests. The default is <see cref=\"CancellationToken.None\"/>.</param>\n\n   public async ValueTask<bool>\n   AnyAsync(CancellationToken cancellationToken = default) {\n\n      var (query, mapFn) = AnyImplParams();\n\n      return await _db.AsyncMap(query, mapFn)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Any(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   AnyAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .AnyAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Any(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   AnyAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .AnyAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Count()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<int>\n   CountAsync(CancellationToken cancellationToken = default) {\n\n      var (query, mapFn) = CountImplParams();\n\n      return await _db.AsyncMap(query, mapFn)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Count(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<int>\n   CountAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .CountAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Count(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<int>\n   CountAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .CountAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"First()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   FirstAsync(CancellationToken cancellationToken = default) {\n\n      return await Take(1)\n         .AsAsyncEnumerable(singleResult: true)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"First(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   FirstAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"First(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   FirstAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"FirstOrDefault()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   FirstOrDefaultAsync(CancellationToken cancellationToken = default) {\n\n      return await Take(1)\n         .AsAsyncEnumerable(singleResult: true)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"FirstOrDefault(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   FirstOrDefaultAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"FirstOrDefault(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   FirstOrDefaultAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <summary>\n   /// Returns an async enumerator that iterates through the set.\n   /// </summary>\n   /// <returns>A <see cref=\"IAsyncEnumerator&lt;Object>\"/> for the set.</returns>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public IAsyncEnumerator<object>\n   GetAsyncEnumerator(CancellationToken cancellationToken = default) =>\n      AsAsyncEnumerable().GetAsyncEnumerator(cancellationToken);\n\n   /// <inheritdoc cref=\"LongCount()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<long>\n   LongCountAsync(CancellationToken cancellationToken = default) {\n\n      var (query, mapFn) = LongCountImplParams();\n\n      return await _db.AsyncMap(query, mapFn)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"LongCount(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<long>\n   LongCountAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .LongCountAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"LongCount(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<long>\n   LongCountAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .LongCountAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Single()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   SingleAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable(singleResult: true)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Single(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   SingleAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Single(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object>\n   SingleAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SingleOrDefault()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   SingleOrDefaultAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable(singleResult: true)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SingleOrDefault(String)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   SingleOrDefaultAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SingleOrDefault(ref OperatorStringHandler)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   SingleOrDefaultAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"ToArray()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object[]>\n   ToArrayAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable()\n         .ToArrayAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"ToList()\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<List<object>>\n   ToListAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable()\n         .ToListAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n\npartial class SqlSet<TResult> {\n\n   private protected override IAsyncEnumerable<object>\n   AsyncMap(bool singleResult) {\n\n      if (_explicitMapper is not null) {\n\n         return _db.AsyncMap(\n            GetDefiningQuery(clone: false),\n            r => (object)_explicitMapper.Invoke(r)!);\n      }\n\n      return base.AsyncMap(singleResult);\n   }\n\n   IAsyncEnumerable<TResult>\n   AsyncMapTyped(bool singleResult) {\n\n      var query = GetDefiningQuery(clone: false);\n\n      if (_explicitMapper is not null) {\n         return _db.AsyncMap(query, _explicitMapper);\n      }\n\n      var results = default(IAsyncEnumerable<TResult>);\n\n      PocoAsyncMap(singleResult, query, ref results);\n\n      return results\n         ?? throw new InvalidOperationException(\"Cannot enumerate this set.\");\n   }\n\n   partial void\n   PocoAsyncMap(bool singleResult, SqlBuilder query, ref IAsyncEnumerable<TResult>? results);\n\n   // ISqlSet Members\n\n   /// <inheritdoc cref=\"AsEnumerable()\"/>\n\n   public new IAsyncEnumerable<TResult>\n   AsAsyncEnumerable() =>\n      AsAsyncEnumerable(singleResult: false);\n\n   IAsyncEnumerable<TResult>\n   AsAsyncEnumerable(bool singleResult) =>\n      AsyncMapTyped(singleResult);\n\n   /// <inheritdoc cref=\"SqlSet.FirstAsync(CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   FirstAsync(CancellationToken cancellationToken = default) {\n\n      return await Take(1)\n         .AsAsyncEnumerable(singleResult: true)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.FirstAsync(String, CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   FirstAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.FirstAsync(OperatorStringHandler, CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   FirstAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .FirstAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefaultAsync(CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   FirstOrDefaultAsync(CancellationToken cancellationToken = default) {\n\n      return await Take(1)\n         .AsAsyncEnumerable(singleResult: true)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefaultAsync(String, CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   FirstOrDefaultAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefaultAsync(OperatorStringHandler, CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   FirstOrDefaultAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .FirstOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <summary>\n   /// Returns an async enumerator that iterates through the set.\n   /// </summary>\n   /// <returns>A <see cref=\"IAsyncEnumerator&lt;TResult>\"/> for the set.</returns>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public new IAsyncEnumerator<TResult>\n   GetAsyncEnumerator(CancellationToken cancellationToken = default) =>\n      AsAsyncEnumerable().GetAsyncEnumerator(cancellationToken);\n\n   /// <inheritdoc cref=\"SqlSet.SingleAsync(CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   SingleAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable(singleResult: true)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.SingleAsync(String, CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   SingleAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.SingleAsync(OperatorStringHandler, CancellationToken)\"/>\n\n   public new async ValueTask<TResult>\n   SingleAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .SingleAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefaultAsync(CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   SingleOrDefaultAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable(singleResult: true)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefaultAsync(String, CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   SingleOrDefaultAsync(string predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(predicate)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefaultAsync(OperatorStringHandler, CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   SingleOrDefaultAsync(OperatorStringHandler predicate, CancellationToken cancellationToken = default) {\n\n      return await Where(ref predicate)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.ToArrayAsync(CancellationToken)\"/>\n\n   public new async ValueTask<TResult[]>\n   ToArrayAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable()\n         .ToArrayAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"ToList()\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public new async ValueTask<List<TResult>>\n   ToListAsync(CancellationToken cancellationToken = default) {\n\n      return await AsAsyncEnumerable()\n         .ToListAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n\npartial interface ISqlSet<TSqlSet, TSource> {\n\n   ValueTask<bool>\n   AllAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<bool>\n   AllAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<bool>\n   AnyAsync(CancellationToken cancellationToken);\n\n   ValueTask<bool>\n   AnyAsync(string predicate, CancellationToken cancellationToken);\n\n   IAsyncEnumerable<TSource>\n   AsAsyncEnumerable();\n\n   ValueTask<int>\n   CountAsync(CancellationToken cancellationToken);\n\n   ValueTask<int>\n   CountAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<int>\n   CountAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   FirstAsync(CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   FirstAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   FirstAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   FirstOrDefaultAsync(CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   FirstOrDefaultAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   FirstOrDefaultAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   IAsyncEnumerator<TSource>\n   GetAsyncEnumerator(CancellationToken cancellationToken);\n\n   ValueTask<long>\n   LongCountAsync(CancellationToken cancellationToken);\n\n   ValueTask<long>\n   LongCountAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<long>\n   LongCountAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   SingleAsync(CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   SingleAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource>\n   SingleAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   SingleOrDefaultAsync(CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   SingleOrDefaultAsync(string predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource?>\n   SingleOrDefaultAsync(SqlSet.OperatorStringHandler predicate, CancellationToken cancellationToken);\n\n   ValueTask<TSource[]>\n   ToArrayAsync(CancellationToken cancellationToken);\n\n   ValueTask<List<TSource>>\n   ToListAsync(CancellationToken cancellationToken);\n}\n"
  },
  {
    "path": "src/DbExtensions/SqlSet.cs",
    "content": "﻿// Copyright 2012-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data.Common;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\n\nnamespace DbExtensions;\n\n#nullable enable\n\npartial class SqlBuilder {\n\n   /// <summary>\n   /// Appends the WITH clause using the provided <paramref name=\"subQuery\"/> as body named after\n   /// <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the WITH clause.</param>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   WITH(string alias, SqlSet subQuery) {\n\n      ArgumentNullException.ThrowIfNull(alias);\n      ArgumentNullException.ThrowIfNull(subQuery);\n\n      return WITH(alias, subQuery.GetDefiningQuery());\n   }\n\n   /// <summary>\n   /// Appends the FROM clause using the provided <paramref name=\"subQuery\"/> as body named after\n   /// <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the FROM clause.</param>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <returns>A reference to this instance after the append operation has completed.</returns>\n\n   public SqlBuilder\n   FROM(SqlSet subQuery, string alias) {\n\n      ArgumentNullException.ThrowIfNull(subQuery);\n      ArgumentNullException.ThrowIfNull(alias);\n\n      return FROM(subQuery.GetDefiningQuery(), alias);\n   }\n\n   static partial void\n   GetDefiningQueryFromObject(object? obj, ref SqlBuilder? definingQuery) =>\n      definingQuery = (obj as SqlSet)?.GetDefiningQuery();\n}\n\nstatic partial class SQL {\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlBuilder\"/> initialized by\n   /// appending the WITH clause using the provided <paramref name=\"subQuery\"/>\n   /// and <paramref name=\"alias\"/>.\n   /// </summary>\n   /// <param name=\"alias\">The alias of the sub-query.</param>\n   /// <param name=\"subQuery\">The sub-query to use as the body of the WITH clause.</param>\n   /// <returns>\n   /// A new <see cref=\"SqlBuilder\"/> after calling <see cref=\"SqlBuilder.WITH(string, SqlSet)\"/>.\n   /// </returns>\n\n   public static SqlBuilder\n   WITH(string alias, SqlSet subQuery) {\n\n      ArgumentNullException.ThrowIfNull(alias);\n      ArgumentNullException.ThrowIfNull(subQuery);\n\n      return new SqlBuilder().WITH(alias, subQuery);\n   }\n}\n\npartial class Database {\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlSet\"/> using the provided table name.\n   /// </summary>\n   /// <param name=\"tableName\">The name of the table that will be the source of data for the set.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> object.</returns>\n\n   public SqlSet\n   From(string tableName) =>\n      From(tableName, null);\n\n   /// <inheritdoc cref=\"From(String)\"/>\n   /// <param name=\"resultType\">The type of objects to map the results to.</param>\n\n   public SqlSet\n   From(string tableName, Type? resultType) {\n\n      ArgumentNullException.ThrowIfNull(tableName);\n\n      return new SqlSet([tableName, null], resultType, this);\n   }\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlSet&lt;TResult>\"/> using the provided table name.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type of objects to map the results to.</typeparam>\n   /// <param name=\"tableName\">The name of the table that will be the source of data for the set.</param>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> object.</returns>\n\n   public SqlSet<TResult>\n   From<TResult>(string tableName) {\n\n      ArgumentNullException.ThrowIfNull(tableName);\n\n      return new SqlSet<TResult>([tableName, null], this);\n   }\n\n   /// <summary>This method is used by auto-generated \"table\" classes.</summary>\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public SqlSet<TResult>\n   From<TResult>(string tableName, string columnList) {\n\n      ArgumentNullException.ThrowIfNull(tableName);\n\n      return new SqlSet<TResult>([tableName, columnList], this);\n   }\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlSet\"/> using the provided defining query.\n   /// </summary>\n   /// <param name=\"definingQuery\">The SQL query that will be the source of data for the set.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> object.</returns>\n\n   public SqlSet\n   FromQuery(SqlBuilder definingQuery) =>\n      FromQuery(definingQuery, null);\n\n   /// <inheritdoc cref=\"FromQuery(SqlBuilder)\"/>\n   /// <param name=\"resultType\">The type of objects to map the results to.</param>\n\n   public SqlSet\n   FromQuery(SqlBuilder definingQuery, Type? resultType) {\n\n      ArgumentNullException.ThrowIfNull(definingQuery);\n\n      return new SqlSet(definingQuery, resultType, this);\n   }\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlSet&lt;TResult>\"/> using the provided defining query.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type of objects to map the results to.</typeparam>\n   /// <param name=\"definingQuery\">The SQL query that will be the source of data for the set.</param>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> object.</returns>\n\n   public SqlSet<TResult>\n   FromQuery<TResult>(SqlBuilder definingQuery) {\n\n      ArgumentNullException.ThrowIfNull(definingQuery);\n\n      return new SqlSet<TResult>(definingQuery, this);\n   }\n\n   /// <summary>\n   /// Creates and returns a new <see cref=\"SqlSet&lt;TResult>\"/> using the provided defining query and mapper.\n   /// </summary>\n   /// <inheritdoc cref=\"FromQuery&lt;TResult>(SqlBuilder)\"/>\n   /// <param name=\"mapper\">A custom mapper function that creates <typeparamref name=\"TResult\"/> instances from the rows in the set.</param>\n\n   public SqlSet<TResult>\n   FromQuery<TResult>(SqlBuilder definingQuery, Func<DbDataReader, TResult> mapper) {\n\n      ArgumentNullException.ThrowIfNull(definingQuery);\n      ArgumentNullException.ThrowIfNull(mapper);\n\n      return new SqlSet<TResult>(definingQuery, mapper, this);\n   }\n}\n\n/// <summary>\n/// Represents an immutable, connected SQL query.\n/// This class cannot be instantiated, to get an instance use one of the\n/// <see cref=\"Database.From(String)\" qualifyHint=\"true\" autoUpgrade=\"true\"/> or\n/// <see cref=\"Database.FromQuery(SqlBuilder)\" qualifyHint=\"true\" autoUpgrade=\"true\"/> overloads.\n/// </summary>\n/// <remarks>For information on how to use SqlSet see <see href=\"https://maxtoroq.github.io/DbExtensions/docs/7/SqlSet.html\">SqlSet Tutorial</see>.</remarks>\n\npublic partial class SqlSet : ISqlSet<SqlSet, object> {\n\n   // definingQuery should NEVER be modified\n\n   readonly SqlBuilder?\n   _definingQuery;\n\n   readonly string?[]?\n   _fromSelect;\n\n   readonly Type?\n   _resultType;\n\n   readonly SqlBuffer\n   _buffer;\n\n   private protected readonly Database\n   _db;\n\n   readonly int\n   _setIndex = 1;\n\n   /// <summary>\n   /// The type of objects this set returns. This property can be null.\n   /// </summary>\n\n   public Type?\n   ResultType => _resultType;\n\n   /// <summary>\n   /// The <see cref=\"DbExtensions.Database\"/> this set is connected to.\n   /// </summary>\n\n   public Database\n   Database => _db;\n\n   internal\n   SqlSet(SqlBuilder definingQuery, Type? resultType, Database db) {\n\n      _definingQuery = definingQuery.Clone();\n      _resultType = resultType;\n      _db = db;\n   }\n\n   internal\n   SqlSet(string?[] fromSelect, Type? resultType, Database db) {\n\n      Debug.Assert(fromSelect.Length == 2);\n\n      _fromSelect = fromSelect;\n      _resultType = resultType;\n      _db = db;\n   }\n\n   private protected\n   SqlSet(SqlSet set, SqlBuilder superQuery, Type? resultType, SqlBuffer? buffer)\n      : this(set, resultType, buffer) {\n\n      _definingQuery = superQuery;\n   }\n\n   private protected\n   SqlSet(SqlSet set, string?[] fromSelect, Type? resultType, SqlBuffer? buffer)\n      : this(set, resultType, buffer) {\n\n      Debug.Assert(fromSelect.Length == 2);\n\n      _fromSelect = fromSelect;\n   }\n\n   private\n   SqlSet(SqlSet set, Type? resultType, SqlBuffer? buffer) {\n\n      _resultType = resultType ?? set._resultType;\n      _setIndex += set._setIndex;\n      _db = set._db;\n\n      if (buffer is not null) {\n         _buffer = buffer.Value;\n      }\n\n      Initialize2(set);\n   }\n\n   partial void\n   Initialize2(SqlSet set);\n\n   /// <summary>\n   /// Returns the SQL query that is the source of data for the set.\n   /// </summary>\n   /// <returns>The SQL query that is the source of data for the set</returns>\n\n   public SqlBuilder\n   GetDefiningQuery() =>\n      GetDefiningQuery(clone: true);\n\n   private protected SqlBuilder\n   GetDefiningQuery(bool clone = true, bool ignoreBuffer = false, bool super = false, ISqlFragment? select = null) {\n\n      if (!ignoreBuffer\n         && _buffer.HasValue) {\n\n         return BuildQuery(select);\n      }\n\n      var query = _definingQuery;\n\n      if (query is null) {\n\n         Debug.Assert(_fromSelect is not null);\n\n         query = new SqlBuilder()\n            .SELECT(String.Empty);\n\n         if (select is not null) {\n            query.AppendFragment(select);\n         } else {\n            query.Append(_fromSelect[1] ?? \"*\");\n         }\n\n         query.FROM(_fromSelect[0]);\n\n      } else if (super || select is not null) {\n\n         query = CreateSuperQuery(query, select);\n\n      } else if (clone) {\n\n         query = query.Clone();\n      }\n\n      return query;\n   }\n\n   SqlBuilder\n   BuildQuery(ISqlFragment? select) {\n\n      switch (_db.Configuration.SqlDialect) {\n         case SqlDialect.Default:\n            return BuildQuery_Default(select);\n\n         case SqlDialect.TSql:\n            return BuildQuery_TSql(select);\n\n         default:\n            throw new NotImplementedException();\n      }\n   }\n\n   SqlBuilder\n   BuildQuery_Default(ISqlFragment? select) {\n\n      var whereBuffer = _buffer.Where;\n      var orderByBuffer = _buffer.OrderBy;\n      var skipBuffer = _buffer.Skip;\n      var takeBuffer = _buffer.Take;\n\n      var hasWhere = whereBuffer is not null;\n      var hasOrderBy = orderByBuffer is not null;\n      var hasSkip = skipBuffer.HasValue;\n      var hasTake = takeBuffer.HasValue;\n\n      var query = GetDefiningQuery(ignoreBuffer: true, super: true, select: select);\n\n      if (hasWhere) {\n         query.WHERE(String.Empty)\n            .AppendFragment(whereBuffer!);\n      }\n\n      if (hasOrderBy) {\n         query.ORDER_BY(String.Empty)\n            .AppendFragment(orderByBuffer!);\n      }\n\n      if (hasTake) {\n         query.LIMIT(takeBuffer!.Value);\n      }\n\n      if (hasSkip) {\n         query.OFFSET(skipBuffer!.Value);\n      }\n\n      return query;\n   }\n\n   SqlBuilder\n   BuildQuery_TSql(ISqlFragment? select) {\n\n      var whereBuffer = _buffer.Where;\n      var orderByBuffer = _buffer.OrderBy;\n      var skipBuffer = _buffer.Skip;\n      var takeBuffer = _buffer.Take;\n\n      var hasWhere = whereBuffer is not null;\n      var hasOrderBy = orderByBuffer is not null;\n      var hasSkip = skipBuffer.HasValue;\n      var hasTake = takeBuffer.HasValue;\n\n      if (hasSkip) {\n\n         var query = GetDefiningQuery(ignoreBuffer: true, super: true, select: select);\n\n         if (hasWhere) {\n            query.WHERE(String.Empty)\n               .AppendFragment(whereBuffer!);\n         }\n\n         if (hasOrderBy) {\n\n            query.ORDER_BY(String.Empty)\n               .AppendFragment(orderByBuffer!);\n\n         } else {\n\n            // Cannot have OFFSET without ORDER BY\n            query.ORDER_BY(\"1\");\n         }\n\n         query.OFFSET($\"{skipBuffer!.Value} ROWS\");\n\n         if (hasTake) {\n            query.AppendClause<FetchClause>()\n               .Append($\"NEXT {takeBuffer!.Value} ROWS ONLY\");\n         }\n\n         return query;\n\n      } else if (hasTake) {\n\n         var topSelect = new SqlFragment(\"TOP({0}) *\", (object[])[takeBuffer!.Value]);\n\n         var query = GetDefiningQuery(ignoreBuffer: true, super: true, select: topSelect);\n\n         if (hasWhere) {\n            query.WHERE(String.Empty)\n               .AppendFragment(whereBuffer!);\n         }\n\n         if (hasOrderBy) {\n            query.ORDER_BY(String.Empty)\n               .AppendFragment(orderByBuffer!);\n         }\n\n         if (select is not null) {\n\n            // SELECT must be done in super query, it could remove columns used by WHERE/ORDER BY\n\n            query = CreateSuperQuery(query, select);\n         }\n\n         return query;\n\n      } else {\n\n         var query = GetDefiningQuery(ignoreBuffer: true, super: true, select: select);\n\n         if (hasWhere) {\n            query.WHERE(String.Empty)\n               .AppendFragment(whereBuffer!);\n         }\n\n         if (hasOrderBy) {\n\n            query.ORDER_BY(String.Empty)\n               .AppendFragment(orderByBuffer!);\n\n            // The ORDER BY clause is invalid in subqueries, unless TOP, OFFSET or FOR XML is also specified.\n\n            query.OFFSET(\"0 ROWS\");\n         }\n\n         return query;\n      }\n   }\n\n   SqlBuilder\n   CreateSuperQuery(SqlBuilder query, ISqlFragment? select) {\n\n      var superQuery = new SqlBuilder()\n         .SELECT(String.Empty);\n\n      if (select is not null) {\n         superQuery.AppendFragment(select);\n      } else {\n         superQuery.Buffer.Append('*');\n      }\n\n      superQuery.FROM(query, $\"dbex_set{_setIndex}\");\n\n      return superQuery;\n   }\n\n   private protected virtual SqlSet\n   CreateSet(SqlBuilder superQuery, Type? resultType = null, SqlBuffer? buffer = null) =>\n      new SqlSet(this, superQuery, resultType, buffer);\n\n   private protected virtual SqlSet\n   CreateSet(string?[] fromSelect, Type? resultType = null, SqlBuffer? buffer = null) =>\n      new SqlSet(this, fromSelect, resultType, buffer);\n\n   SqlSet<TResult>\n   CreateSet<TResult>(SqlBuilder superQuery, Func<DbDataReader, TResult>? mapper = null, SqlBuffer? buffer = null) =>\n      new SqlSet<TResult>(this, superQuery, mapper, buffer);\n\n   SqlSet<TResult>\n   CreateSet<TResult>(string?[] fromSelect, SqlBuffer? buffer = null) =>\n      new SqlSet<TResult>(this, fromSelect, buffer);\n\n   private protected SqlSet\n   Clone() =>\n      CreateBufferedSet(ignoreBuffer: true, buffer: _buffer);\n\n   SqlSet\n   CreateBufferedSet(bool ignoreBuffer, SqlBuffer buffer, Type? resultType = null) {\n\n      if (ignoreBuffer\n         && _definingQuery is null) {\n\n         Debug.Assert(_fromSelect is not null);\n\n         return CreateSet(_fromSelect, resultType, buffer);\n      }\n\n      var query = GetDefiningQuery(ignoreBuffer: ignoreBuffer);\n\n      return CreateSet(query, resultType, buffer);\n   }\n\n   SqlSet<TResult>\n   CreateBufferedSet<TResult>(bool ignoreBuffer, SqlBuffer buffer) {\n\n      if (ignoreBuffer\n         && _definingQuery is null) {\n\n         Debug.Assert(_fromSelect is not null);\n\n         return CreateSet<TResult>(_fromSelect, buffer);\n      }\n\n      var query = GetDefiningQuery(ignoreBuffer: ignoreBuffer);\n\n      return CreateSet<TResult>(query, default(Func<DbDataReader, TResult>), buffer);\n   }\n\n   private protected virtual IEnumerable\n   Map(bool singleResult) {\n\n      var query = GetDefiningQuery(clone: false);\n      var results = default(IEnumerable<object>);\n\n      if (_resultType is not null) {\n\n         PocoMap(singleResult, query, ref results);\n\n         return results\n            ?? throw new InvalidOperationException(\"Cannot enumerate this set.\");\n      }\n\n      DynamicMap(singleResult, query, ref results);\n\n      return results\n         ?? throw new InvalidOperationException(\"Cannot enumerate this set unless you specify a result type.\");\n   }\n\n   partial void\n   PocoMap(bool singleResult, SqlBuilder query, ref IEnumerable<object>? results);\n\n   partial void\n   DynamicMap(bool singleResult, SqlBuilder query, ref IEnumerable<object>? results);\n\n   // ISqlSet Members\n\n   /// <summary>\n   /// Determines whether all elements of the set satisfy a condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns><c>true</c> if every element of the set passes the test in the specified <paramref name=\"predicate\"/>, or if the set is empty; otherwise, <c>false</c>.</returns>\n\n   public bool\n   All(string predicate) {\n\n      ArgumentNullException.ThrowIfNull(predicate);\n\n      return !Any(String.Concat(\"NOT (\", predicate, \")\"));\n   }\n\n   /// <inheritdoc cref=\"All(String)\"/>\n\n   public bool\n   All(ref OperatorStringHandler predicate) {\n\n      var builder = predicate.Fragment;\n      builder.Buffer.Insert(0, \"NOT (\")\n         .Append(')');\n\n      return !Any(ref predicate);\n   }\n\n   /// <summary>\n   /// Determines whether the set contains any elements.\n   /// </summary>\n   /// <returns><c>true</c> if the sequence contains any elements; otherwise, <c>false</c>.</returns>\n\n   public bool\n   Any() {\n\n      var (query, mapFn) = AnyImplParams();\n\n      return _db.Map(query, mapFn)\n         .SingleOrDefault();\n   }\n\n   (SqlBuilder, Func<DbDataReader, bool>)\n   AnyImplParams() {\n\n      var query = new SqlBuilder()\n         .SELECT($\"(CASE WHEN EXISTS ({GetDefiningQuery(clone: false)}) THEN 1 ELSE 0 END)\");\n\n      return (query, mapFn);\n\n      static bool mapFn(DbDataReader r) =>\n         Convert.ToInt32(r[0], CultureInfo.InvariantCulture) != 0;\n   }\n\n   /// <summary>\n   /// Determines whether any element of the set satisfies a condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns><c>true</c> if any elements in the set pass the test in the specified <paramref name=\"predicate\"/>; otherwise, <c>false</c>.</returns>\n\n   public bool\n   Any(string predicate) =>\n      Where(predicate).Any();\n\n   /// <inheritdoc cref=\"Any(String)\"/>\n\n   public bool\n   Any(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).Any();\n\n   /// <summary>\n   /// Gets all elements in the set. The query is deferred-executed.\n   /// </summary>\n   /// <returns>All elements in the set.</returns>\n\n   public IEnumerable<object>\n   AsEnumerable() =>\n      AsEnumerable(singleResult: false);\n\n   IEnumerable<object>\n   AsEnumerable(bool singleResult) =>\n      Map(singleResult).Cast<object>();\n\n   /// <summary>\n   /// Casts the elements of the set to the specified type.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type to cast the elements of the set to.</typeparam>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> that contains each element of the current set cast to the specified type.</returns>\n\n   public SqlSet<TResult>\n   Cast<TResult>() {\n\n      if (_resultType is not null\n         && _resultType != typeof(TResult)) {\n\n         throw new InvalidOperationException(\"The specified type parameter is not valid for this instance.\");\n      }\n\n      return CreateBufferedSet<TResult>(ignoreBuffer: true, buffer: _buffer);\n   }\n\n   /// <summary>\n   /// Casts the elements of the set to the specified type.\n   /// </summary>\n   /// <param name=\"resultType\">The type to cast the elements of the set to.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> that contains each element of the current set cast to the specified type.</returns>\n\n   public SqlSet\n   Cast(Type resultType) {\n\n      ArgumentNullException.ThrowIfNull(resultType);\n\n      if (_resultType is not null\n         && _resultType != resultType) {\n\n         throw new InvalidOperationException(\"The specified resultType is not valid for this instance.\");\n      }\n\n      return CreateBufferedSet(ignoreBuffer: true, buffer: _buffer, resultType: resultType);\n   }\n\n   /// <summary>\n   /// Returns the number of elements in the set.\n   /// </summary>\n   /// <returns>The number of elements in the set.</returns>\n   /// <exception cref=\"System.OverflowException\">The number of elements is larger than <see cref=\"Int32.MaxValue\"/>.</exception>      \n\n   public int\n   Count() {\n\n      var (query, mapFn) = CountImplParams();\n\n      return _db.Map(query, mapFn)\n         .SingleOrDefault();\n   }\n\n   /// <summary>\n   /// Returns a number that represents how many elements in the set satisfy a condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>A number that represents how many elements in the set satisfy the condition in the <paramref name=\"predicate\"/>.</returns>\n   /// <exception cref=\"System.OverflowException\">The number of matching elements exceeds <see cref=\"Int32.MaxValue\"/>.</exception>      \n\n   public int\n   Count(string predicate) =>\n      Where(predicate).Count();\n\n   /// <inheritdoc cref=\"Count(String)\"/>\n\n   public int\n   Count(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).Count();\n\n   (SqlBuilder, Func<DbDataReader, int>)\n   CountImplParams() {\n\n      var query = new SqlBuilder()\n         .SELECT(\"COUNT(*)\")\n         .FROM(GetDefiningQuery(clone: false), \"dbex_count\");\n\n      return (query, mapFn);\n\n      static int mapFn(DbDataReader r) =>\n         Convert.ToInt32(!r.IsDBNull(0) ? r.GetValue(0) : null, CultureInfo.InvariantCulture);\n   }\n\n   /// <summary>\n   /// Returns the first element of the set.\n   /// </summary>\n   /// <returns>The first element in the set.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">The set is empty.</exception>\n\n   public object\n   First() =>\n      Take(1).AsEnumerable(singleResult: true).First();\n\n   /// <summary>\n   /// Returns the first element in the set that satisfies a specified condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>The first element in the set that passes the test in the specified <paramref name=\"predicate\"/>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">No element satisfies the condition in <paramref name=\"predicate\"/>.-or-The set is empty.</exception>\n\n   public object\n   First(string predicate) =>\n      Where(predicate).First();\n\n   /// <inheritdoc cref=\"First(String)\"/>\n\n   public object\n   First(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).First();\n\n   /// <summary>\n   /// Returns the first element of the set, or a default value if the set contains no elements.\n   /// </summary>\n   /// <returns>A default value if the set is empty; otherwise, the first element.</returns>\n\n   public object?\n   FirstOrDefault() =>\n      Take(1).AsEnumerable(singleResult: true).FirstOrDefault();\n\n   /// <summary>\n   /// Returns the first element of the set that satisfies a condition or a default value if no such element is found.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>\n   /// A default value if the set is empty or if no element passes the test specified by <paramref name=\"predicate\"/>; otherwise, the \n   /// first element that passes the test specified by <paramref name=\"predicate\"/>.\n   /// </returns>\n\n   public object?\n   FirstOrDefault(string predicate) =>\n      Where(predicate).FirstOrDefault();\n\n   /// <inheritdoc cref=\"FirstOrDefault(String)\"/>\n\n   public object?\n   FirstOrDefault(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).FirstOrDefault();\n\n   /// <summary>\n   /// Returns an enumerator that iterates through the set.\n   /// </summary>\n   /// <returns>A <see cref=\"IEnumerator&lt;Object>\"/> for the set.</returns>\n\n   public IEnumerator<object>\n   GetEnumerator() =>\n      AsEnumerable().GetEnumerator();\n\n   /// <summary>\n   /// Returns an <see cref=\"System.Int64\"/> that represents the total number of elements in the set.\n   /// </summary>\n   /// <returns>The number of elements in the set.</returns>\n   /// <exception cref=\"System.OverflowException\">The number of elements is larger than <see cref=\"Int64.MaxValue\"/>.</exception>      \n\n   public long\n   LongCount() {\n\n      var (query, mapFn) = LongCountImplParams();\n\n      return _db.Map(query, mapFn)\n         .SingleOrDefault();\n   }\n\n   /// <summary>\n   /// Returns an <see cref=\"System.Int64\"/> that represents how many elements in the set satisfy a condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>A number that represents how many elements in the set satisfy the condition in the <paramref name=\"predicate\"/>.</returns>\n   /// <exception cref=\"System.OverflowException\">The number of matching elements exceeds <see cref=\"Int64.MaxValue\"/>.</exception>      \n\n   public long\n   LongCount(string predicate) =>\n      Where(predicate).LongCount();\n\n   /// <inheritdoc cref=\"LongCount(String)\"/>\n\n   public long\n   LongCount(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).LongCount();\n\n   (SqlBuilder, Func<DbDataReader, long>)\n   LongCountImplParams() {\n\n      var query = new SqlBuilder()\n         .SELECT(\"COUNT(*)\")\n         .FROM(GetDefiningQuery(clone: false), \"dbex_count\");\n\n      return (query, mapFn);\n\n      static long mapFn(DbDataReader r) =>\n         Convert.ToInt64(!r.IsDBNull(0) ? r.GetValue(0) : null, CultureInfo.InvariantCulture);\n   }\n\n   /// <summary>\n   /// Sorts the elements of the set according to the <paramref name=\"columnList\"/>.\n   /// </summary>\n   /// <param name=\"columnList\">The list of columns to base the sort on.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> whose elements are sorted according to <paramref name=\"columnList\"/>.</returns>\n\n   public SqlSet\n   OrderBy(string columnList) {\n\n      ArgumentNullException.ThrowIfNull(columnList);\n\n      return OrderBy(new SqlFragment(columnList));\n   }\n\n   /// <inheritdoc cref=\"OrderBy(String)\"/>\n\n   public SqlSet\n   OrderBy(ref OperatorStringHandler columnList) =>\n      OrderBy(columnList.Fragment);\n\n   SqlSet\n   OrderBy(ISqlFragment fragment) {\n\n      var ignoreBuffer = _buffer.OrderBy is null\n         && _buffer.Skip is null\n         && _buffer.Take is null;\n\n      var newBuffer = new SqlBuffer(\n         Where: (ignoreBuffer) ? _buffer.Where : null,\n         OrderBy: fragment);\n\n      var set = CreateBufferedSet(ignoreBuffer, newBuffer);\n\n      return set;\n   }\n\n   /// <summary>\n   /// Projects each element of the set into a new form.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type that <paramref name=\"columnList\"/> maps to.</typeparam>\n   /// <param name=\"columnList\">The list of columns that maps to properties on <typeparamref name=\"TResult\"/>.</param>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/>.</returns>\n\n   public SqlSet<TResult>\n   Select<TResult>(string columnList) {\n\n      ArgumentNullException.ThrowIfNull(columnList);\n\n      return CreateSet<TResult>(GetDefiningQuery(select: new SqlFragment(columnList)));\n   }\n\n   /// <inheritdoc cref=\"Select&lt;TResult>(String)\"/>\n\n   public SqlSet<TResult>\n   Select<TResult>(ref OperatorStringHandler columnList) =>\n      CreateSet<TResult>(GetDefiningQuery(select: columnList.Fragment));\n\n   /// <summary>\n   /// Projects each element of the set into a new form.\n   /// </summary>\n   /// <typeparam name=\"TResult\">The type that <paramref name=\"mapper\"/> returns.</typeparam>\n   /// <param name=\"columnList\">The list of columns that are used by <paramref name=\"mapper\"/>.</param>\n   /// <param name=\"mapper\">A custom mapper function that creates <typeparamref name=\"TResult\"/> instances from the rows in the set.</param>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/>.</returns>\n\n   public SqlSet<TResult>\n   Select<TResult>(string columnList, Func<DbDataReader, TResult> mapper) {\n\n      ArgumentNullException.ThrowIfNull(mapper);\n      ArgumentNullException.ThrowIfNull(columnList);\n\n      return CreateSet<TResult>(GetDefiningQuery(select: new SqlFragment(columnList)), mapper);\n   }\n\n   /// <inheritdoc cref=\"Select&lt;TResult>(String, Func&lt;DbDataReader, TResult>)\"/>\n\n   public SqlSet<TResult>\n   Select<TResult>(ref OperatorStringHandler columnList, Func<DbDataReader, TResult> mapper) {\n\n      ArgumentNullException.ThrowIfNull(mapper);\n\n      return CreateSet<TResult>(GetDefiningQuery(select: columnList.Fragment), mapper);\n   }\n\n   /// <summary>\n   /// Projects each element of the set into a new form.\n   /// </summary>\n   /// <param name=\"columnList\">The list of columns that maps to properties on <paramref name=\"resultType\"/>.</param>\n   /// <param name=\"resultType\">The type that <paramref name=\"columnList\"/> maps to.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/>.</returns>\n\n   public SqlSet\n   Select(string columnList, Type resultType) {\n\n      ArgumentNullException.ThrowIfNull(resultType);\n      ArgumentNullException.ThrowIfNull(columnList);\n\n      return CreateSet(GetDefiningQuery(select: new SqlFragment(columnList)), resultType);\n   }\n\n   /// <inheritdoc cref=\"Select(String, Type)\"/>\n\n   public SqlSet\n   Select(ref OperatorStringHandler columnList, Type resultType) {\n\n      ArgumentNullException.ThrowIfNull(resultType);\n\n      return CreateSet(GetDefiningQuery(select: columnList.Fragment), resultType);\n   }\n\n   /// <summary>\n   /// Projects each element of the set into a new form.\n   /// </summary>\n   /// <param name=\"columnList\">The list of columns to select.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/>.</returns>\n\n   public SqlSet\n   Select(string columnList) {\n\n      ArgumentNullException.ThrowIfNull(columnList);\n\n      return CreateSet(GetDefiningQuery(select: new SqlFragment(columnList)));\n   }\n\n   /// <inheritdoc cref=\"Select(String)\"/>\n\n   public SqlSet\n   Select(ref OperatorStringHandler columnList) =>\n      CreateSet(GetDefiningQuery(select: columnList.Fragment));\n\n   /// <summary>\n   /// The single element of the set.\n   /// </summary>\n   /// <returns>The single element of the set.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">The set contains more than one element.-or-The set is empty.</exception>      \n\n   public object\n   Single() =>\n      AsEnumerable(singleResult: true).Single();\n\n   /// <summary>\n   /// Returns the only element of the set that satisfies a specified condition, and throws an exception if more than one such element exists.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>The single element of the set that passes the test in the specified <paramref name=\"predicate\"/>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">No element satisfies the condition in <paramref name=\"predicate\"/>.-or-More than one element satisfies the condition in <paramref name=\"predicate\"/>.-or-The set is empty.</exception>      \n\n   public object\n   Single(string predicate) =>\n      Where(predicate).Single();\n\n   /// <inheritdoc cref=\"Single(String)\"/>\n\n   public object\n   Single(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).Single();\n\n   /// <summary>\n   /// Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.\n   /// </summary>\n   /// <returns>The single element of the set, or a default value if the set contains no elements.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">The set contains more than one element.</exception>\n\n   public object?\n   SingleOrDefault() =>\n      AsEnumerable(singleResult: true).SingleOrDefault();\n\n   /// <summary>\n   /// Returns the only element of the set that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>The single element of the set that satisfies the condition, or a default value if no such element is found.</returns>\n\n   public object?\n   SingleOrDefault(string predicate) =>\n      Where(predicate).SingleOrDefault();\n\n   /// <inheritdoc cref=\"SingleOrDefault(String)\"/>\n\n   public object?\n   SingleOrDefault(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).SingleOrDefault();\n\n   /// <summary>\n   /// Bypasses a specified number of elements in the set and then returns the remaining elements.\n   /// </summary>\n   /// <param name=\"count\">The number of elements to skip before returning the remaining elements.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> that contains the elements that occur after the specified index in the current set.</returns>\n\n   public SqlSet\n   Skip(int count) {\n\n      var ignoreBuffer = _buffer.Skip is null\n         && _buffer.Take is null;\n\n      var newBuffer = new SqlBuffer(\n         Where: (ignoreBuffer) ? _buffer.Where : null,\n         OrderBy: (ignoreBuffer) ? _buffer.OrderBy : null,\n         Skip: count);\n\n      var set = CreateBufferedSet(ignoreBuffer, newBuffer);\n\n      return set;\n   }\n\n   /// <summary>\n   /// Returns a specified number of contiguous elements from the start of the set.\n   /// </summary>\n   /// <param name=\"count\">The number of elements to return.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> that contains the specified number of elements from the start of the current set.</returns>\n\n   public SqlSet\n   Take(int count) {\n\n      var ignoreBuffer = _buffer.Take is null;\n\n      var newBuffer = new SqlBuffer(\n         Where: (ignoreBuffer) ? _buffer.Where : null,\n         OrderBy: (ignoreBuffer) ? _buffer.OrderBy : null,\n         Skip: (ignoreBuffer) ? _buffer.Skip : null,\n         Take: count);\n\n      var set = CreateBufferedSet(ignoreBuffer, newBuffer);\n\n      return set;\n   }\n\n   /// <summary>\n   /// Creates an array from the set.\n   /// </summary>\n   /// <returns>An array that contains the elements from the set.</returns>\n\n   public object[]\n   ToArray() => AsEnumerable().ToArray();\n\n   /// <summary>\n   /// Creates a <see cref=\"List&lt;Object>\"/> from the set.\n   /// </summary>\n   /// <returns>A <see cref=\"List&lt;Object>\"/> that contains elements from the set.</returns>\n\n   public List<object>\n   ToList() => AsEnumerable().ToList();\n\n   /// <summary>\n   /// Filters the set based on a predicate.\n   /// </summary>\n   /// <param name=\"predicate\">A SQL expression to test each row for a condition.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> that contains elements from the current set that satisfy the condition.</returns>\n\n   public SqlSet\n   Where(string predicate) {\n\n      ArgumentNullException.ThrowIfNull(predicate);\n\n      return Where(new SqlFragment(predicate));\n   }\n\n   /// <inheritdoc cref=\"Where(String)\"/>\n\n   public SqlSet\n   Where(ref OperatorStringHandler predicate) =>\n      Where(predicate.Fragment);\n\n   SqlSet\n   Where(ISqlFragment fragment) {\n\n      var ignoreBuffer = _buffer.Where is null\n         && _buffer.OrderBy is null\n         && _buffer.Skip is null\n         && _buffer.Take is null;\n\n      var newBuffer = new SqlBuffer(Where: fragment);\n\n      var set = CreateBufferedSet(ignoreBuffer, newBuffer);\n\n      return set;\n   }\n\n   // Object Members\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public override bool\n   Equals(object? obj) => base.Equals(obj);\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public override int\n   GetHashCode() => base.GetHashCode();\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new Type\n   GetType() => base.GetType();\n\n   /// <summary>\n   /// Returns the SQL query of the set.\n   /// </summary>\n   /// <returns>The SQL query of the set.</returns>\n\n   public override string\n   ToString() =>\n      GetDefiningQuery(clone: false).ToString();\n\n   internal record struct SqlBuffer(ISqlFragment? Where = null, ISqlFragment? OrderBy = null, int? Skip = null, int? Take = null) {\n\n      public bool\n      HasValue =>\n         Where is not null\n            || OrderBy is not null\n            || Skip is not null\n            || Take is not null;\n   }\n\n   sealed class SqlFragment(string text, IList<object?>? parameters = null) : ISqlFragment {\n\n      public IList<object?>\n      ParameterValues { get; } = parameters ?? Array.Empty<object?>();\n\n      public override string\n      ToString() => text;\n   }\n\n   sealed record class FetchClause() : SqlClause(\"FETCH\", null);\n\n   /// <exclude/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   [InterpolatedStringHandler]\n   public struct OperatorStringHandler {\n\n      readonly SqlBuilder\n      _builder;\n\n      internal SqlBuilder\n      Fragment => _builder;\n\n      /// <exclude/>\n\n      public\n      OperatorStringHandler(int literalLength, int formattedCount) {\n         _builder = new SqlBuilder(literalLength, formattedCount);\n      }\n\n      /// <exclude/>\n\n      public void\n      AppendLiteral(string value) =>\n         _builder.Buffer.Append(value);\n\n      /// <exclude/>\n\n      public void\n      AppendFormatted(object? value, int alignment = 0, string? format = null) =>\n         _builder.AppendPlaceholder(value, format);\n   }\n}\n\n/// <summary>\n/// Represents an immutable, connected SQL query that maps to <typeparamref name=\"TResult\"/> objects.\n/// This class cannot be instantiated, to get an instance use one of the\n/// <see cref=\"Database.From&lt;TResult>(String)\" qualifyHint=\"true\"/> or\n/// <see cref=\"Database.FromQuery&lt;TResult>(SqlBuilder)\" qualifyHint=\"true\"/> overloads.\n/// </summary>\n/// <typeparam name=\"TResult\">The type of objects to map the results to.</typeparam>\n/// <inheritdoc path=\"remarks\"/>\n\npublic partial class SqlSet<TResult> : SqlSet, ISqlSet<SqlSet<TResult>, TResult> {\n\n   readonly Func<DbDataReader, TResult>?\n   _explicitMapper;\n\n   internal\n   SqlSet(SqlBuilder definingQuery, Database db)\n      : base(definingQuery, typeof(TResult), db) { }\n\n   internal\n   SqlSet(SqlBuilder definingQuery, Func<DbDataReader, TResult> mapper, Database db)\n      : base(definingQuery, typeof(TResult), db) {\n\n      _explicitMapper = mapper;\n   }\n\n   internal\n   SqlSet(string?[] fromSelect, Database db)\n      : base(fromSelect, typeof(TResult), db) { }\n\n   // These two SHOULD NOT pass TResult to base ctor\n   // result type is copied from set\n\n   private\n   SqlSet(SqlSet<TResult> set, SqlBuilder superQuery, SqlBuffer? buffer)\n      : base((SqlSet)set, superQuery, default(Type), buffer) {\n\n      _explicitMapper = set._explicitMapper;\n   }\n\n   private\n   SqlSet(SqlSet<TResult> set, string?[] fromSelect, SqlBuffer? buffer)\n      : base((SqlSet)set, fromSelect, default(Type), buffer) {\n\n      _explicitMapper = set._explicitMapper;\n   }\n\n   // These two SHOULD pass TResult to base ctor\n\n   internal\n   SqlSet(SqlSet set, SqlBuilder superQuery, Func<DbDataReader, TResult>? mapper, SqlBuffer? buffer)\n      : base(set, superQuery, typeof(TResult), buffer) {\n\n      if (mapper is not null) {\n         _explicitMapper = mapper;\n      }\n   }\n\n   internal\n   SqlSet(SqlSet set, string?[] fromSelect, SqlBuffer? buffer)\n      : base(set, fromSelect, typeof(TResult), buffer) { }\n\n   private protected override SqlSet\n   CreateSet(SqlBuilder superQuery, Type? resultType = null, SqlBuffer? buffer = null) {\n\n      if (resultType is not null) {\n         return base.CreateSet(superQuery, resultType, buffer);\n      }\n\n      return new SqlSet<TResult>(this, superQuery, buffer);\n   }\n\n   private protected override SqlSet\n   CreateSet(string?[] fromSelect, Type? resultType = null, SqlBuffer? buffer = null) {\n\n      if (resultType is not null) {\n         return base.CreateSet(fromSelect, resultType, buffer);\n      }\n\n      return new SqlSet<TResult>(this, fromSelect, buffer);\n   }\n\n   private protected override IEnumerable<TResult>\n   Map(bool singleResult) {\n\n      var query = GetDefiningQuery(clone: false);\n\n      if (_explicitMapper is not null) {\n         return _db.Map(query, _explicitMapper);\n      }\n\n      var results = default(IEnumerable<TResult>);\n\n      PocoMap(singleResult, query, ref results);\n\n      return results\n         ?? throw new InvalidOperationException(\"Cannot enumerate this set.\");\n   }\n\n   partial void\n   PocoMap(bool singleResult, SqlBuilder query, ref IEnumerable<TResult>? results);\n\n   // ISqlSet Members\n\n   /// <summary>\n   /// Gets all <typeparamref name=\"TResult\"/> objects in the set. The query is deferred-executed.\n   /// </summary>\n   /// <returns>All <typeparamref name=\"TResult\"/> objects in the set.</returns>\n\n   public new IEnumerable<TResult>\n   AsEnumerable() =>\n      AsEnumerable(singleResult: false);\n\n   IEnumerable<TResult>\n   AsEnumerable(bool singleResult) =>\n      Map(singleResult);\n\n   /// <summary>\n   /// Casts the elements of the set to the specified type.\n   /// </summary>\n   /// <typeparam name=\"T\">The type to cast the elements of the set to.</typeparam>\n   /// <returns>A new <see cref=\"SqlSet&lt;T>\"/> that contains each element of the current set cast to the specified type.</returns>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new SqlSet<T>\n   Cast<T>() => base.Cast<T>();\n\n   /// <inheritdoc cref=\"SqlSet.Cast(Type)\"/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new SqlSet\n   Cast(Type resultType) =>\n      base.Cast(resultType);\n\n   /// <inheritdoc cref=\"SqlSet.First()\"/>\n\n   public new TResult\n   First() =>\n      Take(1).AsEnumerable(singleResult: true).First();\n\n   /// <inheritdoc cref=\"SqlSet.First(String)\"/>\n\n   public new TResult\n   First(string predicate) =>\n      Where(predicate).First();\n\n   /// <inheritdoc cref=\"SqlSet.First(ref OperatorStringHandler)\"/>\n\n   public new TResult\n   First(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).First();\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefault()\"/>\n\n   public new TResult?\n   FirstOrDefault() =>\n      Take(1).AsEnumerable(singleResult: true).FirstOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefault(String)\"/>\n\n   public new TResult?\n   FirstOrDefault(string predicate) =>\n      Where(predicate).FirstOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.FirstOrDefault(ref OperatorStringHandler)\"/>\n\n   public new TResult?\n   FirstOrDefault(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).FirstOrDefault();\n\n   /// <summary>\n   /// Returns an enumerator that iterates through the set.\n   /// </summary>\n   /// <returns>A <see cref=\"IEnumerator&lt;TResult>\"/> for the set.</returns>\n\n   public new IEnumerator<TResult>\n   GetEnumerator() =>\n      AsEnumerable().GetEnumerator();\n\n   /// <inheritdoc cref=\"SqlSet.OrderBy(String)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> whose elements are sorted according to <paramref name=\"columnList\"/>.</returns>\n\n   public new SqlSet<TResult>\n   OrderBy(string columnList) =>\n      (SqlSet<TResult>)base.OrderBy(columnList);\n\n   /// <inheritdoc cref=\"SqlSet.OrderBy(ref OperatorStringHandler)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> whose elements are sorted according to <paramref name=\"columnList\"/>.</returns>\n\n   public new SqlSet<TResult>\n   OrderBy(ref OperatorStringHandler columnList) =>\n      (SqlSet<TResult>)base.OrderBy(ref columnList);\n\n   /// <inheritdoc cref=\"SqlSet.Single()\"/>\n\n   public new TResult\n   Single() =>\n      AsEnumerable(singleResult: true).Single();\n\n   /// <inheritdoc cref=\"SqlSet.Single(String)\"/>\n\n   public new TResult\n   Single(string predicate) =>\n      Where(predicate).Single();\n\n   /// <inheritdoc cref=\"SqlSet.Single(ref OperatorStringHandler)\"/>\n\n   public new TResult\n   Single(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).Single();\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefault()\"/>\n\n   public new TResult?\n   SingleOrDefault() =>\n      AsEnumerable(singleResult: true).SingleOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefault(String)\"/>\n\n   public new TResult?\n   SingleOrDefault(string predicate) =>\n      Where(predicate).SingleOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.SingleOrDefault(ref OperatorStringHandler)\"/>\n\n   public new TResult?\n   SingleOrDefault(ref OperatorStringHandler predicate) =>\n      Where(ref predicate).SingleOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.Skip(Int32)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> that contains the elements that occur after the specified index in the current set.</returns>\n\n   public new SqlSet<TResult>\n   Skip(int count) =>\n      (SqlSet<TResult>)base.Skip(count);\n\n   /// <inheritdoc cref=\"SqlSet.Take(Int32)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> that contains the specified number of elements from the start of the current set.</returns>\n\n   public new SqlSet<TResult>\n   Take(int count) =>\n      (SqlSet<TResult>)base.Take(count);\n\n   /// <inheritdoc cref=\"SqlSet.ToArray()\"/>\n\n   public new TResult[]\n   ToArray() => AsEnumerable().ToArray();\n\n   /// <summary>\n   /// Creates a List&lt;TResult> from the set.\n   /// </summary>\n   /// <returns>A List&lt;TResult> that contains elements from the set.</returns>\n\n   public new List<TResult>\n   ToList() => AsEnumerable().ToList();\n\n   /// <inheritdoc cref=\"SqlSet.Where(String)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> that contains elements from the current set that satisfy the condition.</returns>\n\n   public new SqlSet<TResult>\n   Where(string predicate) =>\n      (SqlSet<TResult>)base.Where(predicate);\n\n   /// <inheritdoc cref=\"SqlSet.Where(ref OperatorStringHandler)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> that contains elements from the current set that satisfy the condition.</returns>\n\n   public new SqlSet<TResult>\n   Where(ref OperatorStringHandler predicate) =>\n      (SqlSet<TResult>)base.Where(ref predicate);\n}\n\npartial interface ISqlSet<TSqlSet, TSource> where TSqlSet : SqlSet {\n\n   bool\n   All(string predicate);\n\n   bool\n   All(ref SqlSet.OperatorStringHandler predicate);\n\n   bool\n   Any();\n\n   bool\n   Any(string predicate);\n\n   bool\n   Any(ref SqlSet.OperatorStringHandler predicate);\n\n   IEnumerable<TSource>\n   AsEnumerable();\n\n   SqlSet<TResult>\n   Cast<TResult>();\n\n   SqlSet\n   Cast(Type resultType);\n\n   int\n   Count();\n\n   int\n   Count(string predicate);\n\n   int\n   Count(ref SqlSet.OperatorStringHandler predicate);\n\n   TSource\n   First();\n\n   TSource\n   First(string predicate);\n\n   TSource\n   First(ref SqlSet.OperatorStringHandler predicate);\n\n   TSource?\n   FirstOrDefault();\n\n   TSource?\n   FirstOrDefault(string predicate);\n\n   TSource?\n   FirstOrDefault(ref SqlSet.OperatorStringHandler predicate);\n\n   IEnumerator<TSource>\n   GetEnumerator();\n\n   long\n   LongCount();\n\n   long\n   LongCount(string predicate);\n\n   long\n   LongCount(ref SqlSet.OperatorStringHandler predicate);\n\n   TSqlSet\n   OrderBy(string columnList);\n\n   TSqlSet\n   OrderBy(ref SqlSet.OperatorStringHandler columnList);\n\n   SqlSet<TResult>\n   Select<TResult>(string columnList);\n\n   SqlSet<TResult>\n   Select<TResult>(string columnList, Func<DbDataReader, TResult> mapper);\n\n   SqlSet<TResult>\n   Select<TResult>(ref SqlSet.OperatorStringHandler columnList);\n\n   SqlSet<TResult>\n   Select<TResult>(ref SqlSet.OperatorStringHandler columnList, Func<DbDataReader, TResult> mapper);\n\n   SqlSet\n   Select(string columnList);\n\n   SqlSet\n   Select(string columnList, Type resultType);\n\n   SqlSet\n   Select(ref SqlSet.OperatorStringHandler columnList);\n\n   SqlSet\n   Select(ref SqlSet.OperatorStringHandler columnList, Type resultType);\n\n   TSource\n   Single();\n\n   TSource\n   Single(string predicate);\n\n   TSource\n   Single(ref SqlSet.OperatorStringHandler predicate);\n\n   TSource?\n   SingleOrDefault();\n\n   TSource?\n   SingleOrDefault(string predicate);\n\n   TSource?\n   SingleOrDefault(ref SqlSet.OperatorStringHandler predicate);\n\n   TSqlSet\n   Skip(int count);\n\n   TSqlSet\n   Take(int count);\n\n   TSource[]\n   ToArray();\n\n   List<TSource>\n   ToList();\n\n   TSqlSet\n   Where(string predicate);\n\n   TSqlSet\n   Where(ref SqlSet.OperatorStringHandler predicate);\n}\n"
  },
  {
    "path": "src/DbExtensions/SqlTable.Async.cs",
    "content": "﻿// Copyright 2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace DbExtensions;\n\nusing Metadata;\n\n#nullable enable\n\npartial class Database {\n\n   /// <inheritdoc cref=\"SqlTable.AddAsync(Object, CancellationToken)\"/>\n   /// <remarks>This method is a shortcut for <c>await db.Table(entity.GetType()).AddAsync(entity, cancellationToken)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.AddAsync(Object, CancellationToken)\" qualifyHint=\"true\"/>\n\n   public async ValueTask\n   AddAsync(object entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      await Table(entity.GetType())\n         .AddAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.UpdateAsync(Object, CancellationToken)\"/>\n   /// <remarks>This method is a shortcut for <c>await db.Table(entity.GetType()).UpdateAsync(entity, cancellationToken)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.UpdateAsync(Object, CancellationToken)\" qualifyHint=\"true\"/>\n\n   public async ValueTask\n   UpdateAsync(object entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      await Table(entity.GetType())\n         .UpdateAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.UpdateAsync(Object, Object, CancellationToken)\"/>\n   /// <remarks>This method is a shortcut for <c>await db.Table(entity.GetType()).UpdateAsync(entity, originalId, cancellationToken)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.UpdateAsync(Object, Object, CancellationToken)\" qualifyHint=\"true\"/>\n\n   public async ValueTask\n   UpdateAsync(object entity, object? originalId, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      await Table(entity.GetType())\n         .UpdateAsync(entity, originalId, cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.RemoveAsync(Object, CancellationToken)\"/>\n   /// <remarks>This method is a shortcut for <c>await db.Table(entity.GetType()).RemoveAsync(entity, cancellationToken)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.RemoveAsync(Object, CancellationToken)\" qualifyHint=\"true\"/>\n\n   public async ValueTask<bool>\n   RemoveAsync(object entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      return await Table(entity.GetType())\n         .RemoveAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n\npartial class SqlTable {\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.AddAsync(TEntity, CancellationToken)\"/>\n\n   public ValueTask\n   AddAsync(object entity, CancellationToken cancellationToken = default) =>\n      _table.AddAsync(entity, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.AddRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)\"/>\n\n   public ValueTask\n   AddRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken = default) =>\n      _table.AddRangeAsync(entities, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.AddRangeAsync(TEntity[])\"/>\n\n   public ValueTask\n   AddRangeAsync(params object[] entities) =>\n      _table.AddRangeAsync(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveAsync(TEntity, CancellationToken)\"/>\n\n   public ValueTask<bool>\n   RemoveAsync(object entity, CancellationToken cancellationToken = default) =>\n      _table.RemoveAsync(entity, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveKeyAsync(Object, CancellationToken)\"/>\n\n   public ValueTask<bool>\n   RemoveKeyAsync(object id, CancellationToken cancellationToken = default) =>\n      _table.RemoveKeyAsync(id, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)\"/>\n\n   public ValueTask\n   RemoveRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken = default) =>\n      _table.RemoveRangeAsync(entities, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveRangeAsync(TEntity[])\"/>\n\n   public ValueTask\n   RemoveRangeAsync(params object[] entities) =>\n      _table.RemoveRangeAsync(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RefreshAsync(TEntity, CancellationToken)\"/>\n\n   public ValueTask\n   RefreshAsync(object entity, CancellationToken cancellationToken = default) =>\n      _table.RefreshAsync(entity, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateAsync(TEntity, CancellationToken)\"/>\n\n   public ValueTask\n   UpdateAsync(object entity, CancellationToken cancellationToken = default) =>\n      _table.UpdateAsync(entity, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateAsync(TEntity, Object, CancellationToken)\"/>\n\n   public ValueTask\n   UpdateAsync(object entity, object? originalId, CancellationToken cancellationToken = default) =>\n      _table.UpdateAsync(entity, originalId, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateRangeAsync(IEnumerable&lt;TEntity>, CancellationToken)\"/>\n\n   public ValueTask\n   UpdateRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken = default) =>\n      _table.UpdateRangeAsync(entities, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateRangeAsync(TEntity[])\"/>\n\n   public ValueTask\n   UpdateRangeAsync(params object[] entities) =>\n      _table.UpdateRangeAsync(entities);\n}\n\npartial class SqlTable<TEntity> {\n\n   /// <inheritdoc cref=\"Add(TEntity)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask\n   AddAsync(TEntity entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var idMember = _metaType.DBGeneratedIdentityMember;\n\n      var outputIdMember = idMember is not null\n         && _db.Configuration.SqlDialect is SqlDialect.TSql;\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnInsert\n            && m != idMember)\n         .ToArray();\n\n      var insertSql = BuildInsertStatementForEntity(entity, outputIdMember);\n      var id = default(object);\n\n      var tx = await _db.EnsureInTransactionAsync(cancellationToken)\n         .ConfigureAwait(false);\n\n      await using var txDisp = tx.ConfigureAwait(false);\n\n      if (outputIdMember) {\n\n         // this block emulates Database.Execute()\n\n         var cmd = _db.CreateCommand(insertSql);\n\n         try {\n            id = await cmd.ExecuteScalarAsync(cancellationToken)\n               .ConfigureAwait(false);\n\n         } catch {\n\n            _db.Trace(cmd, error: true);\n            throw;\n         }\n\n         _db.Trace(cmd);\n\n      } else {\n\n         await _db.ExecuteAsync(insertSql, affect: 1, exact: true, cancellationToken)\n            .ConfigureAwait(false);\n\n         if (idMember is not null) {\n            id = await _db.LastInsertIdAsync(cancellationToken)\n               .ConfigureAwait(false);\n         }\n      }\n\n      if (idMember is not null) {\n\n         var convertedId = Convert.ChangeType(id, idMember.Type, CultureInfo.InvariantCulture);\n         var entityObj = (object)entity;\n\n         idMember.MemberAccessor.SetBoxedValue(ref entityObj, convertedId);\n      }\n\n      if (syncMembers.Length > 0\n         && _metaType.IsEntity) {\n\n         await RefreshAsync(entity, syncMembers, cancellationToken)\n            .ConfigureAwait(false);\n      }\n\n      await InsertDescendantsAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n\n      await tx.CommitAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   async ValueTask\n   InsertDescendantsAsync(TEntity entity, CancellationToken cancellationToken) {\n\n      await InsertOneToOneAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n\n      await InsertOneToManyAsync(entity, cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   async ValueTask\n   InsertOneToOneAsync(TEntity entity, CancellationToken cancellationToken) {\n\n      foreach (var assoc in _metaType.Associations\n            .Where(a => !a.IsMany && a.ThisKeyIsPrimaryKey && a.OtherKeyIsPrimaryKey)) {\n\n         var child = assoc.ThisMember.MemberAccessor.GetBoxedValue(entity);\n\n         if (child is null) {\n            continue;\n         }\n\n         for (int j = 0; j < assoc.ThisKey.Count; j++) {\n\n            var thisKey = assoc.ThisKey[j];\n            var otherKey = assoc.OtherKey[j];\n\n            var thisKeyVal = thisKey.MemberAccessor.GetBoxedValue(entity);\n\n            otherKey.MemberAccessor.SetBoxedValue(ref child, thisKeyVal);\n         }\n\n         var otherTable = _db.Table(assoc.OtherType);\n\n         await otherTable.AddAsync(child, cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   async ValueTask\n   InsertOneToManyAsync(TEntity entity, CancellationToken cancellationToken) {\n\n      foreach (var assoc in _metaType.Associations.Where(a => a.IsMany)) {\n\n         var many = ((IEnumerable<object>)assoc.ThisMember.MemberAccessor.GetBoxedValue(entity) ?? [])\n            .Where(o => o is not null)\n            .ToArray();\n\n         if (many.Length == 0) {\n            continue;\n         }\n\n         foreach (var child in many) {\n\n            for (int k = 0; k < assoc.ThisKey.Count; k++) {\n\n               var thisKey = assoc.ThisKey[k];\n               var otherKey = assoc.OtherKey[k];\n\n               var thisKeyVal = thisKey.MemberAccessor.GetBoxedValue(entity);\n               var c = child;\n\n               otherKey.MemberAccessor.SetBoxedValue(ref c, thisKeyVal);\n            }\n         }\n\n         var otherTable = _db.Table(assoc.OtherType);\n\n         await otherTable.AddRangeAsync(many, cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   /// <inheritdoc cref=\"AddRange(IEnumerable&lt;TEntity>)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask\n   AddRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      await AddRangeAsync(entities as TEntity[] ?? entities.ToArray(), cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"AddRange(TEntity[])\"/>\n\n   public ValueTask\n   AddRangeAsync(params TEntity[] entities) =>\n      AddRangeAsync(entities, default(CancellationToken));\n\n   async ValueTask\n   AddRangeAsync(TEntity[] entities, CancellationToken cancellationToken) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         await AddAsync(entities[0], cancellationToken)\n            .ConfigureAwait(false);\n         return;\n      }\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnInsert)\n         .ToArray();\n\n      var batch = syncMembers.Length == 0\n         && _db.Configuration.EnableBatchCommands;\n\n      if (batch) {\n\n         var batchInsert = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildInsertStatementForEntity(e)));\n\n         var tx = await _db.EnsureInTransactionAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n         await using var txDisp = tx.ConfigureAwait(false);\n\n         await _db.ExecuteAsync(batchInsert, affect: entities.Length, exact: true, cancellationToken)\n            .ConfigureAwait(false);\n\n         foreach (var e in entities) {\n            await InsertDescendantsAsync(e, cancellationToken)\n               .ConfigureAwait(false);\n         }\n\n         await tx.CommitAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n      } else {\n\n         var tx = await _db.EnsureInTransactionAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n         await using var txDisp = tx.ConfigureAwait(false);\n\n         foreach (var e in entities) {\n            await AddAsync(e, cancellationToken)\n               .ConfigureAwait(false);\n         }\n\n         await tx.CommitAsync(cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   /// <inheritdoc cref=\"Remove(TEntity)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   RemoveAsync(TEntity entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var deleteSql = BuildDeleteStatementForEntity(entity);\n\n      var usingVersion = _db.Configuration.UseVersionMember\n         && _metaType.VersionMember is not null;\n\n      return await _db.ExecuteAsync(deleteSql, affect: 1, exact: usingVersion, cancellationToken)\n         .ConfigureAwait(false) == 1;\n   }\n\n   /// <inheritdoc cref=\"RemoveKey(Object)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   RemoveKeyAsync(object id, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      var deleteSql = BuildDeleteStatementForKey(id);\n\n      return await _db.ExecuteAsync(deleteSql, affect: 1, cancellationToken: cancellationToken)\n         .ConfigureAwait(false) == 1;\n   }\n\n   /// <inheritdoc cref=\"RemoveRange(IEnumerable&lt;TEntity>)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask\n   RemoveRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      await RemoveRangeAsync(entities as TEntity[] ?? entities.ToArray(), cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"RemoveRange(TEntity[])\"/>\n\n   public ValueTask\n   RemoveRangeAsync(params TEntity[] entities) =>\n      RemoveRangeAsync(entities, default(CancellationToken));\n\n   async ValueTask\n   RemoveRangeAsync(TEntity[] entities, CancellationToken cancellationToken) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         await RemoveAsync(entities[0], cancellationToken)\n            .ConfigureAwait(false);\n         return;\n      }\n\n      EnsureEntityType();\n\n      var usingVersion = _db.Configuration.UseVersionMember\n         && _metaType.VersionMember is not null;\n\n      var singleStatement = _metaType.IdentityMembers.Count == 1\n         && !usingVersion;\n\n      var batch = _db.Configuration.EnableBatchCommands;\n\n      if (singleStatement) {\n\n         var idMember = _metaType.IdentityMembers[0];\n\n         var ids = entities.Select(e => idMember.GetValueForDatabase(e))\n            .ToArray();\n\n         var sql = BuildDeleteStatement()\n            .WHERE(String.Empty);\n\n         var sb = sql.Buffer;\n\n         _db.QuoteIdentifier(sb, idMember.MappedName);\n         sb.Append(\" IN (\");\n\n         for (int i = 0; i < ids.Length; i++) {\n\n            if (i > 0) {\n               sb.Append(',')\n                  .Append(' ');\n            }\n\n            sb.Append('{')\n               .Append(sql.ParameterValues.Count)\n               .Append('}');\n\n            sql.ParameterValues.Add(ids[i]);\n         }\n\n         sb.Append(')');\n\n         await _db.ExecuteAsync(sql, affect: entities.Length, cancellationToken: cancellationToken)\n            .ConfigureAwait(false);\n\n      } else if (batch) {\n\n         var batchDelete = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildDeleteStatementForEntity(e)));\n\n         await _db.ExecuteAsync(batchDelete, affect: entities.Length, exact: usingVersion, cancellationToken)\n            .ConfigureAwait(false);\n\n      } else {\n\n         var tx = await _db.EnsureInTransactionAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n         await using var txDisp = tx.ConfigureAwait(false);\n\n         foreach (var e in entities) {\n            await RemoveAsync(e, cancellationToken)\n               .ConfigureAwait(false);\n         }\n\n         await tx.CommitAsync(cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   /// <inheritdoc cref=\"Refresh(TEntity)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public ValueTask\n   RefreshAsync(TEntity entity, CancellationToken cancellationToken = default) =>\n      RefreshAsync(entity, null, cancellationToken);\n\n   async ValueTask\n   RefreshAsync(TEntity entity, IEnumerable<MetaDataMember>? refreshMembers, CancellationToken cancellationToken) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      EnsureEntityType();\n\n      var query = BuildSelectStatement(refreshMembers);\n      query.WHERE(_db.BuildPredicateFragment(entity, _metaType.IdentityMembers, query.ParameterValues));\n\n      var mapper = _db.CreatePocoMapper(_metaType.Type);\n\n      var entityObj = (object)entity;\n\n      _ = await _db.AsyncMap<object?>(query, r => {\n         mapper.PocoLoad(entityObj, r);\n         return null;\n\n      }).SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Update(TEntity)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public ValueTask\n   UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) =>\n      UpdateAsync(entity, null, cancellationToken);\n\n   /// <inheritdoc cref=\"Update(TEntity, Object)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask\n   UpdateAsync(TEntity entity, object? originalId, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var updateSql = BuildUpdateStatementForEntity(entity, originalId);\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnUpdate)\n         .ToArray();\n\n      await using var conn = (await _db.EnsureConnectionOpenAsync(cancellationToken)\n            .ConfigureAwait(false))\n         .ConfigureAwait(false);\n\n      await _db.ExecuteAsync(updateSql, affect: 1, exact: true, cancellationToken)\n         .ConfigureAwait(false);\n\n      if (syncMembers.Length > 0) {\n         await RefreshAsync(entity, syncMembers, cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   /// <inheritdoc cref=\"UpdateRange(IEnumerable&lt;TEntity>)\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask\n   UpdateRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      await UpdateRangeAsync(entities as TEntity[] ?? entities.ToArray(), cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"UpdateRange(TEntity[])\"/>\n   /// <inheritdoc cref=\"SqlSet.AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public ValueTask\n   UpdateRangeAsync(params TEntity[] entities) =>\n      UpdateRangeAsync(entities, default(CancellationToken));\n\n   async ValueTask\n   UpdateRangeAsync(TEntity[] entities, CancellationToken cancellationToken) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         await UpdateAsync(entities[0], cancellationToken)\n            .ConfigureAwait(false);\n         return;\n      }\n\n      EnsureEntityType();\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnUpdate)\n         .ToArray();\n\n      var batch = syncMembers.Length == 0\n         && _db.Configuration.EnableBatchCommands;\n\n      if (batch) {\n\n         var batchUpdate = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildUpdateStatementForEntity(e)));\n\n         await _db.ExecuteAsync(batchUpdate, affect: entities.Length, exact: true, cancellationToken)\n            .ConfigureAwait(false);\n\n      } else {\n\n         var tx = await _db.EnsureInTransactionAsync(cancellationToken)\n            .ConfigureAwait(false);\n\n         await using var txDisp = tx.ConfigureAwait(false);\n\n         foreach (var e in entities) {\n            await UpdateAsync(e, cancellationToken)\n               .ConfigureAwait(false);\n         }\n\n         await tx.CommitAsync(cancellationToken)\n            .ConfigureAwait(false);\n      }\n   }\n\n   // ISqlTable Members\n\n   ValueTask\n   ISqlTable.AddAsync(object entity, CancellationToken cancellationToken) =>\n      AddAsync((TEntity)entity, cancellationToken);\n\n   ValueTask\n   ISqlTable.AddRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken) =>\n      AddRangeAsync(entities.Cast<TEntity>(), cancellationToken);\n\n   ValueTask\n   ISqlTable.AddRangeAsync(params object[] entities) =>\n      AddRangeAsync(entities.Cast<TEntity>());\n\n   ValueTask<bool>\n   ISqlTable.RemoveAsync(object entity, CancellationToken cancellationToken) =>\n      RemoveAsync((TEntity)entity, cancellationToken);\n\n   ValueTask<bool>\n   ISqlTable.RemoveKeyAsync(object id, CancellationToken cancellationToken) =>\n      RemoveKeyAsync(id, cancellationToken);\n\n   ValueTask\n   ISqlTable.RemoveRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken) =>\n      RemoveRangeAsync(entities.Cast<TEntity>(), cancellationToken);\n\n   ValueTask\n   ISqlTable.RemoveRangeAsync(params object[] entities) =>\n      RemoveRangeAsync(entities.Cast<TEntity>());\n\n   ValueTask\n   ISqlTable.RefreshAsync(object entity, CancellationToken cancellationToken) =>\n      RefreshAsync((TEntity)entity, cancellationToken);\n\n   ValueTask\n   ISqlTable.UpdateAsync(object entity, CancellationToken cancellationToken) =>\n      UpdateAsync((TEntity)entity, cancellationToken);\n\n   ValueTask\n   ISqlTable.UpdateAsync(object entity, object? originalId, CancellationToken cancellationToken) =>\n      UpdateAsync((TEntity)entity, originalId, cancellationToken);\n\n   ValueTask\n   ISqlTable.UpdateRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken) =>\n      UpdateRangeAsync(entities.Cast<TEntity>(), cancellationToken);\n\n   ValueTask\n   ISqlTable.UpdateRangeAsync(params object[] entities) =>\n      UpdateRangeAsync(entities.Cast<TEntity>());\n}\n\npartial interface ISqlTable {\n\n   ValueTask\n   AddAsync(object entity, CancellationToken cancellationToken);\n\n   ValueTask\n   AddRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken);\n\n   ValueTask\n   AddRangeAsync(params object[] entities);\n\n   ValueTask<bool>\n   RemoveAsync(object entity, CancellationToken cancellationToken);\n\n   ValueTask<bool>\n   RemoveKeyAsync(object id, CancellationToken cancellationToken);\n\n   ValueTask\n   RemoveRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken);\n\n   ValueTask\n   RemoveRangeAsync(params object[] entities);\n\n   ValueTask\n   RefreshAsync(object entity, CancellationToken cancellationToken);\n\n   ValueTask\n   UpdateAsync(object entity, CancellationToken cancellationToken);\n\n   ValueTask\n   UpdateAsync(object entity, object? originalId, CancellationToken cancellationToken);\n\n   ValueTask\n   UpdateRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken);\n\n   ValueTask\n   UpdateRangeAsync(params object[] entities);\n}\n"
  },
  {
    "path": "src/DbExtensions/SqlTable.SqlSet.cs",
    "content": "﻿// Copyright 2012-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace DbExtensions;\n\nusing Metadata;\n\n#nullable enable\n\npartial class Database {\n\n   /// <inheritdoc cref=\"SqlSet&lt;TEntity>.Find(Object)\" path=\"*[not(self::remarks or self::exception[@cref='T:System.InvalidOperationException'])]\"/>\n   /// <typeparam name=\"TEntity\">The type of the entity.</typeparam>\n   /// <remarks>This method is a shortcut for <c>db.Table&lt;TEntity>().Find(id)</c>.</remarks>\n   /// <seealso cref=\"SqlSet&lt;TEntity>.Find(Object)\" qualifyHint=\"true\"/>\n\n   public TEntity?\n   Find<TEntity>(object id) where TEntity : class =>\n      Table<TEntity>().Find(id);\n}\n\npartial class SqlSet {\n\n   MetaType\n   EnsureAnnotatedType() {\n\n      if (_resultType is null) {\n         throw new InvalidOperationException(\"The operation is not supported on untyped sets.\");\n      }\n\n      var metaType = _db.Configuration.GetMetaType(_resultType)\n         ?? throw new InvalidOperationException($\"Mapping information was not found for '{_resultType.FullName}'.\");\n\n      return metaType;\n   }\n\n   MetaType\n   EnsureEntityType(int maxIdMembers = -1) {\n\n      var metaType = EnsureAnnotatedType();\n\n      SqlTable.EnsureEntityType(metaType);\n\n      if (maxIdMembers > 0\n         && metaType.IdentityMembers.Count > maxIdMembers) {\n\n         throw new InvalidOperationException(\"The operation is not supported for entities with more than one identity member.\");\n      }\n\n      return metaType;\n   }\n\n   /// <summary>\n   /// Checks the existance of the <paramref name=\"entity\"/>, using the primary key value.\n   /// </summary>\n   /// <param name=\"entity\">The entity whose existance is to be checked.</param>\n   /// <returns><c>true</c> if the primary key value exists in the database; otherwise, <c>false</c>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">This method can only be used on sets where the result type is an annotated class.</exception>\n\n   public bool\n   Contains(object entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var (fragment, columnList) = ContainsEntityImplParams(entity);\n\n      return Where(fragment)\n         .Select(columnList)\n         .Any();\n   }\n\n   (ISqlFragment, string)\n   ContainsEntityImplParams(object entity) {\n\n      var metaType = EnsureEntityType();\n\n      var predicateMembers = metaType.PersistentDataMembers\n         .Where(m => m.IsPrimaryKey || (m.IsVersion && _db.Configuration.UseVersionMember))\n         .ToArray();\n\n      var predicateValues = predicateMembers.ToDictionary(\n         m => m.MappedName,\n         m => m.GetValueForDatabase(entity));\n\n      return ContainsImplParams(predicateMembers, predicateValues);\n   }\n\n   /// <summary>\n   /// Checks the existance of an entity whose primary matches the <paramref name=\"id\"/> parameter.\n   /// </summary>\n   /// <param name=\"id\">The primary key value.</param>\n   /// <returns><c>true</c> if the primary key value exists in the database; otherwise, <c>false</c>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">This method can only be used on sets where the result type is an annotated class.</exception>\n\n   public bool\n   ContainsKey(object id) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      var (fragment, columnList) = ContainsKeyImplParams(id);\n\n      return Where(fragment)\n         .Select(columnList)\n         .Any();\n   }\n\n   (ISqlFragment, string)\n   ContainsKeyImplParams(object id) {\n\n      var metaType = EnsureEntityType(maxIdMembers: 1);\n      var idMember = metaType.IdentityMembers[0];\n\n      var predicateMembers = new[] { idMember };\n\n      var predicateValues = new KeyValuePair<string, object>[] {\n         new(idMember.MappedName, idMember.ConvertValueForDatabase(id))\n      };\n\n      return ContainsImplParams(predicateMembers, predicateValues);\n   }\n\n   (ISqlFragment, string)\n   ContainsImplParams(MetaDataMember[] predicateMembers, IEnumerable<KeyValuePair<string, object>> predicateValues) {\n\n      var metaType = predicateMembers[0].DeclaringType;\n      var predicateParams = new List<object?>(predicateMembers.Length);\n\n      var fragment = new SqlFragment(_db.BuildPredicateFragment(predicateValues, predicateParams), predicateParams);\n      var columnList = _db.SelectBody(metaType, predicateMembers);\n\n      return (fragment, columnList);\n   }\n\n   /// <summary>\n   /// Gets the entity whose primary key matches the <paramref name=\"id\"/> parameter.\n   /// </summary>\n   /// <param name=\"id\">The primary key value.</param>\n   /// <returns>\n   /// The entity whose primary key matches the <paramref name=\"id\"/> parameter, \n   /// or null if the <paramref name=\"id\"/> does not exist.\n   /// </returns>\n   /// <exception cref=\"System.InvalidOperationException\">This method can only be used on sets where the result type is an annotated class.</exception>\n\n   public object?\n   Find(object id) =>\n      FindImpl(id).SingleOrDefault();\n\n   private protected SqlSet\n   FindImpl(object id) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      var metaType = EnsureEntityType(maxIdMembers: 1);\n      var idMember = metaType.IdentityMembers[0];\n\n      var predicateValues = new KeyValuePair<string, object>[] {\n         new(idMember.MappedName, idMember.ConvertValueForDatabase(id))\n      };\n\n      var parameters = new List<object?>(predicateValues.Length);\n      var fragment = new SqlFragment(_db.BuildPredicateFragment(predicateValues, parameters), parameters);\n\n      return Where(fragment);\n   }\n\n   /// <summary>\n   /// Specifies the related objects to include in the query results.\n   /// </summary>\n   /// <param name=\"path\">Dot-separated list of related objects to return in the query results.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/> with the defined query path.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">This method can only be used on sets where the result type is an annotated class.</exception>\n\n   public SqlSet\n   Include(string path) {\n\n      ArgumentNullException.ThrowIfNull(path);\n\n      var metaType = EnsureAnnotatedType();\n      var parts = IncludePathSplit(path);\n\n      const string leftAlias = \"dbex_l\";\n      const string rightAlias = \"dbex_r\";\n\n      static string rAliasFn(int i) => rightAlias + (i + 1);\n\n      var query = new SqlBuilder()\n         .SELECT(String.Empty);\n\n      var sb = query.Buffer;\n\n      _db.QuoteIdentifier(sb, leftAlias);\n      sb.Append(\".*\");\n\n      var currentType = metaType;\n\n      var associations = new List<MetaAssociation>(parts.Length);\n\n      for (int i = 0; i < parts.Length; i++) {\n\n         var p = parts[i];\n         var rAlias = rAliasFn(i);\n\n         var member = currentType.PersistentDataMembers\n            .SingleOrDefault(m => m.Name == p)\n            ?? throw new ArgumentException($\"Couldn't find '{p}' on '{currentType.Type.FullName}'.\", nameof(path));\n\n         if (!member.IsAssociation) {\n            throw new ArgumentException($\"'{p}' is not an association property.\", nameof(path));\n         }\n\n         var association = member.Association;\n\n         if (association.IsMany) {\n            throw new ArgumentException($\"Use the IncludeMany method to load collections ('{path}').\", nameof(path));\n         }\n\n         associations.Add(association);\n\n         foreach (var m in association.OtherType.PersistentDataMembers\n               .Where(m => !m.IsAssociation)) {\n\n            query.SELECT(String.Empty);\n            _db.QuoteIdentifier(sb, rAlias);\n            sb.Append('.');\n            _db.QuoteIdentifier(sb, m.MappedName);\n            sb.Append(\" AS \");\n\n            foreach (var a in associations) {\n               sb.Append(a.ThisMember.Name)\n                  .Append('$');\n            }\n\n            sb.Append(m.Name);\n         }\n\n         currentType = association.OtherType;\n      }\n\n      query.FROM(GetDefiningQuery(clone: false), _db.QuoteIdentifier(leftAlias));\n\n      for (int i = 0; i < associations.Count; i++) {\n\n         var association = associations[i];\n         var lAlias = (i == 0) ? leftAlias : rAliasFn(i - 1);\n         var rAlias = rAliasFn(i);\n\n         query.LEFT_JOIN(String.Empty);\n         _db.QuoteIdentifier(sb, association.OtherType.Table.TableName);\n         sb.Append(' ');\n         _db.QuoteIdentifier(sb, rAlias);\n         sb.Append(\" ON (\");\n\n         for (int j = 0; j < association.ThisKey.Count; j++) {\n\n            if (j > 0) {\n               sb.Append(\" AND \");\n            }\n\n            var thisMember = association.ThisKey[j];\n            var otherMember = association.OtherKey[j];\n\n            _db.QuoteIdentifier(sb, lAlias);\n            sb.Append('.');\n            _db.QuoteIdentifier(sb, (i > 0) ? thisMember.MappedName : thisMember.Name);\n            sb.Append(\" = \");\n            _db.QuoteIdentifier(sb, rAlias);\n            sb.Append('.');\n            _db.QuoteIdentifier(sb, otherMember.MappedName);\n         }\n\n         sb.Append(')');\n      }\n\n      var newSet = CreateSet(query);\n\n      return newSet;\n   }\n\n   /// <summary>\n   /// Specifies which collections to include in the query results.\n   /// </summary>\n   /// <param name=\"path\">Dot-separated list of one or more related objects that ends with the collection to load.</param>\n   /// <param name=\"manySetup\">A function to customize how the collection is loaded.</param>\n   /// <returns>A new <see cref=\"SqlSet\"/>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">This method can only be used on sets where the result type is an annotated class.</exception>\n\n   public SqlSet\n   IncludeMany(string path, Func<SqlSet, SqlSet>? manySetup = null) {\n\n      ArgumentNullException.ThrowIfNull(path);\n\n      var metaType = EnsureAnnotatedType();\n\n      var parts = IncludePathSplit(path);\n      var currentType = metaType;\n      var manyAssoc = default(MetaAssociation);\n\n      for (int i = 0; i < parts.Length; i++) {\n\n         var p = parts[i];\n\n         var member = currentType.PersistentDataMembers\n            .SingleOrDefault(m => m.Name == p)\n            ?? throw new ArgumentException($\"Couldn't find '{p}' on '{currentType.Type.FullName}'.\", nameof(path));\n\n         if (!member.IsAssociation) {\n            throw new ArgumentException($\"'{p}' is not an association property.\", nameof(path));\n         }\n\n         var association = member.Association;\n\n         if (i == parts.Length - 1) {\n\n            if (association.IsMany) {\n               manyAssoc = association;\n               break;\n            }\n\n            throw new ArgumentException(\n               $\"The last segment of the path must refer to a collection ('{path}').\",\n               nameof(path));\n\n         } else if (association.IsMany) {\n\n            throw new ArgumentException(\n               $\"Only the last segment of the path can refer to a collection ('{path}'). \"\n               + \"Use the elementPath parameter to include a path in the collection.\",\n               nameof(path));\n         }\n\n         currentType = association.OtherType;\n      }\n\n      Debug.Assert(manyAssoc is not null);\n\n      var manySource = (SqlSet)_db.Table(manyAssoc.OtherType);\n\n      var newSet = Clone();\n\n      newSet.AddManyInclude(parts,\n         container => manyAssoc.LoadCollection(container, manyFetch(container)));\n\n      return newSet;\n\n      IEnumerable manyFetch(object container) {\n\n         var predicateValues = manyAssoc.OtherKey.Select((p, i) =>\n            new KeyValuePair<string, object>(p.MappedName, manyAssoc.ThisKey[i].GetValueForDatabase(container)));\n\n         var parameters = new List<object?>(manyAssoc.OtherKey.Count);\n         var whereFragment = new SqlFragment(manySource.Database.BuildPredicateFragment(predicateValues, parameters), parameters);\n\n         manySource = manySource\n            .Where(whereFragment);\n\n         if (manySetup is not null) {\n            manySource = manySetup.Invoke(manySource);\n         }\n\n         return manySource.AsEnumerable();\n      }\n   }\n\n   static string[]\n   IncludePathSplit(string path) {\n\n      var pathParts = path.Split('.', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);\n\n      if (pathParts.Length == 0) {\n         throw new ArgumentException(\"Path is empty.\", nameof(path));\n      }\n\n      return pathParts;\n   }\n}\n\npartial class SqlSet<TResult> {\n\n   /// <inheritdoc cref=\"SqlSet.Contains(Object)\"/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new bool\n   Contains(object entity) =>\n      Contains((TResult)entity);\n\n   /// <inheritdoc cref=\"SqlSet.Contains(Object)\"/>\n\n   public bool\n   Contains(TResult entity) =>\n      base.Contains(entity!);\n\n   /// <inheritdoc cref=\"SqlSet.Find(Object)\"/>\n\n   public new TResult?\n   Find(object id) =>\n      ((SqlSet<TResult>)FindImpl(id)).SingleOrDefault();\n\n   /// <inheritdoc cref=\"SqlSet.Include(String)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/> with the defined query path.</returns>\n\n   public new SqlSet<TResult>\n   Include(string path) =>\n      (SqlSet<TResult>)base.Include(path);\n\n   /// <inheritdoc cref=\"Include(String)\"/>\n   /// <param name=\"path\">Lambda expression that returns the deepest related object to return in the query results.</param>\n   /// <param name=\"pathExpr\">This argument is compiler generated.</param>\n\n   public SqlSet<TResult>\n   Include(Func<TResult, object?> path, [CallerArgumentExpression(nameof(path))] string pathExpr = \"\") {\n\n      ArgumentNullException.ThrowIfNull(path);\n      ArgumentException.ThrowIfNullOrEmpty(pathExpr);\n\n      var pathStr = IncludeLambdaPath(pathExpr);\n\n      return Include(pathStr);\n   }\n\n   /// <inheritdoc cref=\"SqlSet.IncludeMany(String, Func&lt;SqlSet, SqlSet>?)\"/>\n   /// <returns>A new <see cref=\"SqlSet&lt;TResult>\"/>.</returns>\n\n   public new SqlSet<TResult>\n   IncludeMany(string path, Func<SqlSet, SqlSet>? manySetup = null) =>\n      (SqlSet<TResult>)base.IncludeMany(path, manySetup);\n\n   /// <inheritdoc cref=\"IncludeMany(String, Func&lt;SqlSet, SqlSet>?)\"/>\n   /// <typeparam name=\"TElement\">The type of objects the collection holds.</typeparam>\n   /// <param name=\"path\">Lambda expression that returns the collection to load.</param>\n   /// <param name=\"pathExpr\">This argument is compiler generated.</param>\n\n   public SqlSet<TResult>\n   IncludeMany<TElement>(\n         Func<TResult, ICollection<TElement>?> path,\n         Func<SqlSet<TElement>, SqlSet<TElement>>? manySetup = null,\n         [CallerArgumentExpression(nameof(path))] string pathExpr = \"\") {\n\n      ArgumentNullException.ThrowIfNull(path);\n      ArgumentException.ThrowIfNullOrEmpty(pathExpr);\n\n      var pathStr = IncludeLambdaPath(pathExpr);\n\n      return IncludeMany(pathStr,\n         (manySetup != null) ? p => manySetup.Invoke(p.Cast<TElement>()) : null);\n   }\n\n   static string\n   IncludeLambdaPath(string pathExpr) {\n\n      var arrowIndex = pathExpr.IndexOf(\"=>\");\n\n      if (arrowIndex == -1) {\n         throw new ArgumentException(\"A lambda expression is expected.\", nameof(pathExpr));\n      }\n\n      var firstDot = pathExpr.IndexOf('.', arrowIndex);\n\n      if (firstDot == -1) {\n         throw new ArgumentException(\"Path is empty.\", nameof(pathExpr));\n      }\n\n      return pathExpr\n         .Substring(firstDot + 1);\n   }\n}\n\n// Async\n\npartial class Database {\n\n   /// <inheritdoc cref=\"SqlSet&lt;TEntity>.FindAsync(Object, CancellationToken)\" path=\"*[not(self::remarks or self::exception[@cref='T:System.InvalidOperationException'])]\"/>\n   /// <typeparam name=\"TEntity\">The type of the entity.</typeparam>\n   /// <remarks>This method is a shortcut for <c>await db.Table&lt;TEntity>().FindAsync(id, cancellationToken)</c>.</remarks>\n\n   public async ValueTask<TEntity?>\n   FindAsync<TEntity>(object id, CancellationToken cancellationToken = default) where TEntity : class {\n\n      return await Table<TEntity>()\n         .FindAsync(id, cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n\npartial class SqlSet {\n\n   /// <inheritdoc cref=\"Contains(Object)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   ContainsAsync(object entity, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var (fragment, columnList) = ContainsEntityImplParams(entity);\n\n      return await Where(fragment)\n         .Select(columnList)\n         .AnyAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"ContainsKey(Object)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<bool>\n   ContainsKeyAsync(object id, CancellationToken cancellationToken = default) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      var (fragment, columnList) = ContainsKeyImplParams(id);\n\n      return await Where(fragment)\n         .Select(columnList)\n         .AnyAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n\n   /// <inheritdoc cref=\"Find(Object)\"/>\n   /// <inheritdoc cref=\"AnyAsync(CancellationToken)\" path=\"param\"/>\n\n   public async ValueTask<object?>\n   FindAsync(object id, CancellationToken cancellationToken = default) {\n\n      return await FindImpl(id)\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n\npartial class SqlSet<TResult> {\n\n   /// <inheritdoc cref=\"SqlSet.ContainsAsync(Object, CancellationToken)\"/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new ValueTask<bool>\n   ContainsAsync(object entity, CancellationToken cancellationToken = default) =>\n      ContainsAsync((TResult)entity, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlSet.ContainsAsync(Object, CancellationToken)\"/>\n\n   public ValueTask<bool>\n   ContainsAsync(TResult entity, CancellationToken cancellationToken = default) =>\n      base.ContainsAsync(entity!, cancellationToken);\n\n   /// <inheritdoc cref=\"SqlSet.FindAsync(Object, CancellationToken)\"/>\n\n   public new async ValueTask<TResult?>\n   FindAsync(object id, CancellationToken cancellationToken = default) {\n\n      return await ((SqlSet<TResult>)FindImpl(id))\n         .SingleOrDefaultAsync(cancellationToken)\n         .ConfigureAwait(false);\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions/SqlTable.cs",
    "content": "﻿// Copyright 2012-2025 Max Toro Q.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace DbExtensions;\n\nusing Metadata;\n\n#nullable enable\n\npartial class Database {\n\n   static readonly MethodInfo\n   _tableMethod = typeof(Database)\n      .GetMethod(nameof(Table), 1, Type.EmptyTypes)!;\n\n   static readonly MappingSource\n   _mappingSource = new AttributeMappingSource();\n\n   readonly Dictionary<MetaType, SqlTable>\n   _tables = new();\n\n   readonly Dictionary<MetaType, ISqlTable>\n   _genericTables = new();\n\n   partial void\n   Initialize2(string providerInvariantName) {\n\n      this.Configuration.SetModel(() => _mappingSource.GetModel(GetType()));\n      Initialize3(providerInvariantName);\n   }\n\n   partial void\n   Initialize3(string providerInvariantName);\n\n   /// <summary>\n   /// Returns the <see cref=\"SqlTable&lt;TEntity>\"/> instance for the specified <typeparamref name=\"TEntity\"/>.\n   /// </summary>\n   /// <typeparam name=\"TEntity\">The type of the entity.</typeparam>\n   /// <returns>The <see cref=\"SqlTable&lt;TEntity>\"/> instance for <typeparamref name=\"TEntity\"/>.</returns>\n\n   public SqlTable<TEntity>\n   Table<TEntity>() where TEntity : class {\n\n      var metaType = this.Configuration.GetMetaType(typeof(TEntity));\n\n      ref var table = ref CollectionsMarshal.GetValueRefOrAddDefault(_genericTables, metaType, out var exists);\n\n      if (!exists) {\n         table = new SqlTable<TEntity>(this, metaType);\n      }\n\n      return (SqlTable<TEntity>)table!;\n   }\n\n   /// <summary>\n   /// Returns the <see cref=\"SqlTable\"/> instance for the specified <paramref name=\"entityType\"/>.\n   /// </summary>\n   /// <param name=\"entityType\">The type of the entity.</param>\n   /// <returns>The <see cref=\"SqlTable\"/> instance for <paramref name=\"entityType\"/>.</returns>\n\n   public SqlTable\n   Table(Type entityType) {\n\n      ArgumentNullException.ThrowIfNull(entityType);\n\n      return Table(this.Configuration.GetMetaType(entityType));\n   }\n\n   internal SqlTable\n   Table(MetaType metaType) {\n\n      ref var table = ref CollectionsMarshal.GetValueRefOrAddDefault(_tables, metaType, out var exists);\n\n      if (!exists) {\n\n         var genericTable = (ISqlTable)_tableMethod\n            .MakeGenericMethod(metaType.Type)\n            .Invoke(this, null)!;\n\n         table = new SqlTable(this, metaType, genericTable);\n      }\n\n      return table!;\n   }\n\n   /// <inheritdoc cref=\"SqlTable.Add(Object)\"/>\n   /// <remarks>This method is a shortcut for <c>db.Table(entity.GetType()).Add(entity)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.Add(Object)\" qualifyHint=\"true\"/>\n\n   public void\n   Add(object entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      Table(entity.GetType())\n         .Add(entity);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.Update(Object)\"/>\n   /// <remarks>This method is a shortcut for <c>db.Table(entity.GetType()).Update(entity)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.Update(Object)\" qualifyHint=\"true\"/>\n\n   public void\n   Update(object entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      Table(entity.GetType())\n         .Update(entity);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.Update(Object, Object)\"/>\n   /// <remarks>This method is a shortcut for <c>db.Table(entity.GetType()).Update(entity, originalId)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.Update(Object, Object)\" qualifyHint=\"true\"/>\n\n   public void\n   Update(object entity, object? originalId) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      Table(entity.GetType())\n         .Update(entity, originalId);\n   }\n\n   /// <inheritdoc cref=\"SqlTable.Remove(Object)\"/>\n   /// <remarks>This method is a shortcut for <c>db.Table(entity.GetType()).Remove(entity)</c>.</remarks>\n   /// <seealso cref=\"SqlTable.Remove(Object)\" qualifyHint=\"true\"/>\n\n   public bool\n   Remove(object entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      return Table(entity.GetType())\n         .Remove(entity);\n   }\n\n   internal string\n   BuildPredicateFragment(\n         object entity,\n         IEnumerable<MetaDataMember> predicateMembers,\n         ICollection<object?> parametersBuffer,\n         Func<MetaDataMember, object>? getValueFn = null) {\n\n      var predicateValues = predicateMembers.Select(m =>\n         new KeyValuePair<string, object>(\n            m.MappedName,\n            (getValueFn is not null) ?\n               getValueFn.Invoke(m)\n               : m.GetValueForDatabase(entity)));\n\n      return BuildPredicateFragment(predicateValues, parametersBuffer);\n   }\n\n   internal string\n   BuildPredicateFragment(IEnumerable<KeyValuePair<string, object>> predicateValues, ICollection<object?> parametersBuffer) {\n\n      //if (predicateValues is null || predicateValues.Count == 0) throw new ArgumentException(\"predicateValues cannot be empty\", nameof(predicateValues));\n      ArgumentNullException.ThrowIfNull(parametersBuffer);\n\n      var sb = new StringBuilder();\n\n      foreach (var item in predicateValues) {\n\n         if (sb.Length > 0) {\n            sb.Append(\" AND \");\n         }\n\n         QuoteIdentifier(sb, item.Key);\n\n         if (item.Value is null) {\n            sb.Append(\" IS NULL\");\n         } else {\n            sb.Append(\" = {\")\n               .Append(parametersBuffer.Count)\n               .Append('}');\n\n            parametersBuffer.Add(item.Value);\n         }\n      }\n\n      return sb.ToString();\n   }\n\n   internal string\n   SelectBody(MetaType metaType, IEnumerable<MetaDataMember>? selectMembers) {\n\n      var sb = new StringBuilder();\n\n      SelectBody(sb, metaType, selectMembers, null);\n\n      return sb.ToString();\n   }\n\n   internal void\n   SelectBody(StringBuilder sb, MetaType metaType, IEnumerable<MetaDataMember>? selectMembers, string? tableAlias) {\n\n      selectMembers ??= metaType.PersistentDataMembers.Where(m => !m.IsAssociation);\n\n      var appendAlias = !String.IsNullOrEmpty(tableAlias);\n      var i = -1;\n\n      foreach (var member in selectMembers) {\n\n         i++;\n\n         var mappedName = member.MappedName;\n         var memberName = member.QueryPath;\n         var columnAlias = !String.Equals(mappedName, memberName, StringComparison.Ordinal) ?\n            memberName : null;\n\n         if (i > 0) {\n            sb.Append(',')\n               .Append(' ');\n         }\n\n         if (appendAlias) {\n            QuoteIdentifier(sb, tableAlias!);\n            sb.Append('.');\n         }\n\n         QuoteIdentifier(sb, mappedName);\n\n         if (columnAlias is not null) {\n\n            sb.Append(\" AS \");\n            QuoteIdentifier(sb, columnAlias);\n         }\n      }\n   }\n\n   internal string\n   FromBody(MetaType metaType) {\n\n      if (metaType.Table is null) throw new InvalidOperationException(\"metaType.Table cannot be null.\");\n\n      return QuoteIdentifier(metaType.Table.TableName);\n   }\n}\n\npartial class DatabaseConfiguration {\n\n   Lazy<MetaModel>\n   _model;\n\n   MetaTableConfiguration\n   _defaultMetaTableConfig;\n\n   /// <summary>\n   /// Gets the <see cref=\"MetaModel\"/> on which the mapping is based.\n   /// </summary>\n\n   internal MetaModel\n   Model => _model.Value;\n\n   /// <summary>\n   /// <c>true</c> to include version column check in SQL statements' predicates; otherwise, <c>false</c>. The default is <c>true</c>.\n   /// </summary>\n\n   public bool\n   UseVersionMember { get; set; } = true;\n\n   /// <summary>\n   /// <c>true</c> to execute batch commands when possible; otherwise, <c>false</c>. The default is <c>true</c>.\n   /// </summary>\n   /// <remarks>\n   /// This setting affects the behavior of <see cref=\"SqlTable&lt;TEntity>.AddRange(TEntity[])\"/>,\n   /// <see cref=\"SqlTable&lt;TEntity>.UpdateRange(TEntity[])\"/> and <see cref=\"SqlTable&lt;TEntity>.RemoveRange(TEntity[])\"/>.\n   /// </remarks>\n\n   public bool\n   EnableBatchCommands { get; set; } = true;\n\n   /// <summary>\n   /// The default separator to use when mapping complex properties.\n   /// The default value is null, which means no separator is used, unless an explicit separator\n   /// is specified on <see cref=\"ComplexPropertyAttribute.Separator\" qualifyHint=\"true\"/>.\n   /// </summary>\n\n   public string?\n   DefaultComplexPropertySeparator { get; set; }\n\n   internal MetaTableConfiguration\n   DefaultMetaTableConfig =>\n      _defaultMetaTableConfig ??= new MetaTableConfiguration {\n         DefaultComplexPropertySeparator = this.DefaultComplexPropertySeparator\n      };\n\n   internal void\n   SetModel(Func<MetaModel> modelFn) {\n      _model = new Lazy<MetaModel>(modelFn);\n   }\n\n   internal MetaType\n   GetMetaType(Type type) =>\n      this.Model.GetMetaType(type, this.DefaultMetaTableConfig);\n}\n\n/// <summary>\n/// A non-generic version of <see cref=\"SqlTable&lt;TEntity>\"/> which can be used when the type of the entity is not known at build time.\n/// This class cannot be instantiated, to get an instance use the <see cref=\"Database.Table(Type)\" qualifyHint=\"true\"/> method.\n/// </summary>\n\n[DebuggerDisplay($\"{{{nameof(_metaType)}.{nameof(_metaType.Name)}}}\")]\npublic sealed partial class SqlTable : SqlSet, ISqlTable {\n\n   // table is the SqlTable<TEntity> instance for metaType\n   // SqlTable is only a wrapper on SqlTable<TEntity>\n\n   readonly ISqlTable\n   _table;\n\n   readonly MetaType\n   _metaType;\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Name\"/>\n\n   public string\n   Name => _metaType.Table.TableName;\n\n   internal\n   SqlTable(Database db, MetaType metaType, ISqlTable table)\n      : base([db.FromBody(metaType), db.SelectBody(metaType, null)], metaType.Type, db) {\n\n      _table = table;\n      _metaType = metaType;\n   }\n\n   /// <summary>\n   /// Casts the current <see cref=\"SqlTable\"/> to the generic <see cref=\"SqlTable&lt;TEntity>\"/> instance.\n   /// </summary>\n   /// <typeparam name=\"TEntity\">The type of the entity.</typeparam>\n   /// <returns>The <see cref=\"SqlTable&lt;TEntity>\"/> instance for <typeparamref name=\"TEntity\"/>.</returns>\n   /// <exception cref=\"System.InvalidOperationException\">The specified <typeparamref name=\"TEntity\"/> is not valid for this instance.</exception>\n\n   public new SqlTable<TEntity>\n   Cast<TEntity>() where TEntity : class {\n\n      if (typeof(TEntity) != _metaType.Type) {\n         throw new InvalidOperationException(\"The specified type parameter is not valid for this instance.\");\n      }\n\n      return (SqlTable<TEntity>)_table;\n   }\n\n   /// <inheritdoc cref=\"SqlSet.Cast(Type)\"/>\n\n   [EditorBrowsable(EditorBrowsableState.Never)]\n   public new SqlSet\n   Cast(Type resultType) =>\n      base.Cast(resultType);\n\n   internal static void\n   EnsureEntityType(MetaType metaType) {\n\n      if (!metaType.IsEntity) {\n         throw new InvalidOperationException($\"The operation is not available for non-entity types ('{metaType.Type.FullName}').\");\n      }\n   }\n\n   // ISqlTable Members: these methods just call the same method on _table\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Add(TEntity)\"/>\n\n   public void\n   Add(object entity) =>\n      _table.Add(entity);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.AddRange(IEnumerable&lt;TEntity>)\"/>\n\n   public void\n   AddRange(IEnumerable<object> entities) =>\n      _table.AddRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.AddRange(TEntity[])\"/>\n\n   public void\n   AddRange(params object[] entities) =>\n      _table.AddRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Update(TEntity)\"/>\n\n   public void\n   Update(object entity) =>\n      _table.Update(entity);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Update(TEntity, Object)\"/>\n\n   public void\n   Update(object entity, object? originalId) =>\n      _table.Update(entity, originalId);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateRange(IEnumerable&lt;TEntity>)\"/>\n\n   public void\n   UpdateRange(IEnumerable<object> entities) =>\n      _table.UpdateRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.UpdateRange(TEntity[])\"/>\n\n   public void\n   UpdateRange(params object[] entities) =>\n      _table.UpdateRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Remove(TEntity)\"/>\n\n   public bool\n   Remove(object entity) =>\n      _table.Remove(entity);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveKey(Object)\"/>\n\n   public bool\n   RemoveKey(object id) =>\n      _table.RemoveKey(id);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveRange(IEnumerable&lt;TEntity>)\"/>\n\n   public void\n   RemoveRange(IEnumerable<object> entities) =>\n      _table.RemoveRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.RemoveRange(TEntity[])\"/>\n\n   public void\n   RemoveRange(params object[] entities) =>\n      _table.RemoveRange(entities);\n\n   /// <inheritdoc cref=\"SqlTable&lt;TEntity>.Refresh(TEntity)\"/>\n\n   public void\n   Refresh(object entity) =>\n      _table.Refresh(entity);\n}\n\n/// <summary>\n/// A <see cref=\"SqlSet&lt;TEntity>\"/> that provides CRUD (Create, Read, Update, Delete)\n/// operations for annotated classes. \n/// This class cannot be instantiated, to get an instance use the <see cref=\"Database.Table&lt;TEntity>\" qualifyHint=\"true\"/> method.\n/// </summary>\n/// <typeparam name=\"TEntity\">The type of the entity.</typeparam>\n\n[DebuggerDisplay($\"{{{nameof(_metaType)}.{nameof(_metaType.Name)}}}\")]\npublic sealed partial class SqlTable<TEntity> : SqlSet<TEntity>, ISqlTable where TEntity : class {\n\n   readonly MetaType\n   _metaType;\n\n   /// <summary>\n   /// Gets the name of the table.\n   /// </summary>\n\n   public string\n   Name => _metaType.Table.TableName;\n\n   internal\n   SqlTable(Database db, MetaType metaType)\n      : base([db.FromBody(metaType), db.SelectBody(metaType, null)], db) {\n\n      _metaType = metaType;\n   }\n\n   /// <summary>\n   /// Recursively executes INSERT commands for the specified <paramref name=\"entity\"/> and all its\n   /// one-to-one and one-to-many associations.\n   /// </summary>\n   /// <param name=\"entity\">\n   /// The object whose INSERT command is to be executed. This parameter is named entity for consistency\n   /// with the other CRUD methods, but in this case it doesn't need to be an actual entity, which means it doesn't\n   /// need to have a primary key.\n   /// </param>\n\n   public void\n   Add(TEntity entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var idMember = _metaType.DBGeneratedIdentityMember;\n\n      var outputIdMember = idMember is not null\n         && _db.Configuration.SqlDialect is SqlDialect.TSql;\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnInsert\n            && m != idMember)\n         .ToArray();\n\n      var insertSql = BuildInsertStatementForEntity(entity, outputIdMember);\n      var id = default(object);\n\n      using (var tx = _db.EnsureInTransaction()) {\n\n         if (outputIdMember) {\n\n            // this block emulates Database.Execute()\n\n            var cmd = _db.CreateCommand(insertSql);\n\n            try {\n               id = cmd.ExecuteScalar();\n\n            } catch {\n\n               _db.Trace(cmd, error: true);\n               throw;\n            }\n\n            _db.Trace(cmd);\n\n         } else {\n\n            _db.Execute(insertSql, affect: 1, exact: true);\n\n            if (idMember is not null) {\n               id = _db.LastInsertId();\n            }\n         }\n\n         if (idMember is not null) {\n\n            var convertedId = Convert.ChangeType(id, idMember.Type, CultureInfo.InvariantCulture);\n            var entityObj = (object)entity;\n\n            idMember.MemberAccessor.SetBoxedValue(ref entityObj, convertedId);\n         }\n\n         if (syncMembers.Length > 0\n            && _metaType.IsEntity) {\n\n            Refresh(entity, syncMembers);\n         }\n\n         InsertDescendants(entity);\n\n         tx.Commit();\n      }\n   }\n\n   void\n   InsertDescendants(TEntity entity) {\n\n      InsertOneToOne(entity);\n      InsertOneToMany(entity);\n   }\n\n   void\n   InsertOneToOne(TEntity entity) {\n\n      foreach (var assoc in _metaType.Associations\n            .Where(a => !a.IsMany && a.ThisKeyIsPrimaryKey && a.OtherKeyIsPrimaryKey)) {\n\n         var child = assoc.ThisMember.MemberAccessor.GetBoxedValue(entity);\n\n         if (child is null) {\n            continue;\n         }\n\n         for (int j = 0; j < assoc.ThisKey.Count; j++) {\n\n            var thisKey = assoc.ThisKey[j];\n            var otherKey = assoc.OtherKey[j];\n\n            var thisKeyVal = thisKey.MemberAccessor.GetBoxedValue(entity);\n\n            otherKey.MemberAccessor.SetBoxedValue(ref child, thisKeyVal);\n         }\n\n         var otherTable = _db.Table(assoc.OtherType);\n\n         otherTable.Add(child);\n      }\n   }\n\n   void\n   InsertOneToMany(TEntity entity) {\n\n      foreach (var assoc in _metaType.Associations.Where(a => a.IsMany)) {\n\n         var many = ((IEnumerable<object>)assoc.ThisMember.MemberAccessor.GetBoxedValue(entity) ?? [])\n            .Where(o => o is not null)\n            .ToArray();\n\n         if (many.Length == 0) {\n            continue;\n         }\n\n         foreach (var child in many) {\n\n            for (int k = 0; k < assoc.ThisKey.Count; k++) {\n\n               var thisKey = assoc.ThisKey[k];\n               var otherKey = assoc.OtherKey[k];\n\n               var thisKeyVal = thisKey.MemberAccessor.GetBoxedValue(entity);\n               var c = child;\n\n               otherKey.MemberAccessor.SetBoxedValue(ref c, thisKeyVal);\n            }\n         }\n\n         var otherTable = _db.Table(assoc.OtherType);\n         otherTable.AddRange(many);\n      }\n   }\n\n   /// <summary>\n   /// Recursively executes INSERT commands for the specified <paramref name=\"entities\"/> and all their\n   /// one-to-one and one-to-many associations.\n   /// </summary>\n   /// <param name=\"entities\">The entities whose INSERT commands are to be executed.</param>\n\n   public void\n   AddRange(IEnumerable<TEntity> entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      AddRange(entities as TEntity[] ?? entities.ToArray());\n   }\n\n   /// <inheritdoc cref=\"AddRange(IEnumerable&lt;TEntity>)\"/>\n\n   public void\n   AddRange(params TEntity[] entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         Add(entities[0]);\n         return;\n      }\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnInsert)\n         .ToArray();\n\n      var batch = syncMembers.Length == 0\n         && _db.Configuration.EnableBatchCommands;\n\n      if (batch) {\n\n         var batchInsert = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildInsertStatementForEntity(e)));\n\n         using (var tx = _db.EnsureInTransaction()) {\n\n            _db.Execute(batchInsert, affect: entities.Length, exact: true);\n\n            foreach (var e in entities) {\n               InsertDescendants(e);\n            }\n\n            tx.Commit();\n         }\n\n      } else {\n\n         using (var tx = _db.EnsureInTransaction()) {\n\n            foreach (var e in entities) {\n               Add(e);\n            }\n\n            tx.Commit();\n         }\n      }\n   }\n\n   /// <summary>\n   /// Executes an UPDATE command for the specified <paramref name=\"entity\"/>.\n   /// </summary>\n   /// <param name=\"entity\">The entity whose UPDATE command is to be executed.</param>\n\n   public void\n   Update(TEntity entity) =>\n      Update(entity, null);\n\n   /// <inheritdoc cref=\"Update(TEntity)\"/>\n   /// <param name=\"originalId\">The original primary key value.</param>\n   /// <remarks>This overload is helpful when the entity uses an assigned primary key.</remarks>\n\n   public void\n   Update(TEntity entity, object? originalId) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var updateSql = BuildUpdateStatementForEntity(entity, originalId);\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnUpdate)\n         .ToArray();\n\n      using (_db.EnsureConnectionOpen()) {\n\n         _db.Execute(updateSql, affect: 1, exact: true);\n\n         if (syncMembers.Length > 0) {\n            Refresh(entity, syncMembers);\n         }\n      }\n   }\n\n   /// <summary>\n   /// Executes UPDATE commands for the specified <paramref name=\"entities\"/>.\n   /// </summary>\n   /// <param name=\"entities\">The entities whose UPDATE commands are to be executed.</param>\n\n   public void\n   UpdateRange(IEnumerable<TEntity> entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      UpdateRange(entities as TEntity[] ?? entities.ToArray());\n   }\n\n   /// <summary>\n   /// Executes UPDATE commands for the specified <paramref name=\"entities\"/>.\n   /// </summary>\n   /// <param name=\"entities\">The entities whose UPDATE commands are to be executed.</param>\n\n   public void\n   UpdateRange(params TEntity[] entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         Update(entities[0]);\n         return;\n      }\n\n      EnsureEntityType();\n\n      var syncMembers = _metaType.PersistentDataMembers\n         .Where(m => m.AutoSync is AutoSync.Always or AutoSync.OnUpdate)\n         .ToArray();\n\n      var batch = syncMembers.Length == 0\n         && _db.Configuration.EnableBatchCommands;\n\n      if (batch) {\n\n         var batchUpdate = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildUpdateStatementForEntity(e)));\n\n         _db.Execute(batchUpdate, affect: entities.Length, exact: true);\n\n      } else {\n\n         using (var tx = _db.EnsureInTransaction()) {\n\n            foreach (var e in entities) {\n               Update(e);\n            }\n\n            tx.Commit();\n         }\n      }\n   }\n\n   /// <summary>\n   /// Executes a DELETE command for the specified <paramref name=\"entity\"/>.\n   /// </summary>\n   /// <param name=\"entity\">The entity whose DELETE command is to be executed.</param>\n   /// <returns><c>true</c> if <paramref name=\"entity\"/> is deleted; otherwise, <c>false</c>.</returns>\n\n   public bool\n   Remove(TEntity entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var deleteSql = BuildDeleteStatementForEntity(entity);\n\n      var usingVersion = _db.Configuration.UseVersionMember\n         && _metaType.VersionMember is not null;\n\n      return _db.Execute(deleteSql, affect: 1, exact: usingVersion) == 1;\n   }\n\n   /// <summary>\n   /// Executes a DELETE command for the entity\n   /// whose primary key matches the <paramref name=\"id\"/> parameter.\n   /// </summary>\n   /// <param name=\"id\">The primary key value.</param>\n   /// <returns><c>true</c> if a record that matches <paramref name=\"id\"/> was found and deleted; otherwise, <c>false</c>.</returns>\n\n   public bool\n   RemoveKey(object id) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      var deleteSql = BuildDeleteStatementForKey(id);\n\n      return _db.Execute(deleteSql, affect: 1) == 1;\n   }\n\n   /// <summary>\n   /// Executes DELETE commands for the specified <paramref name=\"entities\"/>.\n   /// </summary>\n   /// <param name=\"entities\">The entities whose DELETE commands are to be executed.</param>\n\n   public void\n   RemoveRange(IEnumerable<TEntity> entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      RemoveRange(entities as TEntity[] ?? entities.ToArray());\n   }\n\n   /// <summary>\n   /// Executes DELETE commands for the specified <paramref name=\"entities\"/>.\n   /// </summary>\n   /// <param name=\"entities\">The entities whose DELETE commands are to be executed.</param>\n\n   public void\n   RemoveRange(params TEntity[] entities) {\n\n      ArgumentNullException.ThrowIfNull(entities);\n\n      entities = entities.Where(o => o is not null)\n         .ToArray();\n\n      if (entities.Length == 0) {\n         return;\n      }\n\n      if (entities.Length == 1) {\n         Remove(entities[0]);\n         return;\n      }\n\n      EnsureEntityType();\n\n      var usingVersion = _db.Configuration.UseVersionMember\n         && _metaType.VersionMember is not null;\n\n      var singleStatement = _metaType.IdentityMembers.Count == 1\n         && !usingVersion;\n\n      var batch = _db.Configuration.EnableBatchCommands;\n\n      if (singleStatement) {\n\n         var idMember = _metaType.IdentityMembers[0];\n\n         var ids = entities.Select(e => idMember.GetValueForDatabase(e))\n            .ToArray();\n\n         var sql = BuildDeleteStatement()\n            .WHERE(String.Empty);\n\n         var sb = sql.Buffer;\n\n         _db.QuoteIdentifier(sb, idMember.MappedName);\n         sb.Append(\" IN (\");\n\n         for (int i = 0; i < ids.Length; i++) {\n\n            if (i > 0) {\n               sb.Append(',')\n                  .Append(' ');\n            }\n\n            sb.Append('{')\n               .Append(sql.ParameterValues.Count)\n               .Append('}');\n\n            sql.ParameterValues.Add(ids[i]);\n         }\n\n         sb.Append(')');\n\n         _db.Execute(sql, affect: entities.Length);\n\n      } else if (batch) {\n\n         var batchDelete = SqlBuilder.JoinSql(\n            \";\" + Environment.NewLine,\n            entities.Select(e => BuildDeleteStatementForEntity(e)));\n\n         _db.Execute(batchDelete, affect: entities.Length, exact: usingVersion);\n\n      } else {\n\n         using (var tx = _db.EnsureInTransaction()) {\n\n            foreach (var e in entities) {\n               Remove(e);\n            }\n\n            tx.Commit();\n         }\n      }\n   }\n\n   /// <summary>\n   /// Sets all column members of <paramref name=\"entity\"/> to their most current persisted value.\n   /// </summary>\n   /// <param name=\"entity\">The entity to refresh.</param>\n\n   public void\n   Refresh(TEntity entity) =>\n      Refresh(entity, null);\n\n   void\n   Refresh(TEntity entity, IEnumerable<MetaDataMember>? refreshMembers) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      EnsureEntityType();\n\n      var query = BuildSelectStatement(refreshMembers);\n      query.WHERE(_db.BuildPredicateFragment(entity, _metaType.IdentityMembers, query.ParameterValues));\n\n      var mapper = _db.CreatePocoMapper(_metaType.Type);\n\n      var entityObj = (object)entity;\n\n      _ = _db.Map<object?>(query, r => {\n         mapper.PocoLoad(entityObj, r);\n         return null;\n\n      }).SingleOrDefault();\n   }\n\n   void\n   EnsureEntityType() =>\n      SqlTable.EnsureEntityType(_metaType);\n\n   // ISqlTable Members\n\n   void\n   ISqlTable.Add(object entity) =>\n      Add((TEntity)entity);\n\n   void\n   ISqlTable.AddRange(IEnumerable<object> entities) =>\n      AddRange(entities.Cast<TEntity>());\n\n   void\n   ISqlTable.AddRange(params object[] entities) =>\n      AddRange(entities.Cast<TEntity>());\n\n   void\n   ISqlTable.Update(object entity) =>\n      Update((TEntity)entity);\n\n   void\n   ISqlTable.Update(object entity, object? originalId) =>\n      Update((TEntity)entity, originalId);\n\n   void\n   ISqlTable.UpdateRange(IEnumerable<object> entities) =>\n      UpdateRange(entities.Cast<TEntity>());\n\n   void\n   ISqlTable.UpdateRange(params object[] entities) =>\n      UpdateRange(entities.Cast<TEntity>());\n\n   bool\n   ISqlTable.Remove(object entity) =>\n      Remove((TEntity)entity);\n\n   bool\n   ISqlTable.RemoveKey(object id) =>\n      RemoveKey(id);\n\n   void\n   ISqlTable.RemoveRange(IEnumerable<object> entities) =>\n      RemoveRange(entities.Cast<TEntity>());\n\n   void\n   ISqlTable.RemoveRange(params object[] entities) =>\n      RemoveRange(entities.Cast<TEntity>());\n\n   void\n   ISqlTable.Refresh(object entity) =>\n      Refresh((TEntity)entity);\n\n   // Statement building\n\n   SqlBuilder\n   BuildSelectStatement(IEnumerable<MetaDataMember>? selectMembers) {\n\n      var sql = new SqlBuilder()\n         .SELECT(String.Empty);\n\n      _db.SelectBody(sql.Buffer, _metaType, selectMembers, null);\n\n      sql.FROM(_db.FromBody(_metaType));\n\n      return sql;\n   }\n\n   SqlBuilder\n   BuildInsertStatementForEntity(TEntity entity) =>\n      BuildInsertStatementForEntity(entity, false);\n\n   SqlBuilder\n   BuildInsertStatementForEntity(TEntity entity, bool outputIdMember) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      var insertingMembers = _metaType.PersistentDataMembers\n         .Where(m => !m.IsAssociation && !m.IsDbGenerated)\n         .ToArray();\n\n      var parameters = insertingMembers\n         .Select(m => m.GetValueForDatabase(entity))\n         .ToArray();\n\n      var sql = new SqlBuilder();\n\n      var sb = sql.Buffer\n         .Append(\"INSERT INTO \");\n\n      _db.QuoteIdentifier(sb, _metaType.Table.TableName);\n      sb.Append(\" (\");\n\n      for (int i = 0; i < insertingMembers.Length; i++) {\n\n         if (i > 0) {\n            sb.Append(\", \");\n         }\n\n         _db.QuoteIdentifier(sb, insertingMembers[i].MappedName);\n      }\n\n      sb.Append(')');\n\n      if (outputIdMember\n         && _metaType.DBGeneratedIdentityMember is { } idMember) {\n\n         sb.AppendLine()\n            .Append(\"OUTPUT INSERTED.\");\n         _db.QuoteIdentifier(sb, idMember.MappedName);\n      }\n\n      sb.AppendLine()\n         .Append(\"VALUES (\");\n\n      for (int i = 0; i < insertingMembers.Length; i++) {\n\n         if (i > 0) {\n            sb.Append(\", \");\n         }\n\n         sb.Append('{')\n            .Append(i)\n            .Append('}');\n      }\n\n      sb.Append(')');\n\n      foreach (var item in parameters) {\n         sql.ParameterValues.Add(item);\n      }\n\n      return sql;\n   }\n\n   SqlBuilder\n   BuildUpdateStatementForEntity(TEntity entity) =>\n      BuildUpdateStatementForEntity(entity, null);\n\n   SqlBuilder\n   BuildUpdateStatementForEntity(TEntity entity, object? originalId) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      EnsureEntityType();\n\n      var updatingMembers = _metaType.PersistentDataMembers\n         .Where(m => !m.IsAssociation && !m.IsDbGenerated)\n         .ToArray();\n\n      var predicateMembers = _metaType.PersistentDataMembers\n         .Where(m => m.IsPrimaryKey || (m.IsVersion && _db.Configuration.UseVersionMember))\n         .ToArray();\n\n      if (originalId is not null\n         && predicateMembers.Count(m => m.IsPrimaryKey) > 1) {\n\n         throw new InvalidOperationException(\"The operation is not supported for entities with more than one identity member.\");\n      }\n\n      var sql = new SqlBuilder();\n      var parametersBuffer = sql.ParameterValues;\n\n      var sb = sql.Buffer\n         .Append(\"UPDATE \");\n\n      _db.QuoteIdentifier(sb, _metaType.Table.TableName);\n\n      sb.AppendLine()\n         .Append(\"SET \");\n\n      for (int i = 0; i < updatingMembers.Length; i++) {\n\n         if (i > 0) {\n            sb.Append(\", \");\n         }\n\n         var member = updatingMembers[i];\n         var value = member.GetValueForDatabase(entity);\n\n         _db.QuoteIdentifier(sb, member.MappedName);\n\n         sb.Append(\" = {\")\n            .Append(parametersBuffer.Count)\n            .Append('}');\n\n         parametersBuffer.Add(value);\n      }\n\n      var getValuefn = default(Func<MetaDataMember, object>);\n\n      if (originalId is not null) {\n\n         getValuefn = m => (m.IsPrimaryKey) ?\n            m.ConvertValueForDatabase(originalId)\n            : m.GetValueForDatabase(entity);\n      }\n\n      sb.AppendLine()\n         .Append(\"WHERE \")\n         .Append(_db.BuildPredicateFragment(entity, predicateMembers, parametersBuffer, getValuefn));\n\n      return sql;\n   }\n\n   SqlBuilder\n   BuildDeleteStatement() {\n\n      var sql = new SqlBuilder()\n         .Append(\"DELETE FROM \");\n\n      _db.QuoteIdentifier(sql.Buffer, _metaType.Table.TableName);\n\n      return sql;\n   }\n\n   SqlBuilder\n   BuildDeleteStatementForEntity(TEntity entity) {\n\n      ArgumentNullException.ThrowIfNull(entity);\n\n      EnsureEntityType();\n\n      var predicateMembers = _metaType.PersistentDataMembers\n         .Where(m => m.IsPrimaryKey || (m.IsVersion && _db.Configuration.UseVersionMember));\n\n      var deleteSql = BuildDeleteStatement();\n      deleteSql.WHERE(_db.BuildPredicateFragment(entity, predicateMembers, deleteSql.ParameterValues));\n\n      return deleteSql;\n   }\n\n   SqlBuilder\n   BuildDeleteStatementForKey(object id) {\n\n      ArgumentNullException.ThrowIfNull(id);\n\n      EnsureEntityType();\n\n      if (_metaType.IdentityMembers.Count > 1) {\n         throw new InvalidOperationException(\"Cannot call this method when the entity has more than one identity member.\");\n      }\n\n      var deleteSql = BuildDeleteStatement()\n         .WHERE(String.Empty);\n\n      var sb = deleteSql.Buffer;\n\n      _db.QuoteIdentifier(sb, _metaType.IdentityMembers[0].MappedName);\n\n      sb.Append(\" = {\")\n         .Append(deleteSql.ParameterValues.Count)\n         .Append('}');\n\n      deleteSql.ParameterValues.Add(id);\n\n      return deleteSql;\n   }\n}\n\npartial interface ISqlTable {\n\n   string\n   Name { get; }\n\n   void\n   Add(object entity);\n\n   void\n   AddRange(IEnumerable<object> entities);\n\n   void\n   AddRange(params object[] entities);\n\n   bool\n   Remove(object entity);\n\n   bool\n   RemoveKey(object id);\n\n   void\n   RemoveRange(IEnumerable<object> entities);\n\n   void\n   RemoveRange(params object[] entities);\n\n   void\n   Refresh(object entity);\n\n   void\n   Update(object entity);\n\n   void\n   Update(object entity, object? originalId);\n\n   void\n   UpdateRange(IEnumerable<object> entities);\n\n   void\n   UpdateRange(params object[] entities);\n}\n\npartial class PocoNode {\n\n   ColumnAttribute?\n   _columnAttribute;\n\n   private ColumnAttribute?\n   ColumnAttribute => _columnAttribute\n      ??= this.Property?.GetCustomAttribute<ColumnAttribute>();\n\n   partial void\n   GetConvertToType(ref Type? convertToType) {\n      convertToType = this.ColumnAttribute?.ConvertTo;\n   }\n}\n"
  },
  {
    "path": "src/DbExtensions-QE/DbExtensions-QE.csproj",
    "content": "﻿<Project>\n\n  <PropertyGroup>\n    <AssemblyName>DbExtensions</AssemblyName>\n    <AssemblyTitle>$(AssemblyName) Query Edition</AssemblyTitle>\n    <PackageId>$(AssemblyName)-QE</PackageId>\n    <PackageReadmeFile>README.md</PackageReadmeFile>\n  </PropertyGroup>\n\n  <Import Project=\"..\\DbExtensions\\DbExtensions.csproj\" />\n\n  <PropertyGroup>\n    <DefineConstants>$(DefineConstants);DBEX_QE</DefineConstants>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <Compile Include=\"..\\DbExtensions\\Database.cs\" Link=\"Database.cs\" />\n    <Compile Include=\"..\\DbExtensions\\DynamicMapper.cs\" Link=\"DynamicMapper.cs\" />\n    <Compile Include=\"..\\DbExtensions\\Extensions.cs\" Link=\"Extensions.cs\" />\n    <Compile Include=\"..\\DbExtensions\\Mapper.cs\" Link=\"Mapper.cs\" />\n    <Compile Include=\"..\\DbExtensions\\PocoMapper.cs\" Link=\"PocoMapper.cs\" />\n    <Compile Include=\"..\\DbExtensions\\Properties\\AssemblyInfo.cs\" Link=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlBuilder.cs\" Link=\"SqlBuilder.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlSet.Async.cs\" Link=\"SqlSet.Async.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlSet.cs\" Link=\"SqlSet.cs\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Include=\"README.md\" Pack=\"true\" PackagePath=\"\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/DbExtensions-QE/README.md",
    "content": "﻿DbExtensions-QE (Query Edition) is a version of DbExtensions that excludes:\n\n- SqlTable, SqlTable&lt;T>\n- Annotations (TableAttribute, ColumnAttribute, etc.)\n- SqlSet methods that depend on annotations (Contains, ContainsKey, Find, Include)\n- Internal Metadata namespace\n\nQuery Edition is intended for projects where the CRUD operations are source-generated, or implemented using another ORM.\n"
  },
  {
    "path": "src/DbExtensions.SqlBuilder/DbExtensions.SqlBuilder.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0</TargetFrameworks>\n    <LangVersion>12</LangVersion>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <Compile Include=\"..\\DbExtensions\\Properties\\AssemblyInfo.cs\" Link=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlBuilder.cs\" Link=\"SqlBuilder.cs\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/DbExtensions.SqlBuilder/README.md",
    "content": "﻿This project is here to make sure [SqlBuilder][1] compiles as a standalone component.\n\n[1]: ../DbExtensions/SqlBuilder.cs"
  },
  {
    "path": "src/DbExtensions.SqlSet/DbExtensions.SqlSet.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0</TargetFrameworks>\n    <LangVersion>12</LangVersion>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"System.Linq.AsyncEnumerable\" Version=\"10.0.0\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <Compile Include=\"..\\DbExtensions\\Properties\\AssemblyInfo.cs\" Link=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"..\\DbExtensions\\Database.cs\" Link=\"Database.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlBuilder.cs\" Link=\"SqlBuilder.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlSet.cs\" Link=\"SqlSet.cs\" />\n    <Compile Include=\"..\\DbExtensions\\SqlSet.Async.cs\" Link=\"SqlSet.Async.cs\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "src/DbExtensions.SqlSet/README.md",
    "content": "﻿This project is here to make sure [SqlSet][1] compiles without any references to mapping components.\n\n[1]: ../DbExtensions/SqlSet.cs"
  },
  {
    "path": "tests/DbExtensions.Tests/DbExtensions.Tests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0</TargetFrameworks>\n    <LangVersion>12</LangVersion>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Appveyor.TestLogger\" Version=\"2.0.0\" />\n    <PackageReference Include=\"Moq\" Version=\"4.16.1\" />\n    <PackageReference Include=\"NUnit\" Version=\"3.14.0\" />\n    <PackageReference Include=\"NUnit3TestAdapter\" Version=\"3.17.0\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.12.0\" />\n    <PackageReference Include=\"System.Data.SQLite.Core\" Version=\"1.0.119\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\DbExtensions\\DbExtensions.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/DynamicMappingBehavior.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class DynamicMappingBehavior {\n\n      [Test]\n      public void Constructor_Parameters_Not_Allowed() {\n\n         var data = new Dictionary<string, object> {\n            { \"1\", \"foo\" }\n         };\n\n         var db = MockQuery(data);\n\n         var results = db.Map(SQL\n            .SELECT(\"NULL\"));\n\n         Assert.Throws<ArgumentException>(() => results.Single());\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/EnumMappingBehavior.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping.Annotated {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class EnumMappingBehavior {\n\n      readonly Database db = RealDatabase();\n\n      [Test]\n      public void Can_Map_Numeric_Column_To_Enum() {\n\n         var item = db.Table<Enum.ToNumericColumn.Product>()\n            .First($\"CategoryID = {Enum.CategoryEnum.Condiments}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryID);\n         Assert.AreEqual((int)Enum.CategoryEnum.Condiments, (int)item.CategoryID);\n      }\n\n      [Test]\n      public void Can_Map_Numeric_Column_To_Nullable_Enum() {\n\n         var item = db.Table<Enum.NullableToNumericColumn.Product>()\n            .First($\"CategoryID = {Enum.CategoryEnum.Condiments}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryID);\n         Assert.AreEqual((int)Enum.CategoryEnum.Condiments, (int)item.CategoryID);\n      }\n\n      [Test]\n      public void Can_Persist_Enum_To_Numeric_Column() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<Enum.ToNumericColumn.Product>();\n\n            var item = new Enum.ToNumericColumn.Product {\n               CategoryID = Enum.CategoryEnum.Beverages,\n               ProductName = \"\"\n            };\n\n            table.Add(item);\n\n            Assert.AreEqual(1, table.Count($\"ProductID = {item.ProductID} AND CategoryID = {item.CategoryID}\"));\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Persist_Nullable_Enum_To_Numeric_Column() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<Enum.NullableToNumericColumn.Product>();\n\n            var item = new Enum.NullableToNumericColumn.Product {\n               CategoryID = Enum.CategoryEnum.Beverages,\n               ProductName = \"\"\n            };\n\n            table.Add(item);\n\n            Assert.AreEqual(1, table.Count($\"ProductID = {item.ProductID} AND CategoryID = {item.CategoryID}\"));\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Map_Text_Column_To_Enum() {\n\n         var item = db.Table<Enum.ToTextColumn.Category>()\n            .Single($\"CategoryName = {Enum.CategoryEnum.Condiments.ToString()}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryName);\n         Assert.AreEqual(Enum.CategoryEnum.Condiments.ToString(), item.CategoryName.ToString());\n      }\n\n      [Test]\n      public void Can_Map_Text_Column_To_Nullable_Enum() {\n\n         var item = db.Table<Enum.NullableToTextColumn.Category>()\n            .Single($\"CategoryName = {Enum.CategoryEnum.Condiments.ToString()}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryName);\n         Assert.AreEqual(Enum.CategoryEnum.Condiments.ToString(), item.CategoryName.ToString());\n      }\n\n      [Test]\n      public void Can_Persist_Enum_To_Text_Column() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<Enum.ToTextColumn.Category>();\n\n            var item = new Enum.ToTextColumn.Category {\n               CategoryName = Enum.CategoryEnum.Foo\n            };\n\n            table.Add(item);\n\n            Assert.AreEqual(1, table.Count($\"CategoryID = {item.CategoryID} AND CategoryName = {item.CategoryName.ToString()}\"));\n\n            item.CategoryName = Enum.CategoryEnum.Bar;\n\n            table.Update(item);\n\n            Assert.AreEqual(1, table.Count($\"CategoryID = {item.CategoryID} AND CategoryName = {item.CategoryName.ToString()}\"));\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Persist_Nullable_Enum_To_Text_Column() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<Enum.NullableToTextColumn.Category>();\n\n            var item = new Enum.NullableToTextColumn.Category {\n               CategoryName = Enum.CategoryEnum.Foo\n            };\n\n            table.Add(item);\n\n            Assert.AreEqual(1, table.Count($\"CategoryID = {item.CategoryID} AND CategoryName = {item.CategoryName.ToString()}\"));\n\n            item.CategoryName = Enum.CategoryEnum.Bar;\n\n            table.Update(item);\n\n            Assert.AreEqual(1, table.Count($\"CategoryID = {item.CategoryID} AND CategoryName = {item.CategoryName.ToString()}\"));\n\n            tx.Rollback();\n         }\n      }\n   }\n\n   namespace Enum {\n\n      public enum CategoryEnum {\n         Beverages = 1,\n         Condiments = 2,\n         Foo = 1000,\n         Bar = 1001\n      }\n\n      namespace ToNumericColumn {\n\n         [Table(Name = \"Products\")]\n         public class Product {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int ProductID { get; set; }\n\n            [Column]\n            public string ProductName { get; set; }\n\n            [Column]\n            public CategoryEnum CategoryID { get; set; }\n         }\n      }\n\n      namespace NullableToNumericColumn {\n\n         [Table(Name = \"Products\")]\n         public class Product {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int ProductID { get; set; }\n\n            [Column]\n            public string ProductName { get; set; }\n\n            [Column]\n            public CategoryEnum? CategoryID { get; set; }\n         }\n      }\n\n      namespace ToTextColumn {\n\n         [Table(Name = \"Categories\")]\n         public class Category {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int CategoryID { get; set; }\n\n            [Column(ConvertTo = typeof(string))]\n            public CategoryEnum CategoryName { get; set; }\n         }\n      }\n\n      namespace NullableToTextColumn {\n\n         [Table(Name = \"Categories\")]\n         public class Category {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int CategoryID { get; set; }\n\n            [Column(ConvertTo = typeof(string))]\n            public CategoryEnum? CategoryName { get; set; }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/PersistentComplexPropertiesBehavior.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping.Annotated {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class PersistentComplexPropertiesBehavior() {\n\n      readonly Database db = RealDatabase();\n\n      [Test]\n      public void Can_Read_Default_Name() {\n\n         var entity = db.Table<PersistentComplexProperties.DefaultName.Customer>()\n            .Find(\"ANATR\");\n\n         Assert.IsNotNull(entity);\n         Assert.IsNotNull(entity.Contact);\n         Assert.AreEqual(\"Ana Trujillo\", entity.Contact.Name);\n         Assert.AreEqual(\"Owner\", entity.Contact.Title);\n      }\n\n      [Test]\n      public void Can_Read_Custom_Name() {\n\n         var entity = db.Table<PersistentComplexProperties.CustomName.Customer>()\n            .Find(\"ANATR\");\n\n         Assert.IsNotNull(entity);\n         Assert.IsNotNull(entity.CustomerContact);\n         Assert.AreEqual(\"Ana Trujillo\", entity.CustomerContact.Name);\n         Assert.AreEqual(\"Owner\", entity.CustomerContact.Title);\n      }\n\n      [Test]\n      public void Can_Insert() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<PersistentComplexProperties.Insert.Customer>();\n\n            var entity = new PersistentComplexProperties.Insert.Customer {\n               CustomerID = \"XXXXX\",\n               CompanyName = \"X5 Corp.\",\n               Contact = new PersistentComplexProperties.Insert.Contact {\n                  Name = \"Mr. X\",\n                  Title = \"Owner\"\n               }\n            };\n\n            table.Add(entity);\n\n            entity = table.Find(entity.CustomerID);\n\n            Assert.IsNotNull(entity);\n            Assert.AreEqual(\"XXXXX\", entity.CustomerID);\n            Assert.IsNotNull(entity.Contact);\n            Assert.AreEqual(\"Mr. X\", entity.Contact.Name);\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Update() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<PersistentComplexProperties.Update.Customer>();\n\n            var entity = table.Find(\"ANATR\");\n\n            Assert.AreEqual(\"Ana Trujillo\", entity.Contact.Name);\n\n            entity.Contact.Name = \"Ana Torroja\";\n\n            table.Update(entity);\n\n            entity = table.Find(entity.CustomerID);\n\n            Assert.AreEqual(\"Ana Torroja\", entity.Contact.Name);\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Update_Null_Complex_Property() {\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var table = db.Table<PersistentComplexProperties.UpdateNullComplexProperty.Customer>();\n\n            var entity = table.Find(\"ANATR\");\n\n            Assert.AreEqual(\"Ana Trujillo\", entity.Contact.Name);\n\n            entity.Contact = null;\n\n            table.Update(entity);\n\n            Assert.IsTrue(table.Any($\"CustomerID = {entity.CustomerID} AND ContactName IS NULL AND ContactTitle IS NULL\"));\n\n            entity = table.Find(entity.CustomerID);\n\n            Assert.IsNull(entity.Contact);\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Configure_Default_Separator() {\n\n         var db = MockDatabase();\n         db.Configuration.DefaultComplexPropertySeparator = \"$\";\n\n         var expected = SQL\n            .SELECT(db.QuoteIdentifier(\"CustomerID\"))\n            ._(db.QuoteIdentifier(\"CompanyName\"))\n            ._(db.QuoteIdentifier(\"Contact$Name\"))\n            ._(db.QuoteIdentifier(\"Contact$Title\"))\n            .FROM(db.QuoteIdentifier(\"Customers\"));\n\n         var actual = db.Table<PersistentComplexProperties.ConfigureSeparator.Customer>();\n\n         Assert.IsTrue(SqlEquals(actual, expected));\n      }\n\n      [Test]\n      public void Can_Override_Default_Separator() {\n\n         var db = MockDatabase();\n         db.Configuration.DefaultComplexPropertySeparator = \"$\";\n\n         var expected = SQL\n            .SELECT(db.QuoteIdentifier(\"CustomerID\"))\n            ._(db.QuoteIdentifier(\"CompanyName\"))\n            ._(db.QuoteIdentifier(\"Contact_Name\") + \" AS \" + db.QuoteIdentifier(\"Contact$Name\"))\n            ._(db.QuoteIdentifier(\"Contact_Title\") + \" AS \" + db.QuoteIdentifier(\"Contact$Title\"))\n            .FROM(db.QuoteIdentifier(\"Customers\"));\n\n         var actual = db.Table<PersistentComplexProperties.OverrideSeparator.Customer>();\n\n         Assert.IsTrue(SqlEquals(actual, expected));\n      }\n\n      [Test]\n      public void Can_Override_Default_Separator_With_Empty_String() {\n\n         var db = MockDatabase();\n         db.Configuration.DefaultComplexPropertySeparator = \"$\";\n\n         var expected = SQL\n            .SELECT(db.QuoteIdentifier(\"CustomerID\"))\n            ._(db.QuoteIdentifier(\"CompanyName\"))\n            ._(db.QuoteIdentifier(\"ContactName\") + \" AS \" + db.QuoteIdentifier(\"Contact$Name\"))\n            ._(db.QuoteIdentifier(\"ContactTitle\") + \" AS \" + db.QuoteIdentifier(\"Contact$Title\"))\n            .FROM(db.QuoteIdentifier(\"Customers\"));\n\n         var actual = db.Table<PersistentComplexProperties.OverrideSeparatorEmptyString.Customer>();\n\n         Assert.IsTrue(SqlEquals(actual, expected));\n      }\n   }\n\n   namespace PersistentComplexProperties {\n\n      namespace DefaultName {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace CustomName {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty(Name = \"Contact\")]\n            public Contact CustomerContact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace Insert {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace Update {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace UpdateNullComplexProperty {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace ConfigureSeparator {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace OverrideSeparator {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty(Separator = \"_\")]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n\n      namespace OverrideSeparatorEmptyString {\n\n         [Table(Name = \"Customers\")]\n         class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n\n            [ComplexProperty(Separator = \"\")]\n            public Contact Contact { get; set; }\n         }\n\n         class Contact {\n\n            [Column]\n            public string Name { get; set; }\n\n            [Column]\n            public string Title { get; set; }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/PocoMappingBehavior.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping.Poco {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class PocoMappingBehavior() {\n\n      [Test]\n      public void Map_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"a\", value.Foo);\n      }\n\n      [Test]\n      public void Map_Null_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Null_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Foo);\n      }\n\n      [Test]\n      public void Map_Object() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Object>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"a\", value.Foo);\n      }\n\n      [Test]\n      public void Map_Property_Private_Setter() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Property_Private_Setter>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"a\", value.Foo);\n      }\n\n      [Test]\n      public void Ignore_Unmapped_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo\", \"a\" },\n            { \"Bar\", \"b\" }\n         };\n\n         var db = MockQuery(data);\n\n         _ = db.Map<PocoMapping.Ignore_Unmapped_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n      }\n\n      [Test]\n      public void Map_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Bar$Foo\", \"b\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNotNull(value.Bar);\n         Assert.AreEqual(\"b\", value.Bar.Foo);\n      }\n\n      [Test]\n      public void Map_Null_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Bar\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Null_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Bar);\n      }\n\n      [Test]\n      public void Map_Complex_Property_To_Null_When_All_Subproperties_Are_Null() {\n\n         var data = new Dictionary<string, object> {\n            { \"Nested$Foo\", null },\n            { \"Nested$Bar\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Complex_Property_To_Null_When_All_Subproperties_Are_Null>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Nested);\n      }\n\n      [Test]\n      public void Load_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo$B\", 2 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Load_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(1, value.Foo.A);\n      }\n\n      [Test]\n      public void Map_Constructor() {\n\n         var data = new Dictionary<string, object> {\n            { \"1\", 5 },\n            { \"2\", \"b\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(5, value.Foo);\n         Assert.AreEqual(\"b\", value.Bar);\n      }\n\n      [Test]\n      public void Fail_When_Duplicate_Arguments() {\n\n         var data = new KeyValuePair<string, object>[] {\n            new(\"1\", \"http://example.com\"),\n            new(\"1\", \"http://example.com\"),\n         };\n\n         var db = MockQuery(data);\n\n         var results = db.Map<Uri>(SQL\n            .SELECT(\"NULL\"));\n\n         Assert.Throws<InvalidOperationException>(() => results.Single());\n      }\n\n      [Test]\n      public void Fail_When_Multiple_Constructors_With_Same_Number_Of_Parameters() {\n\n         var data = new Dictionary<string, object> {\n            { \"1\", \"http://example.com\" },\n            { \"2\", 1 }\n         };\n\n         var db = MockQuery(data);\n\n         var results = db.Map<Uri>(SQL\n            .SELECT(\"NULL\"));\n\n         Assert.Throws<InvalidOperationException>(() => results.Single());\n      }\n\n      [Test]\n      public void Map_Constructor_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Url$1\", \"http://example.com\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNotNull(value.Url);\n         Assert.AreEqual(\"http://example.com\", value.Url.OriginalString);\n      }\n\n      [Test]\n      public void Map_Constructor_Nullable_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo1$1\", 1 },\n            { \"Foo2\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor_Nullable_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(1, value.Foo1.Value.A);\n         Assert.IsNull(value.Foo2);\n      }\n\n      [Test]\n      public void Map_Constructor_Complex_Property_To_Null_When_All_Arguments_And_Subproperties_Are_Null() {\n\n         var data = new Dictionary<string, object> {\n            { \"Foo$1\", null },\n            { \"Foo$Foo\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor_Complex_Property_To_Null_When_All_Arguments_And_Subproperties_Are_Null>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Foo);\n      }\n\n      [Test]\n      public void Map_Constructor_Complex_Argument_To_Null_When_All_Arguments_And_Subproperties_Are_Null() {\n\n         var data = new Dictionary<string, object> {\n            { \"1$1\", null },\n            { \"1$Foo\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor_Complex_Argument_To_Null_When_All_Arguments_And_Subproperties_Are_Null>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Foo);\n      }\n\n      [Test]\n      public void Load_Constructor_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"1\", 1 },\n            { \"Foo$A\", 2 },\n            { \"Foo$Bar$B\", 2 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Load_Constructor_Complex_Property>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(1, value.Foo.Bar.A);\n      }\n\n      [Test]\n      public void Load_Constructor_Complex_Argument() {\n\n         var data = new Dictionary<string, object> {\n            { \"1$A\", 2 },\n            { \"1$Bar$B\", 2 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Load_Constructor_Complex_Argument>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(1, value.Foo.Bar.A);\n      }\n\n      [Test]\n      public void Map_Null_Constructor_Argument() {\n\n         var data = new Dictionary<string, object> {\n            { \"1\", 1 },\n            { \"2\", null }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Null_Constructor_Argument>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNull(value.Url);\n      }\n\n      [Test]\n      public void Map_Constructor_Nested() {\n\n         var data = new Dictionary<string, object> {\n            { \"1$1\", 5 },\n            { \"1$2\", \"b\" }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<PocoMapping.Map_Constructor_Nested>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.IsNotNull(value.Nested);\n         Assert.AreEqual(5, value.Nested.Foo);\n         Assert.AreEqual(\"b\", value.Nested.Bar);\n      }\n   }\n\n   namespace PocoMapping {\n\n      class Map_Property {\n         public string Foo { get; set; }\n      }\n\n      class Map_Null_Property {\n         public string Foo { get; set; }\n      }\n\n      class Map_Object {\n         public string Foo { get; set; }\n      }\n\n      class Map_Property_Private_Setter {\n         public string Foo { get; private set; }\n      }\n\n      class Ignore_Unmapped_Property {\n         public string Foo { get; set; }\n      }\n\n      class Map_Complex_Property {\n\n         public string Foo { get; set; }\n         public Map_Complex_Property Bar { get; set; }\n      }\n\n      class Map_Null_Complex_Property {\n\n         public string Foo { get; set; }\n         public Map_Null_Complex_Property Bar { get; set; }\n      }\n\n      class Map_Complex_Property_To_Null_When_All_Subproperties_Are_Null {\n\n         public string Foo { get; set; }\n         public string Bar { get; set; }\n         public Map_Complex_Property_To_Null_When_All_Subproperties_Are_Null Nested { get; set; }\n      }\n\n      class Load_Complex_Property {\n\n         public FooClass Foo { get; set; }\n\n         public Load_Complex_Property() {\n            this.Foo = new FooClass {\n               A = 1\n            };\n         }\n\n         public class FooClass {\n            public int A { get; set; }\n            public int B { get; set; }\n         }\n      }\n\n      class Map_Constructor {\n\n         public int Foo { get; }\n\n         public string Bar { get; }\n\n         public Map_Constructor(int foo, string bar) {\n            this.Foo = foo;\n            this.Bar = bar;\n         }\n      }\n\n      class Map_Constructor_Complex_Property {\n         public Uri Url { get; set; }\n      }\n\n      class Map_Constructor_Nullable_Complex_Property {\n\n         public Foo? Foo1 { get; set; }\n         public Foo? Foo2 { get; set; }\n\n         public struct Foo {\n\n            public readonly int A;\n\n            public Foo(int a) {\n               this.A = a;\n            }\n         }\n      }\n\n      class Map_Constructor_Complex_Property_To_Null_When_All_Arguments_And_Subproperties_Are_Null {\n\n         public FooClass Foo { get; set; }\n\n         public class FooClass {\n\n            public string Foo { get; set; }\n\n            public FooClass(int? id) { }\n         }\n      }\n\n      class Map_Constructor_Complex_Argument_To_Null_When_All_Arguments_And_Subproperties_Are_Null {\n\n         public readonly FooClass Foo;\n\n         public Map_Constructor_Complex_Argument_To_Null_When_All_Arguments_And_Subproperties_Are_Null(FooClass foo) {\n            this.Foo = foo;\n         }\n\n         public class FooClass {\n\n            public string Foo { get; set; }\n\n            public FooClass(int? id) { }\n         }\n      }\n\n      class Load_Constructor_Complex_Property {\n\n         public readonly int A;\n         public FooClass Foo { get; set; }\n\n         public Load_Constructor_Complex_Property(int a) {\n            this.A = a;\n         }\n\n         public class FooClass {\n\n            public int A { get; set; }\n            public BarClass Bar { get; set; }\n\n            public FooClass() {\n               this.Bar = new BarClass {\n                  A = 1\n               };\n            }\n\n            public class BarClass {\n               public int A { get; set; }\n               public int B { get; set; }\n            }\n         }\n      }\n\n      class Load_Constructor_Complex_Argument {\n\n         public readonly FooClass Foo;\n         public int A { get; set; }\n\n         public Load_Constructor_Complex_Argument(FooClass foo) {\n            this.Foo = foo;\n         }\n\n         public class FooClass {\n\n            public int A { get; set; }\n            public BarClass Bar { get; set; }\n\n            public FooClass() {\n               this.Bar = new BarClass {\n                  A = 1\n               };\n            }\n\n            public class BarClass {\n               public int A { get; set; }\n               public int B { get; set; }\n            }\n         }\n      }\n\n      class Map_Null_Constructor_Argument {\n\n         public readonly int Id;\n         public readonly Uri Url;\n\n         public Map_Null_Constructor_Argument(int id) {\n            this.Id = id;\n         }\n\n         public Map_Null_Constructor_Argument(int id, Uri url)\n            : this(id) {\n\n            this.Url = url;\n         }\n      }\n\n      class Map_Constructor_Nested {\n\n         public NestedClass Nested { get; }\n\n         public Map_Constructor_Nested(NestedClass nested) {\n            this.Nested = nested;\n         }\n\n         public class NestedClass {\n\n            public int Foo { get; }\n\n            public string Bar { get; }\n\n            public NestedClass(int foo, string bar) {\n               this.Foo = foo;\n               this.Bar = bar;\n            }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/PocoMappingConstructorBehavior.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping.Poco {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class PocoMappingConstructorBehavior {\n\n      [Test]\n      public void Map_Constructor_Named_Arguments() {\n\n         var data = new Dictionary<string, object> {\n            { \"name\", \"John\" },\n            { \"id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<Poco.Constructor.NamedArguments._Basic>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"John\", value.nameArg);\n         Assert.AreEqual(5, value.idArg);\n      }\n\n      [Test]\n      public void Map_Constructor_Named_Arguments_Matching_Properties() {\n\n         var data = new Dictionary<string, object> {\n            { \"name\", \"John\" },\n            { \"id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<Poco.Constructor.NamedArguments._ParamsMatchProperties>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"John\", value.nameArg);\n         Assert.AreEqual(5, value.idArg);\n         Assert.IsNull(value.name);\n         Assert.AreEqual(0, value.id);\n      }\n\n      [Test]\n      public void Map_Constructor_Named_Arguments_Missing_Arg() {\n\n         var data = new Dictionary<string, object> {\n            { \"name\", \"John\" },\n            { \"id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var results = db.Map<Poco.Constructor.NamedArguments._MissingArg>(SQL\n            .SELECT(\"NULL\"));\n\n         Assert.Throws<InvalidOperationException>(() => results.Single());\n      }\n\n      [Test]\n      public void Map_Constructor_Named_Arguments_Complex_Property() {\n\n         var data = new Dictionary<string, object> {\n            { \"prop$name\", \"John\" },\n            { \"prop$id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<Poco.Constructor.NamedArguments._ComplexProperty>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"John\", value.prop.nameArg);\n         Assert.AreEqual(5, value.prop.idArg);\n      }\n\n      [Test]\n      public void Map_Constructor_Named_Arguments_Complex_Argument() {\n\n         var data = new Dictionary<string, object> {\n            { \"0$name\", \"John\" },\n            { \"0$id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<Poco.Constructor.NamedArguments._ComplexArgument>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"John\", value.valueArg.nameArg);\n         Assert.AreEqual(5, value.valueArg.idArg);\n      }\n\n      [Test]\n      public void Map_Constructor_Named_Arguments_Nested() {\n\n         var data = new Dictionary<string, object> {\n            { \"value$name\", \"John\" },\n            { \"value$id\", 5 }\n         };\n\n         var db = MockQuery(data);\n\n         var value = db.Map<Poco.Constructor.NamedArguments._Nested>(SQL\n            .SELECT(\"NULL\"))\n            .Single();\n\n         Assert.AreEqual(\"John\", value.valueArg.nameArg);\n         Assert.AreEqual(5, value.valueArg.idArg);\n      }\n   }\n\n   namespace Constructor.NamedArguments {\n\n      class _Basic {\n\n         public readonly int idArg;\n         public readonly string nameArg;\n\n         public _Basic(int id, string name) {\n            this.idArg = id;\n            this.nameArg = name;\n         }\n      }\n\n      class _ParamsMatchProperties {\n\n         public readonly int idArg;\n         public readonly string nameArg;\n\n         public int id { get; set; }\n         public string name { get; set; }\n\n         public _ParamsMatchProperties(int id, string name) {\n            this.idArg = id;\n            this.nameArg = name;\n         }\n      }\n\n      class _MissingArg {\n\n         public _MissingArg(int id, string name, DateTime dob) { }\n      }\n\n      class _ComplexProperty {\n\n         public _ComplexPropertyType prop { get; set; }\n\n         public class _ComplexPropertyType {\n\n            public readonly int idArg;\n            public readonly string nameArg;\n\n            public _ComplexPropertyType(int id, string name) {\n               this.idArg = id;\n               this.nameArg = name;\n            }\n         }\n      }\n\n      class _ComplexArgument {\n\n         public readonly _ComplexArgumentType valueArg;\n\n         public _ComplexArgument(_ComplexArgumentType value) {\n            this.valueArg = value;\n         }\n\n         public class _ComplexArgumentType {\n\n            public readonly int idArg;\n            public readonly string nameArg;\n\n            public _ComplexArgumentType(int id, string name) {\n               this.idArg = id;\n               this.nameArg = name;\n            }\n         }\n      }\n\n      class _Nested {\n\n         public readonly _NestedType valueArg;\n\n         public _Nested(_NestedType value) {\n            this.valueArg = value;\n         }\n\n         public class _NestedType {\n\n            public readonly int idArg;\n            public readonly string nameArg;\n\n            public _NestedType(int id, string name) {\n               this.idArg = id;\n               this.nameArg = name;\n            }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Mapping/PocoMappingEnumBehavior.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Mapping.Poco {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class PocoMappingEnumBehavior {\n\n      readonly Database db = RealDatabase();\n\n      [Test]\n      public void Can_Map_Numeric_Column_To_Enum() {\n\n         var item = db.From<Enum.ToNumericColumn.Product>(\"Products\")\n            .First($\"CategoryID = {Enum.CategoryEnum.Condiments}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryID);\n         Assert.AreEqual((int)Enum.CategoryEnum.Condiments, (int)item.CategoryID);\n      }\n\n      [Test]\n      public void Can_Map_Numeric_Column_To_Nullable_Enum() {\n\n         var item = db.From<Enum.NullableToNumericColumn.Product>(\"Products\")\n            .First($\"CategoryID = {Enum.CategoryEnum.Condiments}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryID);\n         Assert.AreEqual((int)Enum.CategoryEnum.Condiments, (int)item.CategoryID);\n      }\n\n      [Test]\n      public void Can_Map_Text_Column_To_Enum() {\n\n         var item = db.From<Enum.ToTextColumn.Category>(\"Categories\")\n            .Single($\"CategoryName = {Enum.CategoryEnum.Condiments.ToString()}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryName);\n         Assert.AreEqual(Enum.CategoryEnum.Condiments.ToString(), item.CategoryName.ToString());\n      }\n\n      [Test]\n      public void Can_Map_Text_Column_To_Nullable_Enum() {\n\n         var item = db.From<Enum.NullableToTextColumn.Category>(\"Categories\")\n            .Single($\"CategoryName = {Enum.CategoryEnum.Condiments.ToString()}\");\n\n         Assert.AreEqual(Enum.CategoryEnum.Condiments, item.CategoryName);\n         Assert.AreEqual(Enum.CategoryEnum.Condiments.ToString(), item.CategoryName.ToString());\n      }\n   }\n\n   namespace Enum {\n\n      public enum CategoryEnum {\n         Beverages = 1,\n         Condiments = 2,\n         Foo = 1000,\n         Bar = 1001\n      }\n\n      namespace ToNumericColumn {\n\n         public class Product {\n\n            public int ProductID { get; set; }\n\n            public string ProductName { get; set; }\n\n            public CategoryEnum CategoryID { get; set; }\n         }\n      }\n\n      namespace NullableToNumericColumn {\n\n         public class Product {\n\n            public int ProductID { get; set; }\n\n            public string ProductName { get; set; }\n\n            public CategoryEnum? CategoryID { get; set; }\n         }\n      }\n\n      namespace ToTextColumn {\n\n         public class Category {\n\n            public int CategoryID { get; set; }\n\n            public CategoryEnum CategoryName { get; set; }\n         }\n      }\n\n      namespace NullableToTextColumn {\n\n         public class Category {\n\n            public int CategoryID { get; set; }\n\n            public CategoryEnum? CategoryName { get; set; }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Metadata/AssociationReflection.cs",
    "content": "﻿using System.Collections.ObjectModel;\nusing NUnit.Framework;\nusing DbExtensions.Metadata;\n\nnamespace DbExtensions.Tests.Metadata {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class AssociationReflection {\n\n      readonly Database db = MockDatabase();\n\n      [Test]\n      public void One_To_Many() {\n\n         MetaType metaType = db.Configuration.GetMetaType(typeof(Model.Employee));\n\n         Assert.AreEqual(2, metaType.Associations.Count);\n\n         MetaAssociation assoc = metaType.Associations[1];\n\n         Assert.IsTrue(assoc.IsMany);\n         Assert.IsFalse(assoc.OtherKeyIsPrimaryKey);\n\n         Assert.AreEqual(typeof(Model.Employee), assoc.ThisMember.DeclaringType.Type);\n         Assert.AreEqual(nameof(Model.Employee.EmployeeTerritories), assoc.ThisMember.Name);\n         Assert.AreEqual(typeof(Collection<Model.EmployeeTerritory>), assoc.ThisMember.Type);\n\n         Assert.AreEqual(typeof(Model.EmployeeTerritory), assoc.OtherMember.DeclaringType.Type);\n         Assert.AreEqual(nameof(Model.EmployeeTerritory.Employee), assoc.OtherMember.Name);\n         Assert.AreEqual(typeof(Model.Employee), assoc.OtherMember.Type);\n      }\n\n      [Test]\n      public void Many_To_One() {\n\n         MetaType metaType = db.Configuration.GetMetaType(typeof(Model.EmployeeTerritory));\n\n         Assert.AreEqual(2, metaType.Associations.Count);\n\n         MetaAssociation assoc = metaType.Associations[1];\n\n         Assert.IsFalse(assoc.IsMany);\n         Assert.IsTrue(assoc.OtherKeyIsPrimaryKey);\n\n         Assert.AreEqual(typeof(Model.EmployeeTerritory), assoc.ThisMember.DeclaringType.Type);\n         Assert.AreEqual(nameof(Model.EmployeeTerritory.Employee), assoc.ThisMember.Name);\n         Assert.AreEqual(typeof(Model.Employee), assoc.ThisMember.Type);\n\n         Assert.AreEqual(typeof(Model.Employee), assoc.OtherMember.DeclaringType.Type);\n         Assert.AreEqual(nameof(Model.Employee.EmployeeTerritories), assoc.OtherMember.Name);\n         Assert.AreEqual(typeof(Collection<Model.EmployeeTerritory>), assoc.OtherMember.Type);\n      }\n   }\n\n   namespace Model {\n\n      [Table]\n      class Employee {\n\n         [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n         public int EmployeeID { get; set; }\n\n         [Column]\n         public string LastName { get; set; }\n\n         [Column]\n         public string FirstName { get; set; }\n\n         [Association(OtherKey = nameof(Order.EmployeeID))]\n         public Collection<Order> Orders { get; private set; }\n\n         [Association(OtherKey = nameof(EmployeeTerritory.EmployeeID))]\n         public Collection<EmployeeTerritory> EmployeeTerritories { get; private set; }\n      }\n\n      [Table]\n      class EmployeeTerritory {\n\n         [Column(IsPrimaryKey = true)]\n         public int EmployeeID { get; set; }\n\n         [Column(IsPrimaryKey = true)]\n         public string TerritoryID { get; set; }\n\n         [Association(ThisKey = nameof(TerritoryID))]\n         public Territory Territory { get; set; }\n\n         [Association(ThisKey = nameof(EmployeeID))]\n         public Employee Employee { get; set; }\n      }\n\n      [Table]\n      class Territory {\n\n         [Column(IsPrimaryKey = true)]\n         public string TerritoryID { get; set; }\n\n         [Column]\n         public string TerritoryDescription { get; set; }\n      }\n\n      [Table]\n      class Order {\n\n         [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n         public int OrderID { get; set; }\n\n         [Column]\n         public int? EmployeeID { get; set; }\n\n         [Association(OtherKey = nameof(OrderDetail.OrderID))]\n         public Collection<OrderDetail> OrderDetails { get; private set; }\n\n         [Association(ThisKey = nameof(EmployeeID))]\n         public Employee Employee { get; set; }\n      }\n\n      [Table]\n      class OrderDetail {\n\n         [Column(IsPrimaryKey = true)]\n         public int OrderID { get; set; }\n\n         [Column(IsPrimaryKey = true)]\n         public int ProductID { get; set; }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlBuilderBehavior/BasicTests.cs",
    "content": "﻿using System;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlBuilderBehavior {\n\n   [TestFixture]\n   public class BasicTests {\n\n      [Test]\n      public void Create_Interpolated() {\n\n         var query = (SqlBuilder)$\"\"\"\n            SELECT ProductID, ProductName\n            FROM Products\n            WHERE CategoryID = {1}\n            \"\"\";\n\n         Assert.AreEqual(\"\"\"\n            SELECT ProductID, ProductName\n            FROM Products\n            WHERE CategoryID = {0}\n            \"\"\", query.ToString());\n         Assert.AreEqual(1, query.ParameterValues.Count);\n         Assert.AreEqual(1, query.ParameterValues[0]);\n      }\n\n      [Test]\n      public void Multiple_Parameters() {\n\n         var query = SQL\n            .SELECT($\"{1}, {2}\");\n\n         Assert.AreEqual(\"SELECT {0}, {1}\", query.ToString());\n         Assert.AreEqual(2, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Expand_List_Parameter() {\n\n         var query = SQL\n            .SELECT(\"*\")\n            .WHERE($\"c IN ({new[] { 1, 2, 3 }:list})\");\n\n         Assert.AreEqual(\"SELECT *\\r\\nWHERE c IN ({0}, {1}, {2})\", query.ToString());\n         Assert.AreEqual(3, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Adjust_Other_Placeholders_When_Using_List_Parameter() {\n\n         var query = SQL\n            .SELECT(\"*\")\n            .WHERE($\"c IN ({new[] { 1, 2, 3 }:list}) AND c <> {4}\");\n\n         Assert.AreEqual(\"SELECT *\\r\\nWHERE c IN ({0}, {1}, {2}) AND c <> {3}\", query.ToString());\n         Assert.AreEqual(4, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Allow_Empty_List() {\n\n         var query = SQL\n            .SELECT($\"1 IN ({new int[0]:list})\");\n\n         Assert.AreEqual(\"SELECT 1 IN ({0})\", query.ToString());\n         Assert.AreEqual(1, query.ParameterValues.Count);\n         Assert.AreEqual(null, query.ParameterValues[0]);\n      }\n\n      [Test]\n      public void Use_Parameter_On_Limit_Clause() {\n\n         var query = SQL\n            .SELECT(\"*\")\n            .LIMIT(1);\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Use_Parameter_On_Offset_Clause() {\n\n         var query = SQL\n            .SELECT(\"*\")\n            .OFFSET(1);\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Treat_SqlBuilder_As_SubQuery() {\n\n         var query = SQL\n            .SELECT(\"*\")\n            .FROM($\"({SQL\n               .SELECT($\"{5}\")}) AS t0\");\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n         Assert.AreEqual(5, query.ParameterValues[0]);\n         Assert.AreEqual(\"SELECT *\\r\\nFROM (\\r\\n\\tSELECT {0}) AS t0\", query.ToString());\n      }\n\n      [Test]\n      public void Treat_SqlSet_As_SubQuery() {\n\n         var db = TestUtil.MockDatabase();\n\n         var query = SQL\n            .SELECT(\"*\")\n            .FROM($\"({db.FromQuery($\"SELECT {5}\")}) AS t0\");\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n         Assert.AreEqual(5, query.ParameterValues[0]);\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlBuilderBehavior/ConditionalAppendTests.cs",
    "content": "﻿using System;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlBuilderBehavior {\n\n   [TestFixture]\n   public class ConditionalAppendTests {\n\n      // ## AppendIf\n\n      [Test]\n      public void AppendIf() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            .AppendIf(true, $\"B\");\n\n         Assert.AreEqual(\"SELECT AB\", queryTrue.ToString());\n\n         var queryFalse = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\");\n\n         Assert.AreEqual(\"SELECT A\", queryFalse.ToString());\n      }\n\n      [Test]\n      public void AppendIf_Different_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .WHERE()\n            .AppendIf(true, $\"B\");\n\n         Assert.AreEqual(\"SELECT AB\", query.ToString());\n      }\n\n\n      // ## AppendElseIf\n\n      [Test]\n      public void AppendElseIf() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            .AppendIf(true, $\"B\")\n            .AppendElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT AB\", queryTrue.ToString());\n\n         var queryFalse = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendElseIf(false, $\"C\")\n            .AppendElseIf(true, $\"D\");\n\n         Assert.AreEqual(\"SELECT AD\", queryFalse.ToString());\n      }\n\n      [Test]\n      public void AppendElseIf_No_If() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElseIf_After_Else() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendElse($\"C\")\n            .AppendElseIf(true, $\"D\");\n\n         Assert.AreEqual(\"SELECT AC\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElseIf_Different_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .WHERE(\"1 = 1\")\n            .AppendElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\\r\\nWHERE 1 = 1\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElseIf_Different_Next_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .WHERE()\n            .AppendElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n\n      // ## AppendElse\n\n      [Test]\n      public void AppendElse() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            .AppendIf(true, $\"B\")\n            .AppendElse($\"C\");\n\n         Assert.AreEqual(\"SELECT AB\", queryTrue.ToString());\n\n         var queryFalseIf = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendElse($\"C\");\n\n         Assert.AreEqual(\"SELECT AC\", queryFalseIf.ToString());\n\n         var queryFalseElseIf = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendElseIf(false, $\"C\")\n            .AppendElse($\"D\");\n\n         Assert.AreEqual(\"SELECT AD\", queryFalseElseIf.ToString());\n      }\n\n      [Test]\n      public void AppendElse_Duplicate() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendElse($\"C\")\n            .AppendElse($\"D\");\n\n         Assert.AreEqual(\"SELECT AC\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElse_No_If() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendElse($\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElse_Not_Nested() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .AppendIf(true, $\"C\")\n            .AppendElse($\"D\")\n            .AppendElse($\"E\");\n\n         Assert.AreEqual(\"SELECT AC\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElse_Different_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .WHERE(\"1 = 1\")\n            .AppendElse($\"C\");\n\n         Assert.AreEqual(\"SELECT A\\r\\nWHERE 1 = 1\", query.ToString());\n      }\n\n      [Test]\n      public void AppendElse_Different_Next_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .AppendIf(false, $\"B\")\n            .WHERE()\n            .AppendElse($\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlBuilderBehavior/ConditionalClauseTests.cs",
    "content": "﻿using System;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlBuilderBehavior {\n\n   [TestFixture]\n   public class ConditionalClauseTests {\n\n      [Test]\n      public void If_Continuation() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            ._If(true, $\"B\");\n\n         Assert.AreEqual(\"SELECT A, B\", queryTrue.ToString());\n\n         var queryFalse = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\");\n\n         Assert.AreEqual(\"SELECT A\", queryFalse.ToString());\n      }\n\n      [Test]\n      public void Next_Clause_Continuation() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            .WHERE()\n            ._If(true, $\"B\");\n\n         Assert.AreEqual(\"SELECT A\\r\\nWHERE B\", query.ToString());\n      }\n\n\n      // ## ElseIf_Continuation\n\n      [Test]\n      public void ElseIf_Continuation() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            ._If(true, $\"B\")\n            ._ElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A, B\", queryTrue.ToString());\n\n         var queryFalse = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._ElseIf(false, $\"C\")\n            ._ElseIf(true, $\"D\");\n\n         Assert.AreEqual(\"SELECT A, D\", queryFalse.ToString());\n      }\n\n      [Test]\n      public void ElseIf_Continuation_No_If() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._ElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n      [Test]\n      public void ElseIf_Continuation_After_Else() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._Else($\"C\")\n            ._ElseIf(true, $\"D\");\n\n         Assert.AreEqual(\"SELECT A, C\", query.ToString());\n      }\n\n      [Test]\n      public void ElseIf_Continuation_Different_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            .WHERE(\"1 = 1\")\n            ._ElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\\r\\nWHERE 1 = 1\", query.ToString());\n      }\n\n      [Test]\n      public void ElseIf_Continuation_Different_Next_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            .WHERE()\n            ._ElseIf(true, $\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n\n      // ## Else_Continuation\n\n      [Test]\n      public void Else_Continuation() {\n\n         var queryTrue = SQL\n            .SELECT(\"A\")\n            ._If(true, $\"B\")\n            ._Else($\"C\");\n\n         Assert.AreEqual(\"SELECT A, B\", queryTrue.ToString());\n\n         var queryFalseIf = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._Else($\"C\");\n\n         Assert.AreEqual(\"SELECT A, C\", queryFalseIf.ToString());\n\n         var queryFalseElseIf = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._ElseIf(false, $\"C\")\n            ._Else($\"D\");\n\n         Assert.AreEqual(\"SELECT A, D\", queryFalseElseIf.ToString());\n      }\n\n      [Test]\n      public void Else_Continuation_Duplicate() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._Else($\"C\")\n            ._Else($\"D\");\n\n         Assert.AreEqual(\"SELECT A, C\", query.ToString());\n      }\n\n      [Test]\n      public void Else_Continuation_No_If() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._Else($\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n\n      [Test]\n      public void Else_Continuation_Not_Nested() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            ._If(true, $\"C\")\n            ._Else($\"D\")\n            ._Else($\"E\");\n\n         Assert.AreEqual(\"SELECT A, C\", query.ToString());\n      }\n\n      [Test]\n      public void Else_Continuation_Different_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            .WHERE(\"1 = 1\")\n            ._Else($\"C\");\n\n         Assert.AreEqual(\"SELECT A\\r\\nWHERE 1 = 1\", query.ToString());\n      }\n\n      [Test]\n      public void Else_Continuation_Different_Next_Clause() {\n\n         var query = SQL\n            .SELECT(\"A\")\n            ._If(false, $\"B\")\n            .WHERE()\n            ._Else($\"C\");\n\n         Assert.AreEqual(\"SELECT A\", query.ToString());\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlBuilderBehavior/ExtensibilityTests.cs",
    "content": "﻿using System.Runtime.CompilerServices;\nusing System.Text;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlBuilderBehavior {\n\n   [TestFixture]\n   public class ExtensibilityTests {\n\n      [Test]\n      public void Extension_Clause() {\n\n         var query = ((SqlBuilder)$\"\"\"\n            SELECT ProductID, ProductName\n            FROM Products\n            OFFSET {10} ROWS\n            \"\"\")\n            .FETCH($\"NEXT {5} ROWS ONLY\");\n\n         Assert.AreEqual(new StringBuilder(\"\"\"\n            SELECT ProductID, ProductName\n            FROM Products\n            OFFSET {0} ROWS\n            \"\"\")\n            .AppendLine()\n            .Append(\"FETCH NEXT {1} ROWS ONLY\")\n            .ToString()\n            , query.ToString());\n\n         Assert.IsTrue(query.CurrentClause is SqlBuilderExtensions.FetchClause);\n      }\n   }\n\n   public static class SqlBuilderExtensions {\n\n      public sealed record class FetchClause() : SqlClause(\"FETCH\", null);\n\n      public static SqlBuilder FETCH(this SqlBuilder sql, [InterpolatedStringHandlerArgument(nameof(sql))] ref SqlBuilder.ClauseStringHandler<FetchClause> handler) {\n         return sql;\n      }\n\n      public static SqlBuilder FETCH(this SqlBuilder sql, string text) {\n         return sql.AppendClause<FetchClause>()\n            .Append(text);\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlBuilderBehavior/ValuesClauseTests.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlBuilderBehavior {\n\n   [TestFixture]\n   public class ValuesClauseTests {\n\n      [Test]\n      public void Values_List() {\n\n         var query = SQL\n            .INSERT_INTO(\"tbl\")\n            .VALUES(1, 2, 3);\n\n         Assert.AreEqual(\"INSERT INTO tbl\\r\\nVALUES ({0}, {1}, {2})\", query.ToString());\n         Assert.AreEqual(3, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Values_Continuation() {\n\n         var query = SQL\n            .INSERT_INTO(\"tbl\")\n            .VALUES(1, 2, 3)\n            .VALUES(4, 5, 6);\n\n         Assert.AreEqual(\"INSERT INTO tbl\\r\\nVALUES ({0}, {1}, {2}),\\r\\n({3}, {4}, {5})\", query.ToString());\n         Assert.AreEqual(6, query.ParameterValues.Count);\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlSetAnnotatedBehavior/BasicTests.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlSetAnnotatedBehavior {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class BasicTests {\n\n      readonly Database db = RealDatabase();\n\n      [Test]\n      public void Contains() {\n\n         SqlSet<Basic.Model1.Product> table = db.Table<Basic.Model1.Product>();\n\n         var prod1 = table.Single(\"ProductID = 1\");\n\n         Assert.IsTrue(table.Contains(prod1));\n         Assert.IsFalse(table.Where(\"ProductID = 2\").Contains(prod1));\n      }\n\n      [Test]\n      public void ContainsKey() {\n\n         SqlSet<Basic.Model1.Product> table = db.Table<Basic.Model1.Product>();\n\n         Assert.IsTrue(table.ContainsKey(1));\n         Assert.IsFalse(table.Where(\"ProductID = 2\").ContainsKey(1));\n      }\n\n      [Test]\n      public void Find() {\n\n         SqlSet<Basic.Model1.Product> table = db.Table<Basic.Model1.Product>();\n\n         Assert.IsNotNull(table.Find(1));\n         Assert.IsNull(table.Where(\"ProductID = 2\").Find(1));\n      }\n   }\n\n   namespace Basic {\n\n      namespace Model1 {\n\n         [Table(Name = \"Products\")]\n         public class Product {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int ProductID { get; set; }\n\n            public string ProductName { get; set; }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlSetAnnotatedBehavior/IncludeTests.cs",
    "content": "﻿using System;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying.SqlSetAnnotatedBehavior {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class IncludeTests {\n\n      readonly Database db = RealDatabase();\n\n      [Test]\n      public void Can_Include_One() {\n\n         var set = db.Table<Include.Model1.Product>()\n            .Where(\"NOT CategoryID IS NULL AND NOT SupplierID IS NULL\")\n            .Include(p => p.Category)\n            .Include(p => p.Supplier);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Category);\n         Assert.IsNotNull(item.Supplier);\n      }\n\n      [Test]\n      public void Can_Include_One_Nested() {\n\n         var set = db.Table<Include.Model1.EmployeeTerritory>()\n            .Include(p => p.Territory.Region);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Territory);\n         Assert.IsNotNull(item.Territory.Region);\n      }\n\n      [Test]\n      public void Can_Include_One_Nested_Key_Name_Member_Differs() {\n\n         var set = db.Table<Include.Model2.EmployeeTerritory>()\n            .Include(p => p.Territory.Region);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Territory);\n         Assert.IsNotNull(item.Territory.Region);\n      }\n\n      [Test]\n      public void Can_Include_Many() {\n\n         var set = db.Table<Include.Model1.Category>()\n            .IncludeMany(p => p.Products);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Products);\n         Assert.AreNotEqual(0, item.Products.Count);\n         Assert.IsTrue(item.Products.All(p => Object.ReferenceEquals(p.Category, item)));\n      }\n\n      [Test]\n      public void Can_Include_Many_Multiple() {\n\n         var set1 = db.Table<Include.Model1.Employee>()\n            .IncludeMany(p => p.EmployeeTerritories);\n\n         var set2 = set1.IncludeMany(p => p.Orders);\n\n         var item = set1.First();\n\n         Assert.IsNotNull(item.EmployeeTerritories);\n         Assert.AreNotEqual(0, item.EmployeeTerritories.Count);\n         Assert.IsTrue(item.EmployeeTerritories.All(p => Object.ReferenceEquals(p.Employee, item)));\n\n         // test immutability\n         Assert.IsTrue(item.Orders is null or { Count: 0 });\n\n         item = set2.First();\n\n         Assert.IsNotNull(item.EmployeeTerritories);\n         Assert.AreNotEqual(0, item.EmployeeTerritories.Count);\n         Assert.IsTrue(item.EmployeeTerritories.All(p => Object.ReferenceEquals(p.Employee, item)));\n\n         Assert.IsNotNull(item.Orders);\n         Assert.AreNotEqual(0, item.Orders.Count);\n         Assert.IsTrue(item.Orders.All(p => Object.ReferenceEquals(p.Employee, item)));\n      }\n\n      [Test]\n      public void Can_Include_Many_In_One() {\n\n         var set = db.Table<Include.Model1.EmployeeTerritory>()\n            .Include(p => p.Employee)\n            .IncludeMany(p => p.Employee.Orders);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Employee);\n         Assert.AreNotEqual(0, item.Employee.Orders.Count);\n         Assert.IsTrue(item.Employee.Orders.All(p => Object.ReferenceEquals(p.Employee, item.Employee)));\n      }\n\n      [Test]\n      public void Can_Include_Many_In_One_Multiple() {\n\n         var set = db.Table<Include.Model1.EmployeeTerritory>()\n            .Include(p => p.Employee)\n            .IncludeMany(p => p.Employee.Orders)\n            .IncludeMany(p => p.Employee.EmployeeTerritories);\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Employee);\n         Assert.AreNotEqual(0, item.Employee.Orders.Count);\n         Assert.IsTrue(item.Employee.Orders.All(p => Object.ReferenceEquals(p.Employee, item.Employee)));\n\n         Assert.AreNotEqual(0, item.Employee.EmployeeTerritories.Count);\n         Assert.IsTrue(item.Employee.EmployeeTerritories.All(p => Object.ReferenceEquals(p.Employee, item.Employee)));\n      }\n\n      [Test]\n      public void Can_Include_One_In_Many() {\n\n         var set = db.Table<Include.Model1.Employee>()\n            .IncludeMany(p => p.EmployeeTerritories, set => set\n               .Include(p => p.Territory));\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.EmployeeTerritories);\n         Assert.AreNotEqual(0, item.EmployeeTerritories.Count);\n         Assert.IsTrue(item.EmployeeTerritories.All(p => p.Territory != null));\n      }\n\n      [Test]\n      public void Can_Include_Many_In_Many() {\n\n         var set = db.Table<Include.Model1.Employee>()\n            .IncludeMany(p => p.Orders, set => set\n               .IncludeMany(p => p.OrderDetails, set => set\n                  .Include(p => p.Product))\n               .OrderBy(\"OrderID DESC\")\n               .Take(5));\n\n         var item = set.First();\n\n         Assert.IsNotNull(item.Orders);\n         Assert.IsTrue(item.Orders.Count <= 5);\n\n         foreach (var order in item.Orders) {\n            Assert.IsNotNull(order.OrderDetails);\n            foreach (var det in order.OrderDetails) {\n               Assert.IsNotNull(det.Product);\n            }\n         }\n      }\n   }\n\n   namespace Include.Model1 {\n\n      [Table(Name = \"Products\")]\n      class Product {\n\n         [Column(IsPrimaryKey = true)]\n         public int ProductID { get; set; }\n\n         [Column]\n         public int? CategoryID { get; set; }\n\n         [Column]\n         public int? SupplierID { get; set; }\n\n         [Association(ThisKey = nameof(CategoryID))]\n         public Category Category { get; set; }\n\n         [Association(ThisKey = nameof(SupplierID))]\n         public Supplier Supplier { get; set; }\n      }\n\n      [Table(Name = \"Categories\")]\n      class Category {\n\n         [Column(IsPrimaryKey = true)]\n         public int CategoryID { get; set; }\n\n         [Column]\n         public string CategoryName { get; set; }\n\n         [Association(OtherKey = nameof(Product.CategoryID))]\n         public Collection<Product> Products { get; private set; }\n      }\n\n      [Table(Name = \"Suppliers\")]\n      class Supplier {\n\n         [Column(IsPrimaryKey = true)]\n         public int SupplierID { get; set; }\n\n         [Column]\n         public string CompanyName { get; set; }\n      }\n\n      [Table(Name = \"Employees\")]\n      class Employee {\n\n         [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n         public int EmployeeID { get; set; }\n\n         [Column]\n         public string LastName { get; set; }\n\n         [Column]\n         public string FirstName { get; set; }\n\n         [Association(OtherKey = nameof(EmployeeTerritory.EmployeeID))]\n         public Collection<EmployeeTerritory> EmployeeTerritories { get; private set; }\n\n         [Association(OtherKey = nameof(EmployeeTerritory.EmployeeID))]\n         public Collection<Order> Orders { get; private set; }\n      }\n\n      [Table(Name = \"EmployeeTerritories\")]\n      class EmployeeTerritory {\n\n         [Column(IsPrimaryKey = true)]\n         public int EmployeeID { get; set; }\n\n         [Column(IsPrimaryKey = true)]\n         public string TerritoryID { get; set; }\n\n         [Association(ThisKey = nameof(EmployeeID))]\n         public Employee Employee { get; set; }\n\n         [Association(ThisKey = nameof(TerritoryID))]\n         public Territory Territory { get; set; }\n      }\n\n      [Table(Name = \"Territories\")]\n      class Territory {\n\n         [Column(IsPrimaryKey = true)]\n         public string TerritoryID { get; set; }\n\n         [Column]\n         public string TerritoryDescription { get; set; }\n\n         [Column]\n         public int RegionID { get; set; }\n\n         [Association(ThisKey = nameof(RegionID))]\n         public Region Region { get; set; }\n      }\n\n      [Table]\n      class Region {\n\n         [Column(IsPrimaryKey = true)]\n         public int RegionID { get; set; }\n\n         [Column]\n         public string RegionDescription { get; set; }\n      }\n\n      [Table(Name = \"Orders\")]\n      class Order {\n\n         [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n         public int OrderID { get; set; }\n\n         [Column]\n         public int? EmployeeID { get; set; }\n\n         [Association(OtherKey = nameof(OrderDetail.OrderID))]\n         public Collection<OrderDetail> OrderDetails { get; private set; }\n\n         [Association(ThisKey = nameof(EmployeeID))]\n         public Employee Employee { get; set; }\n      }\n\n      [Table(Name = \"Order Details\")]\n      class OrderDetail {\n\n         [Column(IsPrimaryKey = true)]\n         public int OrderID { get; set; }\n\n         [Column(IsPrimaryKey = true)]\n         public int ProductID { get; set; }\n\n         [Association(ThisKey = nameof(OrderID))]\n         public Order Order { get; set; }\n\n         [Association(ThisKey = nameof(ProductID))]\n         public Product Product { get; set; }\n      }\n   }\n\n   namespace Include.Model2 {\n\n      [Table(Name = \"EmployeeTerritories\")]\n      class EmployeeTerritory {\n\n         [Column(IsPrimaryKey = true)]\n         public int EmployeeID { get; set; }\n\n         [Column(Name = \"TerritoryID\", IsPrimaryKey = true)]\n         public string Territory_ID { get; set; }\n\n         [Association(ThisKey = nameof(Territory_ID))]\n         public Territory Territory { get; set; }\n      }\n\n      [Table(Name = \"Territories\")]\n      class Territory {\n\n         [Column(IsPrimaryKey = true)]\n         public string TerritoryID { get; set; }\n\n         [Column]\n         public string TerritoryDescription { get; set; }\n\n         [Column(Name = \"RegionID\")]\n         public int Region_ID { get; set; }\n\n         [Association(ThisKey = nameof(Region_ID))]\n         public Region Region { get; set; }\n      }\n\n      [Table]\n      class Region {\n\n         [Column(IsPrimaryKey = true)]\n         public int RegionID { get; set; }\n\n         [Column]\n         public string RegionDescription { get; set; }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlSetAsyncBehavior.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class SqlSetAsyncBehavior {\n\n      [Test]\n      public void AsAsyncEnumerable_Reference_Type() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         set.AsAsyncEnumerable();\n\n         SqlSet untypedSet = set;\n\n         untypedSet.AsAsyncEnumerable();\n      }\n\n      [Test]\n      public void AsAsyncEnumerable_Value_Type() {\n\n         var data = new Dictionary<string, object> {\n            { \"0\", 0 }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<int> set = db.FromQuery($\"SELECT NULL\", r => r.GetInt32(0));\n\n         set.AsAsyncEnumerable();\n\n         SqlSet untypedSet = set;\n\n         untypedSet.AsAsyncEnumerable();\n      }\n\n      [Test]\n      public async Task Async_Enumerate() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         var results = new List<string>();\n\n         await foreach (var item in set.AsAsyncEnumerable()) {\n            results.Add(item);\n         }\n\n         Assert.AreEqual(1, results.Count);\n         Assert.AreEqual(data[\"a\"], results[0]);\n      }\n\n      [Test]\n      public async Task Async_ForEach_Enumerate() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         var results = new List<string>();\n\n         await foreach (var item in set) {\n            results.Add(item);\n         }\n\n         Assert.AreEqual(1, results.Count);\n         Assert.AreEqual(data[\"a\"], results[0]);\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlSetBehavior.cs",
    "content": "﻿using System.Collections.Generic;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class SqlSetBehavior {\n\n      readonly Database db = MockDatabase();\n\n      [Test]\n      public void AsEnumerable_Reference_Type() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         set.AsEnumerable();\n\n         SqlSet untypedSet = set;\n\n         untypedSet.AsEnumerable();\n      }\n\n      [Test]\n      public void AsEnumerable_Value_Type() {\n\n         var data = new Dictionary<string, object> {\n            { \"0\", 0 }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<int> set = db.FromQuery($\"SELECT NULL\", r => r.GetInt32(0));\n\n         set.AsEnumerable();\n\n         SqlSet untypedSet = set;\n\n         untypedSet.AsEnumerable();\n      }\n\n      [Test]\n      public void Enumerate() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         var results = new List<string>();\n\n         foreach (var item in set.AsEnumerable()) {\n            results.Add(item);\n         }\n\n         Assert.AreEqual(1, results.Count);\n         Assert.AreEqual(data[\"a\"], results[0]);\n      }\n\n      [Test]\n      public void ForEach_Enumerate() {\n\n         var data = new Dictionary<string, object> {\n            { \"a\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0));\n\n         var results = new List<string>();\n\n         foreach (var item in set) {\n            results.Add(item);\n         }\n\n         Assert.AreEqual(1, results.Count);\n         Assert.AreEqual(data[\"a\"], results[0]);\n      }\n\n      [Test]\n      public void Dont_Use_Subqueries_When_Methods_Are_Called_In_Order() {\n\n         SqlSet set = db.From(\"products\")\n            .Where(\"UnitsInStock > 0\")\n            .Skip(0)\n            .Take(5);\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(\"products\")\n            .WHERE(\"UnitsInStock > 0\")\n            .LIMIT(5)\n            .OFFSET(0);\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Where_After_Where_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Where(\"UnitsInStock > 0\")\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .WHERE(\"UnitsInStock > 0\"), \"_\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Where_After_OrderBy_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .OrderBy(\"ProductID DESC\")\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .ORDER_BY(\"ProductID DESC\"), \"_\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Where_After_Skip_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Skip(5)\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .OFFSET(5), \"_\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Where_After_Take_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Take(5)\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .LIMIT(5), \"_\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_OrderBy_After_OrderBy_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .OrderBy(\"ProductID DESC\")\n            .OrderBy(\"UnitPrice\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .ORDER_BY(\"ProductID DESC\"), \"_\")\n            .ORDER_BY(\"UnitPrice\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_OrderBy_After_Skip_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Skip(5)\n            .OrderBy(\"UnitPrice\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .OFFSET(5), \"_\")\n            .ORDER_BY(\"UnitPrice\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_OrderBy_After_Take_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Take(5)\n            .OrderBy(\"UnitPrice\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .LIMIT(5), \"_\")\n            .ORDER_BY(\"UnitPrice\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Skip_After_Skip_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Skip(5)\n            .Skip(1);\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .OFFSET(5), \"_\")\n            .OFFSET(1);\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Skip_After_Take_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Take(5)\n            .Skip(1);\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .LIMIT(5), \"_\")\n            .OFFSET(1);\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Apply_Take_After_Take_Call() {\n\n         SqlSet set = db.From(\"products\")\n            .Take(5)\n            .Take(1);\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(SQL\n               .SELECT(\"*\")\n               .FROM(\"products\")\n               .LIMIT(5), \"_\")\n            .LIMIT(1);\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Dont_Use_Subquery_For_Cast() {\n\n         SqlSet set = db.From(\"products\")\n            .Cast(typeof(object))\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(\"products\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Dont_Use_Subquery_For_Cast_Generic() {\n\n         SqlSet set = db.From(\"products\")\n            .Cast<object>()\n            .Where(\"NOT UnitPrice IS NULL\");\n\n         SqlBuilder expected = SQL\n            .SELECT(\"*\")\n            .FROM(\"products\")\n            .WHERE(\"NOT UnitPrice IS NULL\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Dont_Require_Type_For_Select() {\n\n         var data = new Dictionary<string, object> {\n            { \"foo\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         dynamic value = db.FromQuery($\"SELECT NULL\")\n            .Select(\"foo\")\n            .Single();\n\n         Assert.AreEqual(\"a\", value.foo);\n      }\n\n      [Test]\n      public void Remember_Mapper() {\n\n         var data = new Dictionary<string, object> {\n            { \"c\", \"a\" }\n         };\n\n         var db = MockQuery(data);\n\n         SqlSet<string> set = db.FromQuery($\"SELECT NULL\", r => r.GetString(0))\n            .OrderBy(\"c\");\n\n         string value = set.Single();\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlSetBehaviorForSqlServer.cs",
    "content": "﻿using NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class SqlSetBehaviorForSqlServer {\n\n      readonly Database db = MockDatabase(\"Microsoft.Data.SqlClient\");\n\n      [Test]\n      public void Use_Parameter_On_Skip() {\n\n         var query = db.FromQuery($\"SELECT 1\")\n            .Skip(1)\n            .GetDefiningQuery();\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Use_Parameter_On_Take() {\n\n         var query = db.FromQuery($\"SELECT 1\")\n            .Take(1)\n            .GetDefiningQuery();\n\n         Assert.AreEqual(1, query.ParameterValues.Count);\n      }\n\n      [Test]\n      public void Use_Parameter_On_Skip_And_Take() {\n\n         var query = db.FromQuery($\"SELECT 1\")\n            .Skip(1)\n            .Take(1)\n            .GetDefiningQuery();\n\n         Assert.AreEqual(2, query.ParameterValues.Count);\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/Querying/SqlTableBehavior.cs",
    "content": "﻿using System.Collections.ObjectModel;\nusing NUnit.Framework;\n\nnamespace DbExtensions.Tests.Querying {\n\n   using static TestUtil;\n\n   [TestFixture]\n   public class SqlTableBehavior {\n\n      [Test]\n      public void Dont_Use_Subqueries_When_Methods_Are_Called_In_Order() {\n\n         var db = MockDatabase();\n\n         SqlSet set = db.Table<SqlTable.Model1.Product>()\n            .Where(\"UnitsInStock > 0\")\n            .Skip(0)\n            .Take(5);\n\n         SqlBuilder expected = SQL\n            .SELECT(db.QuoteIdentifier(\"Id\"))\n            .FROM(db.QuoteIdentifier(\"Product\"))\n            .WHERE(\"UnitsInStock > 0\")\n            .LIMIT(5)\n            .OFFSET(0);\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Can_Use_Multipart_Identifier() {\n\n         var db = MockDatabase(\"Microsoft.Data.SqlClient\");\n\n         SqlSet set = db.Table<SqlTable.Model2.Product>();\n\n         SqlBuilder expected = SQL\n            .SELECT(\"[ProductID], [ProductName]\")\n            .FROM(\"[dbo].[Products]\");\n\n         Assert.IsTrue(SqlEquals(set, expected));\n      }\n\n      [Test]\n      public void Can_Update_Assigned_Key() {\n\n         var db = RealDatabase();\n         var table = db.Table<SqlTable.Model3.Customer>();\n\n         string originalId = \"FISSA\";\n         string newId = \"FOO\";\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var cust1 = table.Find(originalId);\n\n            Assert.IsNotNull(cust1);\n\n            cust1.CustomerID = newId;\n\n            table.Update(cust1, originalId);\n\n            Assert.IsTrue(table.ContainsKey(newId));\n            Assert.IsFalse(table.ContainsKey(originalId));\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void Can_Refresh() {\n\n         var db = RealDatabase();\n         var table = db.Table<SqlTable.Refresh.Product>();\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var entity = new SqlTable.Refresh.Product {\n               ProductName = \"Foo\",\n               Discontinued = false,\n            };\n\n            table.Add(entity);\n\n            var id = entity.ProductID;\n\n            Assert.AreNotEqual(0, id);\n\n            entity.ProductName = \"Bar\";\n            entity.Discontinued = true;\n\n            table.Refresh(entity);\n\n            Assert.AreEqual(id, entity.ProductID);\n            Assert.AreEqual(\"Foo\", entity.ProductName);\n            Assert.AreEqual(false, entity.Discontinued);\n\n            tx.Rollback();\n         }\n      }\n\n      [Test]\n      public void InsertOneToMany_Descendants() {\n\n         var db = RealDatabase();\n         var table = db.Table<SqlTable.InsertOneToManyDescendants.Region>();\n\n         using (var tx = db.EnsureInTransaction()) {\n\n            var lastTerritory = db.Table<SqlTable.InsertOneToManyDescendants.Territory>()\n               .OrderBy(\"TerritoryID DESC\")\n               .First();\n\n            var entity = new SqlTable.InsertOneToManyDescendants.Region {\n               RegionID = 9999,\n               RegionDescription = \"foo\",\n               Territories = {\n                  new SqlTable.InsertOneToManyDescendants.Territory {\n                     TerritoryID = lastTerritory.TerritoryID + 1000,\n                     TerritoryDescription = \"foo\"\n                  },\n                  new SqlTable.InsertOneToManyDescendants.Territory {\n                     TerritoryID = lastTerritory.TerritoryID + 1001,\n                     TerritoryDescription = \"foo\",\n                     EmployeeTerritories = {\n                        new SqlTable.InsertOneToManyDescendants.EmployeeTerritory {\n                           EmployeeID = 1\n                        }\n                     }\n                  },\n               }\n            };\n\n            table.Add(entity);\n\n            tx.Rollback();\n         }\n      }\n   }\n\n   namespace SqlTable {\n\n      namespace Model1 {\n\n         [Table]\n         public class Product {\n\n            [Column]\n            public int Id { get; set; }\n         }\n      }\n\n      namespace Model2 {\n\n         [Table(Name = \"[dbo].[Products]\")]\n         public class Product {\n\n            [Column(IsPrimaryKey = true)]\n            public int ProductID { get; set; }\n\n            [Column]\n            public string ProductName { get; set; }\n         }\n      }\n\n      namespace Model3 {\n\n         [Table(Name = \"Customers\")]\n         public class Customer {\n\n            [Column(IsPrimaryKey = true)]\n            public string CustomerID { get; set; }\n\n            [Column]\n            public string CompanyName { get; set; }\n         }\n      }\n\n      namespace Refresh {\n\n         [Table(Name = \"Products\")]\n         public class Product {\n\n            [Column(IsPrimaryKey = true, IsDbGenerated = true)]\n            public int ProductID { get; set; }\n\n            [Column]\n            public string ProductName { get; set; }\n\n            [Column]\n            public bool Discontinued { get; set; }\n         }\n      }\n\n      namespace InsertOneToManyDescendants {\n\n         [Table(Name = \"Region\")]\n         public class Region {\n\n            [Column(IsPrimaryKey = true)]\n            public int RegionID { get; set; }\n\n            [Column]\n            public string RegionDescription { get; set; }\n\n            [Association(OtherKey = nameof(Territory.RegionID))]\n            public Collection<Territory> Territories { get; } = new();\n         }\n\n         [Table(Name = \"Territories\")]\n         public class Territory {\n\n            [Column(IsPrimaryKey = true)]\n            public string TerritoryID { get; set; }\n\n            [Column]\n            public string TerritoryDescription { get; set; }\n\n            [Column]\n            public int RegionID { get; set; }\n\n            [Association(OtherKey = nameof(EmployeeTerritory.TerritoryID))]\n            public Collection<EmployeeTerritory> EmployeeTerritories { get; } = new();\n         }\n\n         [Table(Name = \"EmployeeTerritories\")]\n         public class EmployeeTerritory {\n\n            [Column(IsPrimaryKey = true)]\n            public int EmployeeID { get; set; }\n\n            [Column(IsPrimaryKey = true)]\n            public string TerritoryID { get; set; }\n         }\n      }\n   }\n}\n"
  },
  {
    "path": "tests/DbExtensions.Tests/TestUtil.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Data.Common;\nusing System.Data.SQLite;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Moq;\nusing Moq.Protected;\n\nnamespace DbExtensions.Tests;\n\nstatic class TestUtil {\n\n   public static Database\n   MockDatabase(string providerInvariantName = \"MySql.Data.MySqlClient\") =>\n      MockDatabaseImpl(providerInvariantName).Object;\n\n   static Mock<Database>\n   MockDatabaseImpl(string providerInvariantName) {\n\n      var mockConn = new Mock<DbConnection>();\n\n      var mockDb = new Mock<Database>(mockConn.Object, providerInvariantName) {\n         CallBase = true\n      };\n\n      return mockDb;\n   }\n\n   public static Database\n   MockQuery(params IEnumerable<KeyValuePair<string, object>>[] data) {\n\n      var reader = new TestDataReader(data\n         .Select(p => p as KeyValuePair<string, object>[]\n            ?? p.ToArray())\n         .ToArray());\n\n      var mockDb = MockDatabaseImpl(\"MySql.Data.MySqlClient\");\n\n      SetupReader(mockDb, reader);\n\n      return mockDb.Object;\n   }\n\n   public static void\n   SetupReader(Mock<Database> mockDb, DbDataReader reader, string commandText = null) {\n\n      mockDb.Setup(db => db.CreateCommand(It.IsAny<SqlBuilder>()))\n         .Returns(() => {\n\n            var command = new Mock<DbCommand>();\n            command.SetupProperty(p => p.CommandText, commandText);\n\n            var commandProt = command.Protected();\n\n            commandProt.Setup<DbConnection>(\"DbConnection\")\n               .Returns(mockDb.Object.Connection);\n\n            commandProt.Setup<DbDataReader>(\"ExecuteDbDataReader\", It.IsAny<CommandBehavior>())\n               .Returns(reader);\n\n            commandProt.Setup<Task<DbDataReader>>(\"ExecuteDbDataReaderAsync\", It.IsAny<CommandBehavior>(), It.IsAny<CancellationToken>())\n               .Returns(Task.FromResult(reader));\n\n            return command.Object;\n         });\n   }\n\n   public static Database\n   RealDatabase() {\n\n      var builder = new SQLiteConnectionStringBuilder {\n         DataSource = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @\"..\\..\\..\\..\\..\\samples\\App\\bin\\Debug\\net8.0\\Northwind\\Northwind.sl3\")),\n         FailIfMissing = true\n      };\n\n      var conn = new SQLiteConnection(builder.ToString());\n\n      var db = new Database(conn);\n\n#if DEBUG\n      db.Configuration.Log = Console.Out;\n#endif\n\n      return db;\n   }\n\n   public static bool\n   SqlEquals(SqlSet set, SqlBuilder query) =>\n      String.Equals(Regex.Replace(set.ToString(), \"dbex_set[0-9]+\", \"_\"), query.ToString(), StringComparison.Ordinal);\n}\n\nclass TestDataReader : DbDataReader {\n\n   readonly KeyValuePair<string, object>[][]\n   _data;\n\n   KeyValuePair<string, object>[]\n   _row;\n\n   int\n   _rowIndex;\n\n   public override object\n   this[int i] => _row[i].Value;\n\n   public override object\n   this[string name] => _row[GetOrdinal(name)].Value;\n\n   public override int\n   Depth => throw new NotImplementedException();\n\n   public override int\n   FieldCount => _row.Length;\n\n   public override bool\n   HasRows => _data.Length > 0;\n\n   public override bool\n   IsClosed => false;\n\n   public override int\n   RecordsAffected => -1;\n\n   public\n   TestDataReader(params KeyValuePair<string, object>[][] data) {\n      _data = data;\n   }\n\n   public override IEnumerator\n   GetEnumerator() =>\n      throw new NotImplementedException();\n\n   public override bool\n   GetBoolean(int i) =>\n      (bool)this[i];\n\n   public override byte\n   GetByte(int i) =>\n      (byte)this[i];\n\n   public override long\n   GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) =>\n      throw new NotImplementedException();\n\n   public override char\n   GetChar(int i) =>\n      (char)this[i];\n\n   public override long\n   GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) =>\n      throw new NotImplementedException();\n\n   public override string\n   GetDataTypeName(int i) =>\n      throw new NotImplementedException();\n\n   public override DateTime\n   GetDateTime(int i) =>\n      (DateTime)this[i];\n\n   public override decimal\n   GetDecimal(int i) =>\n      (decimal)this[i];\n\n   public override double\n   GetDouble(int i) =>\n      (double)this[i];\n\n   public override Type\n   GetFieldType(int i) =>\n      throw new NotImplementedException();\n\n   public override float\n   GetFloat(int i) =>\n      (float)this[i];\n\n   public override Guid\n   GetGuid(int i) =>\n      (Guid)this[i];\n\n   public override short\n   GetInt16(int i) =>\n      (short)this[i];\n\n   public override int\n   GetInt32(int i) =>\n      (int)this[i];\n\n   public override long\n   GetInt64(int i) =>\n      (long)this[i];\n\n   public override string\n   GetName(int i) =>\n      _row[i].Key;\n\n   public override int\n   GetOrdinal(string name) =>\n      _row.Select((p, i) => new { p, i })\n         .Where(p => p.p.Key == name)\n         .Select(p => p.i)\n         .DefaultIfEmpty(-1)\n         .First();\n\n   public override string\n   GetString(int i) =>\n      (string)this[i];\n\n   public override object\n   GetValue(int i) =>\n      this[i];\n\n   public override int\n   GetValues(object[] values) =>\n      throw new NotImplementedException();\n\n   public override bool\n   IsDBNull(int i) =>\n      this[i] is null;\n\n   public override bool\n   NextResult() =>\n      throw new NotImplementedException();\n\n   public override bool\n   Read() {\n\n      if (_data.Length > _rowIndex) {\n         _row = _data[_rowIndex];\n         _rowIndex++;\n         return true;\n      }\n\n      return false;\n   }\n}\n"
  }
]