diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..e69de29b
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..176a458f
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9e5be7d2..005582e1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,41 +1,41 @@
-name: CI
-
-on:
- push
-
-env:
- UseSqlServerContainer: true
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
-
- - name: install .NET Core 8/9 SDKs
- uses: actions/setup-dotnet@v2
- with:
- include-prerelease: false
- dotnet-version: |
- 8.0.x
- 9.0.x
-
- - name: checkout repository
- uses: actions/checkout@v2
-
- - name: dotnet restore
- run: dotnet restore
-
- - name: build
- run: dotnet build --configuration Release --no-restore
-
- - name: test
- run: dotnet test --configuration Release --no-build
-
- - name: test results
- uses: EnricoMi/publish-unit-test-result-action@v2
- id: test-results
- if: always()
- with:
- check_name: tests results
- trx_files: "**/test-results/**/*.trx"
+name: CI
+
+on:
+ push
+
+env:
+ UseSqlServerContainer: true
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+
+ - name: install .NET Core 8/9 SDKs
+ uses: actions/setup-dotnet@v2
+ with:
+ include-prerelease: false
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+
+ - name: checkout repository
+ uses: actions/checkout@v2
+
+ - name: dotnet restore
+ run: dotnet restore
+
+ - name: build
+ run: dotnet build --configuration Release --no-restore
+
+ - name: test
+ run: dotnet test --configuration Release --no-build
+
+ - name: test results
+ uses: EnricoMi/publish-unit-test-result-action@v2
+ id: test-results
+ if: always()
+ with:
+ check_name: tests results
+ trx_files: "**/test-results/**/*.trx"
diff --git a/Directory.Build.props b/Directory.Build.props
index 1ce6b889..7e39fc69 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,30 +1,30 @@
-
-
-
- (c) $([System.DateTime]::Now.Year), Pawel Gerr. All rights reserved.
- 9.0.1
- Pawel Gerr
- true
- https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore
- icon.png
- LICENSE.md
- git
- https://pawelgerr@dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_git/Thinktecture.EntityFrameworkCore
- false
- Thinktecture
- net8.0
- 13.0
- enable
- $(NoWarn);CA1303;MSB3884;
- enable
- true
-
- trx%3bLogFileName=$(MSBuildProjectName).trx
- $(MSBuildThisFileDirectory)test-results/$(TargetFramework)
-
-
-
-
-
-
-
+
+
+
+ (c) $([System.DateTime]::Now.Year), Pawel Gerr. All rights reserved.
+ 9.0.1
+ Pawel Gerr
+ true
+ https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore
+ icon.png
+ LICENSE.md
+ git
+ https://pawelgerr@dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_git/Thinktecture.EntityFrameworkCore
+ false
+ Thinktecture
+ net8.0
+ 13.0
+ enable
+ $(NoWarn);CA1303;MSB3884;
+ enable
+ true
+
+ trx%3bLogFileName=$(MSBuildProjectName).trx
+ $(MSBuildThisFileDirectory)test-results/$(TargetFramework)
+
+
+
+
+
+
+
diff --git a/Readme.md b/Readme.md
index 6108816d..71e410b7 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,46 +1,46 @@
-# Thinktecture.EntityFrameworkCore
-
-[![Build Status](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_apis/build/status/Thinktecture.EntityFrameworkCore/Thinktecture.EntityFrameworkCore%20CI?branchName=master)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_build/latest?definitionId=4&branchName=master)
-![NuGet Downloads](https://img.shields.io/nuget/dt/Thinktecture.EntityFrameworkCore.Relational)
-
-
-[![Thinktecture.EntityFrameworkCore.Relational](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Relational.svg?label=Thinktecture.EntityFrameworkCore.Relational&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Relational/)
-[![Thinktecture.EntityFrameworkCore.SqlServer](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.SqlServer.svg?label=Thinktecture.EntityFrameworkCore.SqlServer&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.SqlServer/)
-[![Thinktecture.EntityFrameworkCore.SqlServer.Testing](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.SqlServer.Testing.svg?label=Thinktecture.EntityFrameworkCore.SqlServer.Testing&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.SqlServer.Testing/)
-[![Thinktecture.EntityFrameworkCore.Sqlite](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Sqlite.svg?label=Thinktecture.EntityFrameworkCore.Sqlite&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Sqlite/)
-[![Thinktecture.EntityFrameworkCore.Sqlite.Testing](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Sqlite.Testing.svg?label=Thinktecture.EntityFrameworkCore.Sqlite.Testing&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Sqlite.Testing/)
-
-These libraries extend [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) by a few features to make it easier to work with EF and for easier integration testing or to get more performance in some special cases.
-
-The code and the documentation can be found on [Thinktecture.EntityFrameworkCore](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore)
-
-Use the [repo on GitHub](https://github.com/PawelGerr/Thinktecture.EntityFrameworkCore) to create issues and feature requests.
-
-## Performance
-* [Temp-Tables](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/2/Temp-Tables)
-* [Bulk-Insert](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/65/Bulk-Insert)
-* [Bulk-Update](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/67/Bulk-Update)
-* [Bulk-Upsert (Insert-or-Update)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/69/Bulk-Upsert-(Insert-or-Update))
-* [Truncate Tables](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/64/Truncate-Tables)
-
-## Features
-* [Collection Parameters (temp-tables *light*)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/109/Collection-Parameters-(temp-tables-light)) (SQL Server)
-* [Window Functions Support (RowNumber, Sum, Average, Min, Max)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki?wikiVersion=GBwikiMaster&pagePath=/Features/Window%20Functions%20Support%20(RowNumber%2C%20Sum%2C%20Average%2C%20Min%2C%20Max)&pageId=14&_a=edit)
-* [Nested (virtual) Transactions](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/40/Nested-(virtual)-Transactions)
-* [Table Hints](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/71/Table-Hints-(SQL-Server)) (SQL Server)
-* [Queries accross multiple databases](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/43/Queries-accross-multiple-databases) (SQL Server)
-* [Changing default schema at runtime](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/6/Changing-default-schema-at-runtime)
-* [If-Exists / If-Not-Exists checks in migrations](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/7/If-(Not-)Exists-checks-in-migrations) (SQL Server)
-
-## Convenience
-* [Extension method LeftJoin](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/4/Extension-method-LeftJoin)
-* [Migrations: include-columns](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/9/Migrations-Include-columns) (SQL Server)
-* [Migrations: identity column](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/28/Migrations-Identity-column) (SQL Server)
-* [Migrations: (non-)clustered PK](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/29/Migrations-(Non-)Clustered-PK) (SQL Server)
-
-## Integration Testing
-* [Isolation of tests](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/12/Isolation-of-tests) (SQL Server, SQLite)
-
-## Extensibility
-* [Adding custom IRelationalTypeMappingSourcePlugin](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/26/Adding-custom-IRelationalTypeMappingSourcePlugin)
-* [Adding custom IEvaluatableExpressionFilter](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/31/Adding-custom-IEvaluatableExpressionFilter)
+# Thinktecture.EntityFrameworkCore
+
+[![Build Status](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_apis/build/status/Thinktecture.EntityFrameworkCore/Thinktecture.EntityFrameworkCore%20CI?branchName=master)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_build/latest?definitionId=4&branchName=master)
+![NuGet Downloads](https://img.shields.io/nuget/dt/Thinktecture.EntityFrameworkCore.Relational)
+
+
+[![Thinktecture.EntityFrameworkCore.Relational](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Relational.svg?label=Thinktecture.EntityFrameworkCore.Relational&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Relational/)
+[![Thinktecture.EntityFrameworkCore.SqlServer](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.SqlServer.svg?label=Thinktecture.EntityFrameworkCore.SqlServer&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.SqlServer/)
+[![Thinktecture.EntityFrameworkCore.SqlServer.Testing](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.SqlServer.Testing.svg?label=Thinktecture.EntityFrameworkCore.SqlServer.Testing&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.SqlServer.Testing/)
+[![Thinktecture.EntityFrameworkCore.Sqlite](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Sqlite.svg?label=Thinktecture.EntityFrameworkCore.Sqlite&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Sqlite/)
+[![Thinktecture.EntityFrameworkCore.Sqlite.Testing](https://img.shields.io/nuget/vpre/Thinktecture.EntityFrameworkCore.Sqlite.Testing.svg?label=Thinktecture.EntityFrameworkCore.Sqlite.Testing&maxAge=3600)](https://www.nuget.org/packages/Thinktecture.EntityFrameworkCore.Sqlite.Testing/)
+
+These libraries extend [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) by a few features to make it easier to work with EF and for easier integration testing or to get more performance in some special cases.
+
+The code and the documentation can be found on [Thinktecture.EntityFrameworkCore](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore)
+
+Use the [repo on GitHub](https://github.com/PawelGerr/Thinktecture.EntityFrameworkCore) to create issues and feature requests.
+
+## Performance
+* [Temp-Tables](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/2/Temp-Tables)
+* [Bulk-Insert](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/65/Bulk-Insert)
+* [Bulk-Update](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/67/Bulk-Update)
+* [Bulk-Upsert (Insert-or-Update)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/69/Bulk-Upsert-(Insert-or-Update))
+* [Truncate Tables](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/64/Truncate-Tables)
+
+## Features
+* [Collection Parameters (temp-tables *light*)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/109/Collection-Parameters-(temp-tables-light)) (SQL Server)
+* [Window Functions Support (RowNumber, Sum, Average, Min, Max)](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki?wikiVersion=GBwikiMaster&pagePath=/Features/Window%20Functions%20Support%20(RowNumber%2C%20Sum%2C%20Average%2C%20Min%2C%20Max)&pageId=14&_a=edit)
+* [Nested (virtual) Transactions](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/40/Nested-(virtual)-Transactions)
+* [Table Hints](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/71/Table-Hints-(SQL-Server)) (SQL Server)
+* [Queries accross multiple databases](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/43/Queries-accross-multiple-databases) (SQL Server)
+* [Changing default schema at runtime](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/6/Changing-default-schema-at-runtime)
+* [If-Exists / If-Not-Exists checks in migrations](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/7/If-(Not-)Exists-checks-in-migrations) (SQL Server)
+
+## Convenience
+* [Extension method LeftJoin](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/4/Extension-method-LeftJoin)
+* [Migrations: include-columns](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/9/Migrations-Include-columns) (SQL Server)
+* [Migrations: identity column](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/28/Migrations-Identity-column) (SQL Server)
+* [Migrations: (non-)clustered PK](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/29/Migrations-(Non-)Clustered-PK) (SQL Server)
+
+## Integration Testing
+* [Isolation of tests](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/12/Isolation-of-tests) (SQL Server, SQLite)
+
+## Extensibility
+* [Adding custom IRelationalTypeMappingSourcePlugin](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/26/Adding-custom-IRelationalTypeMappingSourcePlugin)
+* [Adding custom IEvaluatableExpressionFilter](https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore/_wiki/wikis/Thinktecture.EntityFrameworkCore.wiki/31/Adding-custom-IEvaluatableExpressionFilter)
diff --git a/Thinktecture.EntityFrameworkCore.sln b/Thinktecture.EntityFrameworkCore.sln
index 67da4f28..6993774d 100644
--- a/Thinktecture.EntityFrameworkCore.sln
+++ b/Thinktecture.EntityFrameworkCore.sln
@@ -1,153 +1,155 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{564262E5-94E5-4B32-8B0E-444D454DD35F}"
-ProjectSection(SolutionItems) = preProject
- src\Directory.Build.props = src\Directory.Build.props
-EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}"
-ProjectSection(SolutionItems) = preProject
- tests\Directory.Build.props = tests\Directory.Build.props
-EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}"
- ProjectSection(SolutionItems) = preProject
- samples\Directory.Build.props = samples\Directory.Build.props
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Relational", "src\Thinktecture.EntityFrameworkCore.Relational\Thinktecture.EntityFrameworkCore.Relational.csproj", "{B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer", "src\Thinktecture.EntityFrameworkCore.SqlServer\Thinktecture.EntityFrameworkCore.SqlServer.csproj", "{FCB9BC17-69FE-4CB1-A8E8-665316B68B30}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{2CFD0F6C-599B-41DA-A754-03A202B68D12}"
-ProjectSection(SolutionItems) = preProject
- ci\ci.ps1 = ci\ci.ps1
- azure-pipelines.yml = azure-pipelines.yml
- LICENSE.md = LICENSE.md
- README.md = README.md
- Directory.Build.props = Directory.Build.props
- .gitignore = .gitignore
- icon.png = icon.png
- .github\workflows\main.yml = .github\workflows\main.yml
- global.json = global.json
- Directory.Packages.props = Directory.Packages.props
-EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Testing", "src\Thinktecture.EntityFrameworkCore.SqlServer.Testing\Thinktecture.EntityFrameworkCore.SqlServer.Testing.csproj", "{4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Relational.Tests", "tests\Thinktecture.EntityFrameworkCore.Relational.Tests\Thinktecture.EntityFrameworkCore.Relational.Tests.csproj", "{629B6159-5050-4510-A24A-51630CD46854}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Tests", "tests\Thinktecture.EntityFrameworkCore.SqlServer.Tests\Thinktecture.EntityFrameworkCore.SqlServer.Tests.csproj", "{B6A31BA8-19A3-4563-BD4E-313C950A012F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Samples", "samples\Thinktecture.EntityFrameworkCore.SqlServer.Samples\Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj", "{D2A55DD1-3642-4355-9E36-599238C80C14}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite", "src\Thinktecture.EntityFrameworkCore.Sqlite\Thinktecture.EntityFrameworkCore.Sqlite.csproj", "{5734E627-253B-4A5A-9AF9-937C9CFCE3D6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.BulkOperations", "src\Thinktecture.EntityFrameworkCore.BulkOperations\Thinktecture.EntityFrameworkCore.BulkOperations.csproj", "{441D3FD0-CACF-45E5-A15B-A59FCACB94C5}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Samples", "samples\Thinktecture.EntityFrameworkCore.Sqlite.Samples\Thinktecture.EntityFrameworkCore.Sqlite.Samples.csproj", "{F273CC1E-A91E-4166-9810-2F56106512F8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Tests", "tests\Thinktecture.EntityFrameworkCore.Sqlite.Tests\Thinktecture.EntityFrameworkCore.Sqlite.Tests.csproj", "{392C12CE-E21E-43C2-9718-964EAE5F2AA0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Testing", "src\Thinktecture.EntityFrameworkCore.Testing\Thinktecture.EntityFrameworkCore.Testing.csproj", "{BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Testing", "src\Thinktecture.EntityFrameworkCore.Sqlite.Testing\Thinktecture.EntityFrameworkCore.Sqlite.Testing.csproj", "{C553EA83-3793-4B28-99BB-66A148564746}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Testing.Tests", "tests\Thinktecture.EntityFrameworkCore.Testing.Tests\Thinktecture.EntityFrameworkCore.Testing.Tests.csproj", "{E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.BulkOperations.Tests", "tests\Thinktecture.EntityFrameworkCore.BulkOperations.Tests\Thinktecture.EntityFrameworkCore.BulkOperations.Tests.csproj", "{8B96D351-8A49-41C2-ABC8-5F9DC047C774}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.TestHelpers", "tests\Thinktecture.EntityFrameworkCore.TestHelpers\Thinktecture.EntityFrameworkCore.TestHelpers.csproj", "{5A64640B-7EF4-43EE-BC65-09960A0B52E1}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Benchmarks", "samples\Thinktecture.EntityFrameworkCore.Benchmarks\Thinktecture.EntityFrameworkCore.Benchmarks.csproj", "{A279120C-4417-4C8B-9BEA-5C505DDFFB8D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {FCB9BC17-69FE-4CB1-A8E8-665316B68B30} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {629B6159-5050-4510-A24A-51630CD46854} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {B6A31BA8-19A3-4563-BD4E-313C950A012F} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {D2A55DD1-3642-4355-9E36-599238C80C14} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
- {5734E627-253B-4A5A-9AF9-937C9CFCE3D6} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {441D3FD0-CACF-45E5-A15B-A59FCACB94C5} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {F273CC1E-A91E-4166-9810-2F56106512F8} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
- {392C12CE-E21E-43C2-9718-964EAE5F2AA0} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {C553EA83-3793-4B28-99BB-66A148564746} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
- {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {8B96D351-8A49-41C2-ABC8-5F9DC047C774} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {5A64640B-7EF4-43EE-BC65-09960A0B52E1} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
- {A279120C-4417-4C8B-9BEA-5C505DDFFB8D} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Release|Any CPU.Build.0 = Release|Any CPU
- {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Release|Any CPU.Build.0 = Release|Any CPU
- {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Release|Any CPU.Build.0 = Release|Any CPU
- {629B6159-5050-4510-A24A-51630CD46854}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {629B6159-5050-4510-A24A-51630CD46854}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {629B6159-5050-4510-A24A-51630CD46854}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {629B6159-5050-4510-A24A-51630CD46854}.Release|Any CPU.Build.0 = Release|Any CPU
- {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Release|Any CPU.Build.0 = Release|Any CPU
- {D2A55DD1-3642-4355-9E36-599238C80C14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D2A55DD1-3642-4355-9E36-599238C80C14}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D2A55DD1-3642-4355-9E36-599238C80C14}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D2A55DD1-3642-4355-9E36-599238C80C14}.Release|Any CPU.Build.0 = Release|Any CPU
- {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Release|Any CPU.Build.0 = Release|Any CPU
- {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Release|Any CPU.Build.0 = Release|Any CPU
- {F273CC1E-A91E-4166-9810-2F56106512F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F273CC1E-A91E-4166-9810-2F56106512F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F273CC1E-A91E-4166-9810-2F56106512F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F273CC1E-A91E-4166-9810-2F56106512F8}.Release|Any CPU.Build.0 = Release|Any CPU
- {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Release|Any CPU.Build.0 = Release|Any CPU
- {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Release|Any CPU.Build.0 = Release|Any CPU
- {C553EA83-3793-4B28-99BB-66A148564746}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C553EA83-3793-4B28-99BB-66A148564746}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C553EA83-3793-4B28-99BB-66A148564746}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C553EA83-3793-4B28-99BB-66A148564746}.Release|Any CPU.Build.0 = Release|Any CPU
- {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Release|Any CPU.Build.0 = Release|Any CPU
- {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Release|Any CPU.Build.0 = Release|Any CPU
- {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{564262E5-94E5-4B32-8B0E-444D454DD35F}"
+ProjectSection(SolutionItems) = preProject
+ src\Directory.Build.props = src\Directory.Build.props
+EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}"
+ProjectSection(SolutionItems) = preProject
+ tests\Directory.Build.props = tests\Directory.Build.props
+EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}"
+ ProjectSection(SolutionItems) = preProject
+ samples\Directory.Build.props = samples\Directory.Build.props
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Relational", "src\Thinktecture.EntityFrameworkCore.Relational\Thinktecture.EntityFrameworkCore.Relational.csproj", "{B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer", "src\Thinktecture.EntityFrameworkCore.SqlServer\Thinktecture.EntityFrameworkCore.SqlServer.csproj", "{FCB9BC17-69FE-4CB1-A8E8-665316B68B30}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{2CFD0F6C-599B-41DA-A754-03A202B68D12}"
+ProjectSection(SolutionItems) = preProject
+ ci\ci.ps1 = ci\ci.ps1
+ azure-pipelines.yml = azure-pipelines.yml
+ LICENSE.md = LICENSE.md
+ README.md = README.md
+ Directory.Build.props = Directory.Build.props
+ .gitignore = .gitignore
+ icon.png = icon.png
+ .github\workflows\main.yml = .github\workflows\main.yml
+ global.json = global.json
+ Directory.Packages.props = Directory.Packages.props
+ .editorconfig = .editorconfig
+ .gitattributes = .gitattributes
+EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Testing", "src\Thinktecture.EntityFrameworkCore.SqlServer.Testing\Thinktecture.EntityFrameworkCore.SqlServer.Testing.csproj", "{4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Relational.Tests", "tests\Thinktecture.EntityFrameworkCore.Relational.Tests\Thinktecture.EntityFrameworkCore.Relational.Tests.csproj", "{629B6159-5050-4510-A24A-51630CD46854}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Tests", "tests\Thinktecture.EntityFrameworkCore.SqlServer.Tests\Thinktecture.EntityFrameworkCore.SqlServer.Tests.csproj", "{B6A31BA8-19A3-4563-BD4E-313C950A012F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.SqlServer.Samples", "samples\Thinktecture.EntityFrameworkCore.SqlServer.Samples\Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj", "{D2A55DD1-3642-4355-9E36-599238C80C14}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite", "src\Thinktecture.EntityFrameworkCore.Sqlite\Thinktecture.EntityFrameworkCore.Sqlite.csproj", "{5734E627-253B-4A5A-9AF9-937C9CFCE3D6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.BulkOperations", "src\Thinktecture.EntityFrameworkCore.BulkOperations\Thinktecture.EntityFrameworkCore.BulkOperations.csproj", "{441D3FD0-CACF-45E5-A15B-A59FCACB94C5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Samples", "samples\Thinktecture.EntityFrameworkCore.Sqlite.Samples\Thinktecture.EntityFrameworkCore.Sqlite.Samples.csproj", "{F273CC1E-A91E-4166-9810-2F56106512F8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Tests", "tests\Thinktecture.EntityFrameworkCore.Sqlite.Tests\Thinktecture.EntityFrameworkCore.Sqlite.Tests.csproj", "{392C12CE-E21E-43C2-9718-964EAE5F2AA0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Testing", "src\Thinktecture.EntityFrameworkCore.Testing\Thinktecture.EntityFrameworkCore.Testing.csproj", "{BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Sqlite.Testing", "src\Thinktecture.EntityFrameworkCore.Sqlite.Testing\Thinktecture.EntityFrameworkCore.Sqlite.Testing.csproj", "{C553EA83-3793-4B28-99BB-66A148564746}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Testing.Tests", "tests\Thinktecture.EntityFrameworkCore.Testing.Tests\Thinktecture.EntityFrameworkCore.Testing.Tests.csproj", "{E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.BulkOperations.Tests", "tests\Thinktecture.EntityFrameworkCore.BulkOperations.Tests\Thinktecture.EntityFrameworkCore.BulkOperations.Tests.csproj", "{8B96D351-8A49-41C2-ABC8-5F9DC047C774}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.TestHelpers", "tests\Thinktecture.EntityFrameworkCore.TestHelpers\Thinktecture.EntityFrameworkCore.TestHelpers.csproj", "{5A64640B-7EF4-43EE-BC65-09960A0B52E1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thinktecture.EntityFrameworkCore.Benchmarks", "samples\Thinktecture.EntityFrameworkCore.Benchmarks\Thinktecture.EntityFrameworkCore.Benchmarks.csproj", "{A279120C-4417-4C8B-9BEA-5C505DDFFB8D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {FCB9BC17-69FE-4CB1-A8E8-665316B68B30} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {629B6159-5050-4510-A24A-51630CD46854} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {B6A31BA8-19A3-4563-BD4E-313C950A012F} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {D2A55DD1-3642-4355-9E36-599238C80C14} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
+ {5734E627-253B-4A5A-9AF9-937C9CFCE3D6} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {441D3FD0-CACF-45E5-A15B-A59FCACB94C5} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {F273CC1E-A91E-4166-9810-2F56106512F8} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
+ {392C12CE-E21E-43C2-9718-964EAE5F2AA0} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {C553EA83-3793-4B28-99BB-66A148564746} = {564262E5-94E5-4B32-8B0E-444D454DD35F}
+ {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {8B96D351-8A49-41C2-ABC8-5F9DC047C774} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {5A64640B-7EF4-43EE-BC65-09960A0B52E1} = {FC71B400-ACDA-4BBE-BCC1-D1CFB4EDEFE3}
+ {A279120C-4417-4C8B-9BEA-5C505DDFFB8D} = {30567A9D-BDC2-49C1-B0B4-91D37FB5CCC1}
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B43A04CC-FB33-4B06-AC9B-BBDE177EF0E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FCB9BC17-69FE-4CB1-A8E8-665316B68B30}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A68E5B4-B0C9-4076-875A-C88AFAC5EB5F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {629B6159-5050-4510-A24A-51630CD46854}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {629B6159-5050-4510-A24A-51630CD46854}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {629B6159-5050-4510-A24A-51630CD46854}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {629B6159-5050-4510-A24A-51630CD46854}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6A31BA8-19A3-4563-BD4E-313C950A012F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D2A55DD1-3642-4355-9E36-599238C80C14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D2A55DD1-3642-4355-9E36-599238C80C14}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D2A55DD1-3642-4355-9E36-599238C80C14}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D2A55DD1-3642-4355-9E36-599238C80C14}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5734E627-253B-4A5A-9AF9-937C9CFCE3D6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {441D3FD0-CACF-45E5-A15B-A59FCACB94C5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F273CC1E-A91E-4166-9810-2F56106512F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F273CC1E-A91E-4166-9810-2F56106512F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F273CC1E-A91E-4166-9810-2F56106512F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F273CC1E-A91E-4166-9810-2F56106512F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {392C12CE-E21E-43C2-9718-964EAE5F2AA0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BEF60B0C-F3D0-4FB3-B975-63AA20A5AC59}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C553EA83-3793-4B28-99BB-66A148564746}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C553EA83-3793-4B28-99BB-66A148564746}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C553EA83-3793-4B28-99BB-66A148564746}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C553EA83-3793-4B28-99BB-66A148564746}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E2A920F7-ED3D-4C73-8207-8C578A9B8AD8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8B96D351-8A49-41C2-ABC8-5F9DC047C774}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5A64640B-7EF4-43EE-BC65-09960A0B52E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A279120C-4417-4C8B-9BEA-5C505DDFFB8D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props
index c36d432a..e53df4d3 100644
--- a/samples/Directory.Build.props
+++ b/samples/Directory.Build.props
@@ -1,14 +1,14 @@
-
-
-
- $([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))
- false
-
-
-
-
-
- net9.0
-
-
-
+
+
+
+ $([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))
+ false
+
+
+
+
+
+ net9.0
+
+
+
diff --git a/samples/Thinktecture.EntityFrameworkCore.Benchmarks/Benchmarking/ReferenceEqualityValueComparer.cs b/samples/Thinktecture.EntityFrameworkCore.Benchmarks/Benchmarking/ReferenceEqualityValueComparer.cs
index 169a2648..a01232a6 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Benchmarks/Benchmarking/ReferenceEqualityValueComparer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Benchmarks/Benchmarking/ReferenceEqualityValueComparer.cs
@@ -1,98 +1,98 @@
-using BenchmarkDotNet.Attributes;
-using Microsoft.Extensions.DependencyInjection;
-using Thinktecture.Database;
-
-namespace Thinktecture.Benchmarking;
-
-[MemoryDiagnoser]
-public class ReferenceEqualityValueComparer : IDisposable
-{
- private BenchmarkContext? _benchmarkContext;
- private IServiceScope? _scope;
- private SqlServerBenchmarkDbContext? _sqlServerDbContext;
-
- private const int _BYTES_LENGTH = 1024;
-
- private int _counter;
- private readonly byte[] _bytesBestCase = new byte[_BYTES_LENGTH];
- private readonly byte[] _bytesWorstCase = new byte[_BYTES_LENGTH];
-
- private List _entitiesWithDefaultComparer = null!;
- private List _entitiesWithCustomComparer = null!;
-
- [GlobalSetup]
- public void Initialize()
- {
- _benchmarkContext = new BenchmarkContext();
- _scope = _benchmarkContext.RootServiceProvider.CreateScope();
- _sqlServerDbContext = _scope.ServiceProvider.GetRequiredService();
-
- _sqlServerDbContext.Database.EnsureDeleted();
- _sqlServerDbContext.Database.EnsureCreated();
-
- _sqlServerDbContext.EntitiesWithByteArray.ExecuteDelete();
- _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.ExecuteDelete();
-
- var bytes = new byte[_BYTES_LENGTH];
-
- for (var i = 0; i < 10_000; i++)
- {
- var id = new Guid($"66AFED1B-92EA-4483-BF4F-{i.ToString("X").PadLeft(12, '0')}");
-
- _sqlServerDbContext.EntitiesWithByteArray.Add(new EntityWithByteArray(id, bytes));
- _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.Add(new EntityWithByteArrayAndValueComparer(id, bytes));
- }
-
- _sqlServerDbContext.SaveChanges();
- _sqlServerDbContext.ChangeTracker.Clear();
- }
-
- [GlobalCleanup]
- public void Dispose()
- {
- _scope?.Dispose();
- _benchmarkContext?.Dispose();
- }
-
- [IterationSetup]
- public void IterationSetup()
- {
- _sqlServerDbContext!.ChangeTracker.Clear();
- _entitiesWithDefaultComparer = _sqlServerDbContext.EntitiesWithByteArray.ToList();
- _entitiesWithCustomComparer = _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.ToList();
-
- _bytesBestCase[0] = _bytesWorstCase[^1] = (byte)(++_counter % Byte.MaxValue);
- }
-
- [Benchmark]
- public async Task Default_BestCase()
- {
- _entitiesWithDefaultComparer.ForEach(e => e.Bytes = _bytesBestCase);
-
- await _sqlServerDbContext!.SaveChangesAsync();
- }
-
- [Benchmark]
- public async Task Default_WorstCase()
- {
- _entitiesWithDefaultComparer.ForEach(e => e.Bytes = _bytesWorstCase);
-
- await _sqlServerDbContext!.SaveChangesAsync();
- }
-
- [Benchmark]
- public async Task ReferenceEquality_BestCase()
- {
- _entitiesWithCustomComparer.ForEach(e => e.Bytes = _bytesBestCase);
-
- await _sqlServerDbContext!.SaveChangesAsync();
- }
-
- [Benchmark]
- public async Task ReferenceEquality_WorstCase()
- {
- _entitiesWithCustomComparer.ForEach(e => e.Bytes = _bytesWorstCase);
-
- await _sqlServerDbContext!.SaveChangesAsync();
- }
-}
+using BenchmarkDotNet.Attributes;
+using Microsoft.Extensions.DependencyInjection;
+using Thinktecture.Database;
+
+namespace Thinktecture.Benchmarking;
+
+[MemoryDiagnoser]
+public class ReferenceEqualityValueComparer : IDisposable
+{
+ private BenchmarkContext? _benchmarkContext;
+ private IServiceScope? _scope;
+ private SqlServerBenchmarkDbContext? _sqlServerDbContext;
+
+ private const int _BYTES_LENGTH = 1024;
+
+ private int _counter;
+ private readonly byte[] _bytesBestCase = new byte[_BYTES_LENGTH];
+ private readonly byte[] _bytesWorstCase = new byte[_BYTES_LENGTH];
+
+ private List _entitiesWithDefaultComparer = null!;
+ private List _entitiesWithCustomComparer = null!;
+
+ [GlobalSetup]
+ public void Initialize()
+ {
+ _benchmarkContext = new BenchmarkContext();
+ _scope = _benchmarkContext.RootServiceProvider.CreateScope();
+ _sqlServerDbContext = _scope.ServiceProvider.GetRequiredService();
+
+ _sqlServerDbContext.Database.EnsureDeleted();
+ _sqlServerDbContext.Database.EnsureCreated();
+
+ _sqlServerDbContext.EntitiesWithByteArray.ExecuteDelete();
+ _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.ExecuteDelete();
+
+ var bytes = new byte[_BYTES_LENGTH];
+
+ for (var i = 0; i < 10_000; i++)
+ {
+ var id = new Guid($"66AFED1B-92EA-4483-BF4F-{i.ToString("X").PadLeft(12, '0')}");
+
+ _sqlServerDbContext.EntitiesWithByteArray.Add(new EntityWithByteArray(id, bytes));
+ _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.Add(new EntityWithByteArrayAndValueComparer(id, bytes));
+ }
+
+ _sqlServerDbContext.SaveChanges();
+ _sqlServerDbContext.ChangeTracker.Clear();
+ }
+
+ [GlobalCleanup]
+ public void Dispose()
+ {
+ _scope?.Dispose();
+ _benchmarkContext?.Dispose();
+ }
+
+ [IterationSetup]
+ public void IterationSetup()
+ {
+ _sqlServerDbContext!.ChangeTracker.Clear();
+ _entitiesWithDefaultComparer = _sqlServerDbContext.EntitiesWithByteArray.ToList();
+ _entitiesWithCustomComparer = _sqlServerDbContext.EntitiesWithByteArrayAndValueComparer.ToList();
+
+ _bytesBestCase[0] = _bytesWorstCase[^1] = (byte)(++_counter % Byte.MaxValue);
+ }
+
+ [Benchmark]
+ public async Task Default_BestCase()
+ {
+ _entitiesWithDefaultComparer.ForEach(e => e.Bytes = _bytesBestCase);
+
+ await _sqlServerDbContext!.SaveChangesAsync();
+ }
+
+ [Benchmark]
+ public async Task Default_WorstCase()
+ {
+ _entitiesWithDefaultComparer.ForEach(e => e.Bytes = _bytesWorstCase);
+
+ await _sqlServerDbContext!.SaveChangesAsync();
+ }
+
+ [Benchmark]
+ public async Task ReferenceEquality_BestCase()
+ {
+ _entitiesWithCustomComparer.ForEach(e => e.Bytes = _bytesBestCase);
+
+ await _sqlServerDbContext!.SaveChangesAsync();
+ }
+
+ [Benchmark]
+ public async Task ReferenceEquality_WorstCase()
+ {
+ _entitiesWithCustomComparer.ForEach(e => e.Bytes = _bytesWorstCase);
+
+ await _sqlServerDbContext!.SaveChangesAsync();
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/CurrentTenant.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/CurrentTenant.cs
index 69745358..9952cfb1 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/CurrentTenant.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/CurrentTenant.cs
@@ -1,6 +1,6 @@
-namespace Thinktecture;
-
-public static class CurrentTenant
-{
- public static string? Value { get; set; }
+namespace Thinktecture;
+
+public static class CurrentTenant
+{
+ public static string? Value { get; set; }
}
\ No newline at end of file
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Customer.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Customer.cs
index 237ba3f0..92b6f5dc 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Customer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Customer.cs
@@ -1,36 +1,36 @@
-namespace Thinktecture.Database;
-
-public class Customer
-{
- public Guid Id { get; private set; }
- public string FirstName { get; private set; }
- public string LastName { get; private set; }
- public long RowVersion { get; private set; }
-
- private List? _orders;
-
- // ReSharper disable once UnusedMember.Global
- public List Orders
- {
- get => _orders ??= new List();
- set => _orders = value;
- }
-
-#nullable disable
- private Customer()
- {
- }
-#nullable enable
-
- public Customer(Guid id, string firstName, string lastName)
- {
- Id = id;
- FirstName = firstName;
- LastName = lastName;
- }
-
- public override string ToString()
- {
- return $"{{ CustomerId='{Id}', FirstName='{FirstName}', LastName='{LastName}', RowVersion={RowVersion} }}";
- }
-}
+namespace Thinktecture.Database;
+
+public class Customer
+{
+ public Guid Id { get; private set; }
+ public string FirstName { get; private set; }
+ public string LastName { get; private set; }
+ public long RowVersion { get; private set; }
+
+ private List? _orders;
+
+ // ReSharper disable once UnusedMember.Global
+ public List Orders
+ {
+ get => _orders ??= new List();
+ set => _orders = value;
+ }
+
+#nullable disable
+ private Customer()
+ {
+ }
+#nullable enable
+
+ public Customer(Guid id, string firstName, string lastName)
+ {
+ Id = id;
+ FirstName = firstName;
+ LastName = lastName;
+ }
+
+ public override string ToString()
+ {
+ return $"{{ CustomerId='{Id}', FirstName='{FirstName}', LastName='{LastName}', RowVersion={RowVersion} }}";
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContext.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContext.cs
index 99d83f30..c7316735 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContext.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContext.cs
@@ -1,53 +1,53 @@
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.EntityFrameworkCore;
-
-namespace Thinktecture.Database;
-
-public class DemoDbContext : DbContext, IDbDefaultSchema
-{
- ///
- public string? Schema { get; }
-
-#nullable disable
- public DbSet Customers { get; set; }
- public DbSet Products { get; set; }
- public DbSet Orders { get; set; }
- public DbSet OrderItems { get; set; }
-#nullable enable
-
- public DemoDbContext(DbContextOptions options, IDbDefaultSchema? schema = null)
- : base(options)
- {
- Schema = schema?.Schema;
- }
-
- ///
- protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
- {
- configurationBuilder.Properties(builder => builder
- .HavePrecision(18, 5));
- }
-
- ///
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
-
- modelBuilder.ConfigureTempTable();
- modelBuilder.ConfigureTempTable();
-
- modelBuilder.ConfigureComplexCollectionParameter();
-
- modelBuilder.Entity(builder =>
- {
- builder.Property(c => c.FirstName).HasMaxLength(100);
- builder.Property(c => c.LastName).HasMaxLength(100);
-
- builder.Property(c => c.RowVersion)
- .IsRowVersion()
- .HasConversion(new NumberToBytesConverter());
- });
-
- modelBuilder.Entity().HasKey(i => new { i.OrderId, i.ProductId });
- }
-}
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.EntityFrameworkCore;
+
+namespace Thinktecture.Database;
+
+public class DemoDbContext : DbContext, IDbDefaultSchema
+{
+ ///
+ public string? Schema { get; }
+
+#nullable disable
+ public DbSet Customers { get; set; }
+ public DbSet Products { get; set; }
+ public DbSet Orders { get; set; }
+ public DbSet OrderItems { get; set; }
+#nullable enable
+
+ public DemoDbContext(DbContextOptions options, IDbDefaultSchema? schema = null)
+ : base(options)
+ {
+ Schema = schema?.Schema;
+ }
+
+ ///
+ protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
+ {
+ configurationBuilder.Properties(builder => builder
+ .HavePrecision(18, 5));
+ }
+
+ ///
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ modelBuilder.ConfigureTempTable();
+ modelBuilder.ConfigureTempTable();
+
+ modelBuilder.ConfigureComplexCollectionParameter();
+
+ modelBuilder.Entity(builder =>
+ {
+ builder.Property(c => c.FirstName).HasMaxLength(100);
+ builder.Property(c => c.LastName).HasMaxLength(100);
+
+ builder.Property(c => c.RowVersion)
+ .IsRowVersion()
+ .HasConversion(new NumberToBytesConverter());
+ });
+
+ modelBuilder.Entity().HasKey(i => new { i.OrderId, i.ProductId });
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
index 517ffa53..d993b407 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
@@ -1,16 +1,16 @@
-using Microsoft.EntityFrameworkCore.Design;
-
-namespace Thinktecture.Database;
-
-public class DemoDbContextDesignTimeDbContextFactory : IDesignTimeDbContextFactory
-{
- public DemoDbContext CreateDbContext(string[] args)
- {
- var options = new DbContextOptionsBuilder()
- .UseSqlServer(SamplesContext.Instance.ConnectionString)
- .AddSchemaRespectingComponents()
- .Options;
-
- return new DemoDbContext(options);
- }
+using Microsoft.EntityFrameworkCore.Design;
+
+namespace Thinktecture.Database;
+
+public class DemoDbContextDesignTimeDbContextFactory : IDesignTimeDbContextFactory
+{
+ public DemoDbContext CreateDbContext(string[] args)
+ {
+ var options = new DbContextOptionsBuilder()
+ .UseSqlServer(SamplesContext.Instance.ConnectionString)
+ .AddSchemaRespectingComponents()
+ .Options;
+
+ return new DemoDbContext(options);
+ }
}
\ No newline at end of file
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Order.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Order.cs
index 47d9d730..6f5f3ecd 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Order.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Order.cs
@@ -1,22 +1,22 @@
-namespace Thinktecture.Database;
-
-public class Order
-{
- public Guid Id { get; set; }
- public DateTime Date { get; set; }
- public string? Text { get; set; }
- public Guid CustomerId { get; set; }
-
-#nullable disable
- public Customer Customer { get; set; }
-#nullable enable
-
- private List? _orderItems;
-
- // ReSharper disable once UnusedMember.Global
- public List OrderItems
- {
- get => _orderItems ??= new List();
- set => _orderItems = value;
- }
-}
+namespace Thinktecture.Database;
+
+public class Order
+{
+ public Guid Id { get; set; }
+ public DateTime Date { get; set; }
+ public string? Text { get; set; }
+ public Guid CustomerId { get; set; }
+
+#nullable disable
+ public Customer Customer { get; set; }
+#nullable enable
+
+ private List? _orderItems;
+
+ // ReSharper disable once UnusedMember.Global
+ public List OrderItems
+ {
+ get => _orderItems ??= new List();
+ set => _orderItems = value;
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/OrderItem.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/OrderItem.cs
index a368d6b0..6d103bb4 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/OrderItem.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/OrderItem.cs
@@ -1,13 +1,13 @@
-namespace Thinktecture.Database;
-
-public class OrderItem
-{
- public Guid OrderId { get; set; }
- public Guid ProductId { get; set; }
- public int Count { get; set; }
-
-#nullable disable
- public Order Order { get; set; }
- public Product Product { get; set; }
-#nullable enable
-}
+namespace Thinktecture.Database;
+
+public class OrderItem
+{
+ public Guid OrderId { get; set; }
+ public Guid ProductId { get; set; }
+ public int Count { get; set; }
+
+#nullable disable
+ public Order Order { get; set; }
+ public Product Product { get; set; }
+#nullable enable
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Product.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Product.cs
index e496d9f8..f7a2ef82 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Product.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Database/Product.cs
@@ -1,15 +1,15 @@
-namespace Thinktecture.Database;
-
-public class Product
-{
- public Guid Id { get; set; }
-
- private List? _orderItems;
-
- // ReSharper disable once UnusedMember.Global
- public List OrderItems
- {
- get => _orderItems ??= new List();
- set => _orderItems = value;
- }
-}
+namespace Thinktecture.Database;
+
+public class Product
+{
+ public Guid Id { get; set; }
+
+ private List? _orderItems;
+
+ // ReSharper disable once UnusedMember.Global
+ public List OrderItems
+ {
+ get => _orderItems ??= new List();
+ set => _orderItems = value;
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProvider.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProvider.cs
index e95c78ce..c73bb14c 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProvider.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProvider.cs
@@ -1,25 +1,25 @@
-using Thinktecture.EntityFrameworkCore.Query;
-
-namespace Thinktecture;
-
-public class DemoTenantDatabaseProvider : ITenantDatabaseProvider
-{
- public string? Tenant { get; }
-
- public DemoTenantDatabaseProvider(string? tenant)
- {
- Tenant = tenant;
- }
-
- ///
- public string? GetDatabaseName(string? schema, string table)
- {
- if (Tenant == "1")
- return "demo";
-
- if (Tenant == "2")
- return "demo2";
-
- return null;
- }
-}
+using Thinktecture.EntityFrameworkCore.Query;
+
+namespace Thinktecture;
+
+public class DemoTenantDatabaseProvider : ITenantDatabaseProvider
+{
+ public string? Tenant { get; }
+
+ public DemoTenantDatabaseProvider(string? tenant)
+ {
+ Tenant = tenant;
+ }
+
+ ///
+ public string? GetDatabaseName(string? schema, string table)
+ {
+ if (Tenant == "1")
+ return "demo";
+
+ if (Tenant == "2")
+ return "demo2";
+
+ return null;
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProviderFactory.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProviderFactory.cs
index 6b1ea75d..f9d3a4b0 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProviderFactory.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/DemoTenantDatabaseProviderFactory.cs
@@ -1,12 +1,12 @@
-using Thinktecture.EntityFrameworkCore.Query;
-
-namespace Thinktecture;
-
-public class DemoTenantDatabaseProviderFactory : ITenantDatabaseProviderFactory
-{
- ///
- public ITenantDatabaseProvider Create()
- {
- return new DemoTenantDatabaseProvider(CurrentTenant.Value);
- }
+using Thinktecture.EntityFrameworkCore.Query;
+
+namespace Thinktecture;
+
+public class DemoTenantDatabaseProviderFactory : ITenantDatabaseProviderFactory
+{
+ ///
+ public ITenantDatabaseProvider Create()
+ {
+ return new DemoTenantDatabaseProvider(CurrentTenant.Value);
+ }
}
\ No newline at end of file
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Extensions/DemoDbContextExtensions.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Extensions/DemoDbContextExtensions.cs
index 663c0fb3..cdfe08b1 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Extensions/DemoDbContextExtensions.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Extensions/DemoDbContextExtensions.cs
@@ -1,62 +1,62 @@
-using Thinktecture.Database;
-
-// ReSharper disable once CheckNamespace
-namespace Thinktecture;
-
-public static class DemoDbContextExtensions
-{
- public static async Task EnsureCustomerAsync(this DemoDbContext ctx, Guid id)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Customers.AnyAsync(c => c.Id == id))
- {
- ctx.Customers.Add(new Customer(id, $"First name of '{id}'", $"Last name of '{id}'"));
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureProductAsync(this DemoDbContext ctx, Guid id)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Products.AnyAsync(c => c.Id == id))
- {
- ctx.Products.Add(new Product { Id = id });
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureOrderAsync(this DemoDbContext ctx, Guid id, Guid customerId)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Orders.AnyAsync(c => c.Id == id))
- {
- ctx.Orders.Add(new Order { Id = id, CustomerId = customerId });
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureOrderItemAsync(this DemoDbContext ctx, Guid orderId, Guid productId, int count)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- var orderItem = await ctx.OrderItems.FirstOrDefaultAsync(c => c.OrderId == orderId && c.ProductId == productId);
-
- if (orderItem == null)
- {
- orderItem = new OrderItem { OrderId = orderId, ProductId = productId };
- ctx.OrderItems.Add(orderItem);
- }
-
- orderItem.Count = count;
- await ctx.SaveChangesAsync();
- }
-}
+using Thinktecture.Database;
+
+// ReSharper disable once CheckNamespace
+namespace Thinktecture;
+
+public static class DemoDbContextExtensions
+{
+ public static async Task EnsureCustomerAsync(this DemoDbContext ctx, Guid id)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Customers.AnyAsync(c => c.Id == id))
+ {
+ ctx.Customers.Add(new Customer(id, $"First name of '{id}'", $"Last name of '{id}'"));
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureProductAsync(this DemoDbContext ctx, Guid id)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Products.AnyAsync(c => c.Id == id))
+ {
+ ctx.Products.Add(new Product { Id = id });
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureOrderAsync(this DemoDbContext ctx, Guid id, Guid customerId)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Orders.AnyAsync(c => c.Id == id))
+ {
+ ctx.Orders.Add(new Order { Id = id, CustomerId = customerId });
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureOrderItemAsync(this DemoDbContext ctx, Guid orderId, Guid productId, int count)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ var orderItem = await ctx.OrderItems.FirstOrDefaultAsync(c => c.OrderId == orderId && c.ProductId == productId);
+
+ if (orderItem == null)
+ {
+ orderItem = new OrderItem { OrderId = orderId, ProductId = productId };
+ ctx.OrderItems.Add(orderItem);
+ }
+
+ orderItem.Count = count;
+ await ctx.SaveChangesAsync();
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.Designer.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.Designer.cs
index 1643842f..be8b7d88 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.Designer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.Designer.cs
@@ -1,101 +1,101 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.Database;
-
-namespace Thinktecture.Migrations
-{
- [DbContext(typeof(DemoDbContext))]
- [Migration("20190509195617_Initial_Migration")]
- partial class Initial_Migration
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("Thinktecture.Database.Customer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("RowVersion")
- .IsConcurrencyToken()
- .IsRequired()
- .ValueGeneratedOnAddOrUpdate();
-
- b.HasKey("Id");
-
- b.ToTable("Customers");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("CustomerId");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.Property("OrderId");
-
- b.Property("ProductId");
-
- b.Property("Count");
-
- b.HasKey("OrderId", "ProductId");
-
- b.HasIndex("ProductId");
-
- b.ToTable("OrderItems");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.HasKey("Id");
-
- b.ToTable("Products");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.HasOne("Thinktecture.Database.Customer", "Customer")
- .WithMany("Orders")
- .HasForeignKey("CustomerId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.HasOne("Thinktecture.Database.Order", "Order")
- .WithMany("OrderItems")
- .HasForeignKey("OrderId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("Thinktecture.Database.Product", "Product")
- .WithMany("OrderItems")
- .HasForeignKey("ProductId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.Database;
+
+namespace Thinktecture.Migrations
+{
+ [DbContext(typeof(DemoDbContext))]
+ [Migration("20190509195617_Initial_Migration")]
+ partial class Initial_Migration
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Thinktecture.Database.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("RowVersion")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .ValueGeneratedOnAddOrUpdate();
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CustomerId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.Property("OrderId");
+
+ b.Property("ProductId");
+
+ b.Property("Count");
+
+ b.HasKey("OrderId", "ProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("OrderItems");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.HasOne("Thinktecture.Database.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.HasOne("Thinktecture.Database.Order", "Order")
+ .WithMany("OrderItems")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("Thinktecture.Database.Product", "Product")
+ .WithMany("OrderItems")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.cs
index cdadcffa..0791c403 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190509195617_Initial_Migration.cs
@@ -1,81 +1,81 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Thinktecture.Migrations
-{
- // ReSharper disable once InconsistentNaming
- // ReSharper disable once UnusedMember.Global
- public partial class Initial_Migration : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable("Customers",
- table => new
- {
- Id = table.Column(),
- RowVersion = table.Column(rowVersion: true)
- },
- constraints: table => table.PrimaryKey("PK_Customers", x => x.Id));
-
- migrationBuilder.CreateTable("Products",
- table => new
- {
- Id = table.Column()
- },
- constraints: table => table.PrimaryKey("PK_Products", x => x.Id));
-
- migrationBuilder.CreateTable("Orders",
- table => new
- {
- Id = table.Column(),
- CustomerId = table.Column()
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Orders", x => x.Id);
- table.ForeignKey(
- "FK_Orders_Customers_CustomerId",
- x => x.CustomerId,
- "Customers",
- "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable("OrderItems",
- table => new
- {
- OrderId = table.Column(),
- ProductId = table.Column(),
- Count = table.Column()
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OrderItems", x => new { x.OrderId, x.ProductId });
- table.ForeignKey(
- "FK_OrderItems_Orders_OrderId",
- x => x.OrderId,
- "Orders",
- "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- "FK_OrderItems_Products_ProductId",
- x => x.ProductId,
- "Products",
- "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex("IX_OrderItems_ProductId", "OrderItems", "ProductId")
- .IncludeColumns("OrderId", "Count");
- migrationBuilder.CreateIndex("IX_OrderItems_ProductId", "OrderItems", "ProductId").IfNotExists();
- migrationBuilder.CreateIndex("IX_Orders_CustomerId", "Orders", "CustomerId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable("OrderItems");
- migrationBuilder.DropTable("Orders");
- migrationBuilder.DropTable("Products");
- migrationBuilder.DropTable("Customers");
- }
- }
-}
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Thinktecture.Migrations
+{
+ // ReSharper disable once InconsistentNaming
+ // ReSharper disable once UnusedMember.Global
+ public partial class Initial_Migration : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable("Customers",
+ table => new
+ {
+ Id = table.Column(),
+ RowVersion = table.Column(rowVersion: true)
+ },
+ constraints: table => table.PrimaryKey("PK_Customers", x => x.Id));
+
+ migrationBuilder.CreateTable("Products",
+ table => new
+ {
+ Id = table.Column()
+ },
+ constraints: table => table.PrimaryKey("PK_Products", x => x.Id));
+
+ migrationBuilder.CreateTable("Orders",
+ table => new
+ {
+ Id = table.Column(),
+ CustomerId = table.Column()
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Orders", x => x.Id);
+ table.ForeignKey(
+ "FK_Orders_Customers_CustomerId",
+ x => x.CustomerId,
+ "Customers",
+ "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable("OrderItems",
+ table => new
+ {
+ OrderId = table.Column(),
+ ProductId = table.Column(),
+ Count = table.Column()
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_OrderItems", x => new { x.OrderId, x.ProductId });
+ table.ForeignKey(
+ "FK_OrderItems_Orders_OrderId",
+ x => x.OrderId,
+ "Orders",
+ "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ "FK_OrderItems_Products_ProductId",
+ x => x.ProductId,
+ "Products",
+ "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex("IX_OrderItems_ProductId", "OrderItems", "ProductId")
+ .IncludeColumns("OrderId", "Count");
+ migrationBuilder.CreateIndex("IX_OrderItems_ProductId", "OrderItems", "ProductId").IfNotExists();
+ migrationBuilder.CreateIndex("IX_Orders_CustomerId", "Orders", "CustomerId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable("OrderItems");
+ migrationBuilder.DropTable("Orders");
+ migrationBuilder.DropTable("Products");
+ migrationBuilder.DropTable("Customers");
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.Designer.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.Designer.cs
index 2a4bbc2e..99535dec 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.Designer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.Designer.cs
@@ -1,105 +1,105 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.Database;
-
-namespace Thinktecture.Migrations
-{
- [DbContext(typeof(DemoDbContext))]
- [Migration("20190806183132_Added_Date_and_Text")]
- partial class Added_Date_and_Text
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("Thinktecture.Database.Customer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("RowVersion")
- .IsConcurrencyToken()
- .IsRequired()
- .ValueGeneratedOnAddOrUpdate();
-
- b.HasKey("Id");
-
- b.ToTable("Customers");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.Property("CustomerId");
-
- b.Property("Date");
-
- b.Property("Text");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.Property("OrderId");
-
- b.Property("ProductId");
-
- b.Property("Count");
-
- b.HasKey("OrderId", "ProductId");
-
- b.HasIndex("ProductId");
-
- b.ToTable("OrderItems");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd();
-
- b.HasKey("Id");
-
- b.ToTable("Products");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.HasOne("Thinktecture.Database.Customer", "Customer")
- .WithMany("Orders")
- .HasForeignKey("CustomerId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.HasOne("Thinktecture.Database.Order", "Order")
- .WithMany("OrderItems")
- .HasForeignKey("OrderId")
- .OnDelete(DeleteBehavior.Cascade);
-
- b.HasOne("Thinktecture.Database.Product", "Product")
- .WithMany("OrderItems")
- .HasForeignKey("ProductId")
- .OnDelete(DeleteBehavior.Cascade);
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.Database;
+
+namespace Thinktecture.Migrations
+{
+ [DbContext(typeof(DemoDbContext))]
+ [Migration("20190806183132_Added_Date_and_Text")]
+ partial class Added_Date_and_Text
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Thinktecture.Database.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("RowVersion")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .ValueGeneratedOnAddOrUpdate();
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CustomerId");
+
+ b.Property("Date");
+
+ b.Property("Text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.Property("OrderId");
+
+ b.Property("ProductId");
+
+ b.Property("Count");
+
+ b.HasKey("OrderId", "ProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("OrderItems");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.HasOne("Thinktecture.Database.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.HasOne("Thinktecture.Database.Order", "Order")
+ .WithMany("OrderItems")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ b.HasOne("Thinktecture.Database.Product", "Product")
+ .WithMany("OrderItems")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade);
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.cs
index b0391e83..92a2cab8 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20190806183132_Added_Date_and_Text.cs
@@ -1,20 +1,20 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Thinktecture.Migrations
-{
- // ReSharper disable once InconsistentNaming
- public partial class Added_Date_and_Text : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn("Date", "Orders", nullable: false, defaultValue: DateTime.Now);
- migrationBuilder.AddColumn("Text", "Orders", nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn("Date", "Orders");
- migrationBuilder.DropColumn("Text", "Orders");
- }
- }
-}
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Thinktecture.Migrations
+{
+ // ReSharper disable once InconsistentNaming
+ public partial class Added_Date_and_Text : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn("Date", "Orders", nullable: false, defaultValue: DateTime.Now);
+ migrationBuilder.AddColumn("Text", "Orders", nullable: true);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn("Date", "Orders");
+ migrationBuilder.DropColumn("Text", "Orders");
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.Designer.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.Designer.cs
index e16e9caf..b0b23dc0 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.Designer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.Designer.cs
@@ -1,128 +1,128 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.Database;
-
-namespace Thinktecture.Migrations
-{
- [DbContext(typeof(DemoDbContext))]
- [Migration("20200303150837_FirstAndLastName")]
- partial class FirstAndLastName
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "3.1.1")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("Thinktecture.Database.Customer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.Property("FirstName")
- .IsRequired()
- .HasColumnType("nvarchar(100)")
- .HasMaxLength(100);
-
- b.Property("LastName")
- .IsRequired()
- .HasColumnType("nvarchar(100)")
- .HasMaxLength(100);
-
- b.Property("RowVersion")
- .IsConcurrencyToken()
- .IsRequired()
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("rowversion");
-
- b.HasKey("Id");
-
- b.ToTable("Customers");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.Property("CustomerId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("Date")
- .HasColumnType("datetime2");
-
- b.Property("Text")
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.Property("OrderId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("ProductId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.HasKey("OrderId", "ProductId");
-
- b.HasIndex("ProductId");
-
- b.ToTable("OrderItems");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.HasKey("Id");
-
- b.ToTable("Products");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.HasOne("Thinktecture.Database.Customer", "Customer")
- .WithMany("Orders")
- .HasForeignKey("CustomerId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.HasOne("Thinktecture.Database.Order", "Order")
- .WithMany("OrderItems")
- .HasForeignKey("OrderId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Thinktecture.Database.Product", "Product")
- .WithMany("OrderItems")
- .HasForeignKey("ProductId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.Database;
+
+namespace Thinktecture.Migrations
+{
+ [DbContext(typeof(DemoDbContext))]
+ [Migration("20200303150837_FirstAndLastName")]
+ partial class FirstAndLastName
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.1.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Thinktecture.Database.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("nvarchar(100)")
+ .HasMaxLength(100);
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("nvarchar(100)")
+ .HasMaxLength(100);
+
+ b.Property("RowVersion")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .ValueGeneratedOnAddOrUpdate()
+ .HasColumnType("rowversion");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CustomerId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Text")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.Property("OrderId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.HasKey("OrderId", "ProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("OrderItems");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.HasOne("Thinktecture.Database.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.HasOne("Thinktecture.Database.Order", "Order")
+ .WithMany("OrderItems")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Thinktecture.Database.Product", "Product")
+ .WithMany("OrderItems")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.cs
index 54bebea5..11f13950 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/20200303150837_FirstAndLastName.cs
@@ -1,19 +1,19 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Thinktecture.Migrations
-{
- public partial class FirstAndLastName : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn("FirstName", "Customers", maxLength: 100, nullable: false, defaultValue: "First");
- migrationBuilder.AddColumn("LastName", "Customers", maxLength: 100, nullable: false, defaultValue: "Last");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn("FirstName", "Customers");
- migrationBuilder.DropColumn("LastName", "Customers");
- }
- }
-}
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Thinktecture.Migrations
+{
+ public partial class FirstAndLastName : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn("FirstName", "Customers", maxLength: 100, nullable: false, defaultValue: "First");
+ migrationBuilder.AddColumn("LastName", "Customers", maxLength: 100, nullable: false, defaultValue: "Last");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn("FirstName", "Customers");
+ migrationBuilder.DropColumn("LastName", "Customers");
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/DemoDbContextModelSnapshot.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/DemoDbContextModelSnapshot.cs
index b8ff6a2c..83ee6c5a 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/DemoDbContextModelSnapshot.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Migrations/DemoDbContextModelSnapshot.cs
@@ -1,126 +1,126 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.Database;
-
-namespace Thinktecture.Migrations
-{
- [DbContext(typeof(DemoDbContext))]
- partial class DemoDbContextModelSnapshot : ModelSnapshot
- {
- protected override void BuildModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "3.1.1")
- .HasAnnotation("Relational:MaxIdentifierLength", 128)
- .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
-
- modelBuilder.Entity("Thinktecture.Database.Customer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.Property("FirstName")
- .IsRequired()
- .HasColumnType("nvarchar(100)")
- .HasMaxLength(100);
-
- b.Property("LastName")
- .IsRequired()
- .HasColumnType("nvarchar(100)")
- .HasMaxLength(100);
-
- b.Property("RowVersion")
- .IsConcurrencyToken()
- .IsRequired()
- .ValueGeneratedOnAddOrUpdate()
- .HasColumnType("rowversion");
-
- b.HasKey("Id");
-
- b.ToTable("Customers");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.Property("CustomerId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("Date")
- .HasColumnType("datetime2");
-
- b.Property("Text")
- .HasColumnType("nvarchar(max)");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.Property("OrderId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("ProductId")
- .HasColumnType("uniqueidentifier");
-
- b.Property("Count")
- .HasColumnType("int");
-
- b.HasKey("OrderId", "ProductId");
-
- b.HasIndex("ProductId");
-
- b.ToTable("OrderItems");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("uniqueidentifier");
-
- b.HasKey("Id");
-
- b.ToTable("Products");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.HasOne("Thinktecture.Database.Customer", "Customer")
- .WithMany("Orders")
- .HasForeignKey("CustomerId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.HasOne("Thinktecture.Database.Order", "Order")
- .WithMany("OrderItems")
- .HasForeignKey("OrderId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Thinktecture.Database.Product", "Product")
- .WithMany("OrderItems")
- .HasForeignKey("ProductId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.Database;
+
+namespace Thinktecture.Migrations
+{
+ [DbContext(typeof(DemoDbContext))]
+ partial class DemoDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.1.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Thinktecture.Database.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("nvarchar(100)")
+ .HasMaxLength(100);
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("nvarchar(100)")
+ .HasMaxLength(100);
+
+ b.Property("RowVersion")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .ValueGeneratedOnAddOrUpdate()
+ .HasColumnType("rowversion");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("CustomerId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Text")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.Property("OrderId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("ProductId")
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.HasKey("OrderId", "ProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("OrderItems");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.HasOne("Thinktecture.Database.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.HasOne("Thinktecture.Database.Order", "Order")
+ .WithMany("OrderItems")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Thinktecture.Database.Product", "Product")
+ .WithMany("OrderItems")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Program.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Program.cs
index c2424739..0644e27b 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Program.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Program.cs
@@ -1,284 +1,284 @@
-using Microsoft.Extensions.DependencyInjection;
-using Thinktecture.Database;
-
-namespace Thinktecture;
-
-// ReSharper disable once ClassNeverInstantiated.Global
-public class Program
-{
- // ReSharper disable once InconsistentNaming
- public static async Task Main(string[] args)
- {
- var sp = SamplesContext.Instance.CreateServiceProvider("demo");
-
- using (var scope = sp.CreateScope())
- {
- var ctx = scope.ServiceProvider.GetRequiredService();
- await ctx.Database.MigrateAsync();
-
- await FetchRowVersionsAsync(ctx);
-
- var customerId = await ctx.EnsureCustomerAsync(new Guid("11D67C68-6F1A-407B-9BD3-56C84FE15BB1"));
- var productId = await ctx.EnsureProductAsync(new Guid("872BCAC2-1A85-4B22-AC0F-7D920563A000"));
- var orderId = await ctx.EnsureOrderAsync(new Guid("EC1CBF87-F53F-4EF4-B286-8F5EB0AE810D"), customerId);
- await ctx.EnsureOrderItemAsync(orderId, productId, 42);
- ctx.ChangeTracker.Clear(); // resetting DbContext, as an alternative to create a new one
-
- // Bulk insert into "real" tables
- await DoBulkInsertAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- await DoBulkInsertSpecificColumnsAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- // Bulk update
- await DoBulkUpdateAsync(ctx, customerId);
- ctx.ChangeTracker.Clear();
-
- // Bulk insert or update
- await DoBulkInsertOrUpdateAsync(ctx, customerId);
- ctx.ChangeTracker.Clear();
-
- // Bulk insert into temp tables
- await DoBulkInsertIntoTempTableAsync(ctx, new List { customerId });
- ctx.ChangeTracker.Clear();
-
- await DoBulkInsertIntoTempTableAsync(ctx, new List<(Guid, Guid)> { (customerId, productId) });
- ctx.ChangeTracker.Clear();
-
- await DoBulkInsertIntoTempTableAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- // Collection parameter
- await DoScalarCollectionParameterAsync(ctx, new List { customerId });
- ctx.ChangeTracker.Clear();
-
- await DoComplexCollectionParameterAsync(ctx, customerId);
- ctx.ChangeTracker.Clear();
-
- // LEFT JOIN
- await DoLeftJoinAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- // ROWNUMBER
- await DoRowNumberAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- // Tenant
- await DoTenantQueriesAsync(ctx);
- ctx.ChangeTracker.Clear();
-
- // Nested transactions
- await DoNestedTransactionsAsync(ctx, orderId);
- ctx.ChangeTracker.Clear();
- }
-
- Console.WriteLine("Exiting samples...");
- }
-
- private static async Task DoScalarCollectionParameterAsync(DemoDbContext ctx, List customerIds)
- {
- var customerIdsQuery = ctx.CreateScalarCollectionParameter(customerIds);
-
- var customers = await ctx.Customers.Where(c => customerIdsQuery.Contains(c.Id)).ToListAsync();
-
- Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Id))}");
- }
-
- private static async Task DoComplexCollectionParameterAsync(DemoDbContext ctx, Guid customerId)
- {
- var parameters = ctx.CreateComplexCollectionParameter(new[] { new MyParameter(customerId, 42) });
-
- var customers = await ctx.Customers.Join(parameters, c => c.Id, t => t.Column1, (c, t) => new { Customer = c, Number = t.Column2 }).ToListAsync();
-
- Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Customer.Id))}");
- }
-
- private static async Task DoTenantQueriesAsync(DemoDbContext ctx)
- {
- await ctx.Customers
- .Include(c => c.Orders)
- .ToListAsync();
-
- try
- {
- // requires a database with the name "demo"
- CurrentTenant.Value = "1";
-
- await ctx.Customers
- .Include(c => c.Orders)
- .ToListAsync();
-
- // requires a database with the name "demo2"
- CurrentTenant.Value = "2";
-
- await ctx.Customers
- .Include(c => c.Orders)
- .ToListAsync();
- }
- catch
- {
- Console.WriteLine("For this demo we need 2 databases: demo and demo2");
- }
- finally
- {
- CurrentTenant.Value = null;
- }
- }
-
- private static async Task DoNestedTransactionsAsync(DemoDbContext ctx, Guid orderId)
- {
- await using var tx = await ctx.Database.BeginTransactionAsync();
-
- await using var innerTx = await ctx.Database.BeginTransactionAsync();
-
- var order = await ctx.Orders.FirstAsync(c => c.Id == orderId);
- order.Text = $"Changed ({DateTime.Now})";
-
- await ctx.SaveChangesAsync();
-
- await innerTx.CommitAsync();
-
- await tx.CommitAsync();
- }
-
- private static async Task FetchRowVersionsAsync(DemoDbContext ctx)
- {
- var minActiveRowVersion = await ctx.GetMinActiveRowVersionAsync();
- Console.WriteLine($"Min active row version: {minActiveRowVersion}");
-
- var lastUsedRowVersion = await ctx.GetLastUsedRowVersionAsync();
- Console.WriteLine($"Last used row version: {lastUsedRowVersion}");
- }
-
- private static async Task DoRowNumberAsync(DemoDbContext ctx)
- {
- var customers = await ctx.Customers
- .Select(c => new
- {
- c.Id,
- FirstName_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName)),
- LastName_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.LastName)),
- FirstAndLastName1_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName + " " + c.LastName)),
- FirstAndLastName2_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName).ThenBy(c.LastName))
- })
- .AsSubQuery()
- .OrderBy(c => c.FirstName_RowNumber)
- .ThenBy(c => c.LastName_RowNumber)
- .ToListAsync();
-
- Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => $"{{ CustomerId={c.Id}, FirstName_RowNumber={c.FirstName_RowNumber}, LastName_RowNumber={c.LastName_RowNumber}, FirstAndLastName1_RowNumber={c.FirstAndLastName1_RowNumber}, FirstAndLastName2_RowNumber={c.FirstAndLastName2_RowNumber} }}"))}");
-
- var latestOrders = await ctx.Orders
- .Select(o => new
- {
- o.Id,
- o.CustomerId,
- RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(o.Date))
- })
- // Previous query must be a sub query to access "RowNumber"
- .AsSubQuery()
- .Where(i => i.RowNumber == 1)
- .ToListAsync();
- Console.WriteLine($"Latest orders: {String.Join(", ", latestOrders.Select(o => $"{{ CustomerId={o.CustomerId}, OrderId={o.Id} }}"))}");
- }
-
- private static async Task DoLeftJoinAsync(DemoDbContext ctx)
- {
- var customerOrder = await ctx.Customers
- .LeftJoin(ctx.Orders,
- c => c.Id,
- o => o.CustomerId,
- result => new { Customer = result.Left, Order = result.Right })
- .ToListAsync();
-
- Console.WriteLine($"Found customers: {String.Join(", ", customerOrder.Select(co => $"{{ CustomerId={co.Customer.Id}, OrderId={co.Order?.Id} }}"))}");
- }
-
- private static async Task DoBulkInsertAsync(DemoDbContext ctx)
- {
- var id = Guid.NewGuid();
- var customersToInsert = new Customer(id, $"First name of '{id}'", $"Last name of '{id}'");
- await ctx.BulkInsertAsync(new[] { customersToInsert });
-
- var insertedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customersToInsert.Id);
-
- Console.WriteLine($"Inserted customers: {insertedCustomer.Id}");
- }
-
- private static async Task DoBulkInsertSpecificColumnsAsync(DemoDbContext ctx)
- {
- var customersToInsert = new Customer(Guid.NewGuid(), "First name", "Last name");
-
- // only "Id" is sent to the DB
- // alternative ways to specify the column:
- // * c => new { c.Id }
- // * c => c.Id
- // * new SqlServerBulkInsertOptions { PropertiesToInsert = IPropertiesProvider.Include(c => new { c.Id })}
- await ctx.BulkInsertAsync(new[] { customersToInsert }, c => new { c.Id });
-
- var insertedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customersToInsert.Id);
-
- Console.WriteLine($"Inserted customers: {insertedCustomer.Id}");
- }
-
- private static async Task DoBulkInsertOrUpdateAsync(DemoDbContext ctx, Guid customerId)
- {
- var customer = new Customer(customerId, "First name - DoBulkInsertOrUpdateAsync", "Last name will not be updated");
- var newCustomer = new Customer(Guid.NewGuid(), "First name - DoBulkInsertOrUpdateAsync", "Last name - DoBulkInsertOrUpdateAsync");
-
- await ctx.BulkInsertOrUpdateAsync(new[] { newCustomer, customer }, propertiesToUpdate: c => c.FirstName);
-
- var customers = await ctx.Customers.Where(c => c.Id == customerId || c.Id == newCustomer.Id).ToListAsync();
-
- Console.WriteLine($"Updated customer: {customers.Single(c => c.Id == customerId)}");
- Console.WriteLine($"New customer: {customers.Single(c => c.Id == newCustomer.Id)}");
- }
-
- private static async Task DoBulkUpdateAsync(DemoDbContext ctx, Guid customerId)
- {
- var customer = new Customer(customerId, "First name - DoBulkUpdateAsync", "Last name will not be updated");
-
- await ctx.BulkUpdateAsync(new[] { customer }, c => c.FirstName);
-
- var updatedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customerId);
-
- Console.WriteLine($"Updated customer: {updatedCustomer}");
- }
-
- private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx, List customerIds)
- {
- await using var tempTableQuery = await ctx.BulkInsertValuesIntoTempTableAsync(customerIds);
-
- var customers = await ctx.Customers.Join(tempTableQuery.Query, c => c.Id, t => t, (c, t) => c).ToListAsync();
- Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Id))}");
- }
-
- private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx, List<(Guid customerId, Guid productId)> tuples)
- {
- await using var tempTableQuery = await ctx.BulkInsertValuesIntoTempTableAsync(tuples);
-
- var orderItems = await ctx.OrderItems.Join(tempTableQuery.Query,
- i => new { i.Order.CustomerId, i.ProductId },
- t => new { CustomerId = t.Column1, ProductId = t.Column2 },
- (i, t) => i)
- .ToListAsync();
-
- Console.WriteLine($"Found order items: {String.Join(", ", orderItems.Select(i => $"{{ OrderId={i.OrderId}, ProductId={i.ProductId}, Count={i.Count} }}"))}");
- }
-
- private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx)
- {
- var id = Guid.NewGuid();
- var customersToInsert = new[]
- {
- new Customer(id, $"First name of '{id}'", $"Last name of '{id}'")
- };
-
- await using var tempTableQuery = await ctx.BulkInsertIntoTempTableAsync(customersToInsert);
-
- var tempCustomers = await tempTableQuery.Query.ToListAsync();
-
- Console.WriteLine($"Customers in temp table: {String.Join(", ", tempCustomers.Select(c => c.Id))}");
- }
-}
+using Microsoft.Extensions.DependencyInjection;
+using Thinktecture.Database;
+
+namespace Thinktecture;
+
+// ReSharper disable once ClassNeverInstantiated.Global
+public class Program
+{
+ // ReSharper disable once InconsistentNaming
+ public static async Task Main(string[] args)
+ {
+ var sp = SamplesContext.Instance.CreateServiceProvider("demo");
+
+ using (var scope = sp.CreateScope())
+ {
+ var ctx = scope.ServiceProvider.GetRequiredService();
+ await ctx.Database.MigrateAsync();
+
+ await FetchRowVersionsAsync(ctx);
+
+ var customerId = await ctx.EnsureCustomerAsync(new Guid("11D67C68-6F1A-407B-9BD3-56C84FE15BB1"));
+ var productId = await ctx.EnsureProductAsync(new Guid("872BCAC2-1A85-4B22-AC0F-7D920563A000"));
+ var orderId = await ctx.EnsureOrderAsync(new Guid("EC1CBF87-F53F-4EF4-B286-8F5EB0AE810D"), customerId);
+ await ctx.EnsureOrderItemAsync(orderId, productId, 42);
+ ctx.ChangeTracker.Clear(); // resetting DbContext, as an alternative to create a new one
+
+ // Bulk insert into "real" tables
+ await DoBulkInsertAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ await DoBulkInsertSpecificColumnsAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ // Bulk update
+ await DoBulkUpdateAsync(ctx, customerId);
+ ctx.ChangeTracker.Clear();
+
+ // Bulk insert or update
+ await DoBulkInsertOrUpdateAsync(ctx, customerId);
+ ctx.ChangeTracker.Clear();
+
+ // Bulk insert into temp tables
+ await DoBulkInsertIntoTempTableAsync(ctx, new List { customerId });
+ ctx.ChangeTracker.Clear();
+
+ await DoBulkInsertIntoTempTableAsync(ctx, new List<(Guid, Guid)> { (customerId, productId) });
+ ctx.ChangeTracker.Clear();
+
+ await DoBulkInsertIntoTempTableAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ // Collection parameter
+ await DoScalarCollectionParameterAsync(ctx, new List { customerId });
+ ctx.ChangeTracker.Clear();
+
+ await DoComplexCollectionParameterAsync(ctx, customerId);
+ ctx.ChangeTracker.Clear();
+
+ // LEFT JOIN
+ await DoLeftJoinAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ // ROWNUMBER
+ await DoRowNumberAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ // Tenant
+ await DoTenantQueriesAsync(ctx);
+ ctx.ChangeTracker.Clear();
+
+ // Nested transactions
+ await DoNestedTransactionsAsync(ctx, orderId);
+ ctx.ChangeTracker.Clear();
+ }
+
+ Console.WriteLine("Exiting samples...");
+ }
+
+ private static async Task DoScalarCollectionParameterAsync(DemoDbContext ctx, List customerIds)
+ {
+ var customerIdsQuery = ctx.CreateScalarCollectionParameter(customerIds);
+
+ var customers = await ctx.Customers.Where(c => customerIdsQuery.Contains(c.Id)).ToListAsync();
+
+ Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Id))}");
+ }
+
+ private static async Task DoComplexCollectionParameterAsync(DemoDbContext ctx, Guid customerId)
+ {
+ var parameters = ctx.CreateComplexCollectionParameter(new[] { new MyParameter(customerId, 42) });
+
+ var customers = await ctx.Customers.Join(parameters, c => c.Id, t => t.Column1, (c, t) => new { Customer = c, Number = t.Column2 }).ToListAsync();
+
+ Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Customer.Id))}");
+ }
+
+ private static async Task DoTenantQueriesAsync(DemoDbContext ctx)
+ {
+ await ctx.Customers
+ .Include(c => c.Orders)
+ .ToListAsync();
+
+ try
+ {
+ // requires a database with the name "demo"
+ CurrentTenant.Value = "1";
+
+ await ctx.Customers
+ .Include(c => c.Orders)
+ .ToListAsync();
+
+ // requires a database with the name "demo2"
+ CurrentTenant.Value = "2";
+
+ await ctx.Customers
+ .Include(c => c.Orders)
+ .ToListAsync();
+ }
+ catch
+ {
+ Console.WriteLine("For this demo we need 2 databases: demo and demo2");
+ }
+ finally
+ {
+ CurrentTenant.Value = null;
+ }
+ }
+
+ private static async Task DoNestedTransactionsAsync(DemoDbContext ctx, Guid orderId)
+ {
+ await using var tx = await ctx.Database.BeginTransactionAsync();
+
+ await using var innerTx = await ctx.Database.BeginTransactionAsync();
+
+ var order = await ctx.Orders.FirstAsync(c => c.Id == orderId);
+ order.Text = $"Changed ({DateTime.Now})";
+
+ await ctx.SaveChangesAsync();
+
+ await innerTx.CommitAsync();
+
+ await tx.CommitAsync();
+ }
+
+ private static async Task FetchRowVersionsAsync(DemoDbContext ctx)
+ {
+ var minActiveRowVersion = await ctx.GetMinActiveRowVersionAsync();
+ Console.WriteLine($"Min active row version: {minActiveRowVersion}");
+
+ var lastUsedRowVersion = await ctx.GetLastUsedRowVersionAsync();
+ Console.WriteLine($"Last used row version: {lastUsedRowVersion}");
+ }
+
+ private static async Task DoRowNumberAsync(DemoDbContext ctx)
+ {
+ var customers = await ctx.Customers
+ .Select(c => new
+ {
+ c.Id,
+ FirstName_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName)),
+ LastName_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.LastName)),
+ FirstAndLastName1_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName + " " + c.LastName)),
+ FirstAndLastName2_RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(c.FirstName).ThenBy(c.LastName))
+ })
+ .AsSubQuery()
+ .OrderBy(c => c.FirstName_RowNumber)
+ .ThenBy(c => c.LastName_RowNumber)
+ .ToListAsync();
+
+ Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => $"{{ CustomerId={c.Id}, FirstName_RowNumber={c.FirstName_RowNumber}, LastName_RowNumber={c.LastName_RowNumber}, FirstAndLastName1_RowNumber={c.FirstAndLastName1_RowNumber}, FirstAndLastName2_RowNumber={c.FirstAndLastName2_RowNumber} }}"))}");
+
+ var latestOrders = await ctx.Orders
+ .Select(o => new
+ {
+ o.Id,
+ o.CustomerId,
+ RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(o.Date))
+ })
+ // Previous query must be a sub query to access "RowNumber"
+ .AsSubQuery()
+ .Where(i => i.RowNumber == 1)
+ .ToListAsync();
+ Console.WriteLine($"Latest orders: {String.Join(", ", latestOrders.Select(o => $"{{ CustomerId={o.CustomerId}, OrderId={o.Id} }}"))}");
+ }
+
+ private static async Task DoLeftJoinAsync(DemoDbContext ctx)
+ {
+ var customerOrder = await ctx.Customers
+ .LeftJoin(ctx.Orders,
+ c => c.Id,
+ o => o.CustomerId,
+ result => new { Customer = result.Left, Order = result.Right })
+ .ToListAsync();
+
+ Console.WriteLine($"Found customers: {String.Join(", ", customerOrder.Select(co => $"{{ CustomerId={co.Customer.Id}, OrderId={co.Order?.Id} }}"))}");
+ }
+
+ private static async Task DoBulkInsertAsync(DemoDbContext ctx)
+ {
+ var id = Guid.NewGuid();
+ var customersToInsert = new Customer(id, $"First name of '{id}'", $"Last name of '{id}'");
+ await ctx.BulkInsertAsync(new[] { customersToInsert });
+
+ var insertedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customersToInsert.Id);
+
+ Console.WriteLine($"Inserted customers: {insertedCustomer.Id}");
+ }
+
+ private static async Task DoBulkInsertSpecificColumnsAsync(DemoDbContext ctx)
+ {
+ var customersToInsert = new Customer(Guid.NewGuid(), "First name", "Last name");
+
+ // only "Id" is sent to the DB
+ // alternative ways to specify the column:
+ // * c => new { c.Id }
+ // * c => c.Id
+ // * new SqlServerBulkInsertOptions { PropertiesToInsert = IPropertiesProvider.Include(c => new { c.Id })}
+ await ctx.BulkInsertAsync(new[] { customersToInsert }, c => new { c.Id });
+
+ var insertedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customersToInsert.Id);
+
+ Console.WriteLine($"Inserted customers: {insertedCustomer.Id}");
+ }
+
+ private static async Task DoBulkInsertOrUpdateAsync(DemoDbContext ctx, Guid customerId)
+ {
+ var customer = new Customer(customerId, "First name - DoBulkInsertOrUpdateAsync", "Last name will not be updated");
+ var newCustomer = new Customer(Guid.NewGuid(), "First name - DoBulkInsertOrUpdateAsync", "Last name - DoBulkInsertOrUpdateAsync");
+
+ await ctx.BulkInsertOrUpdateAsync(new[] { newCustomer, customer }, propertiesToUpdate: c => c.FirstName);
+
+ var customers = await ctx.Customers.Where(c => c.Id == customerId || c.Id == newCustomer.Id).ToListAsync();
+
+ Console.WriteLine($"Updated customer: {customers.Single(c => c.Id == customerId)}");
+ Console.WriteLine($"New customer: {customers.Single(c => c.Id == newCustomer.Id)}");
+ }
+
+ private static async Task DoBulkUpdateAsync(DemoDbContext ctx, Guid customerId)
+ {
+ var customer = new Customer(customerId, "First name - DoBulkUpdateAsync", "Last name will not be updated");
+
+ await ctx.BulkUpdateAsync(new[] { customer }, c => c.FirstName);
+
+ var updatedCustomer = await ctx.Customers.FirstAsync(c => c.Id == customerId);
+
+ Console.WriteLine($"Updated customer: {updatedCustomer}");
+ }
+
+ private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx, List customerIds)
+ {
+ await using var tempTableQuery = await ctx.BulkInsertValuesIntoTempTableAsync(customerIds);
+
+ var customers = await ctx.Customers.Join(tempTableQuery.Query, c => c.Id, t => t, (c, t) => c).ToListAsync();
+ Console.WriteLine($"Found customers: {String.Join(", ", customers.Select(c => c.Id))}");
+ }
+
+ private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx, List<(Guid customerId, Guid productId)> tuples)
+ {
+ await using var tempTableQuery = await ctx.BulkInsertValuesIntoTempTableAsync(tuples);
+
+ var orderItems = await ctx.OrderItems.Join(tempTableQuery.Query,
+ i => new { i.Order.CustomerId, i.ProductId },
+ t => new { CustomerId = t.Column1, ProductId = t.Column2 },
+ (i, t) => i)
+ .ToListAsync();
+
+ Console.WriteLine($"Found order items: {String.Join(", ", orderItems.Select(i => $"{{ OrderId={i.OrderId}, ProductId={i.ProductId}, Count={i.Count} }}"))}");
+ }
+
+ private static async Task DoBulkInsertIntoTempTableAsync(DemoDbContext ctx)
+ {
+ var id = Guid.NewGuid();
+ var customersToInsert = new[]
+ {
+ new Customer(id, $"First name of '{id}'", $"Last name of '{id}'")
+ };
+
+ await using var tempTableQuery = await ctx.BulkInsertIntoTempTableAsync(customersToInsert);
+
+ var tempCustomers = await tempTableQuery.Query.ToListAsync();
+
+ Console.WriteLine($"Customers in temp table: {String.Join(", ", tempCustomers.Select(c => c.Id))}");
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/SamplesContext.cs b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/SamplesContext.cs
index 79b7abc5..8fdccc20 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/SamplesContext.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/SamplesContext.cs
@@ -1,80 +1,80 @@
-using Microsoft.EntityFrameworkCore.Diagnostics;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Thinktecture.Database;
-using Thinktecture.EntityFrameworkCore;
-
-namespace Thinktecture;
-
-public class SamplesContext
-{
- private readonly ILoggerFactory _loggerFactory;
- private static readonly Lazy _lazy = new(CreateTestConfiguration);
-
- public static SamplesContext Instance => _lazy.Value;
-
- public IConfiguration Configuration { get; }
-
- public string ConnectionString => Configuration.GetConnectionString("default")
- ?? throw new Exception("No connection string with name 'default' found.");
-
- private static SamplesContext CreateTestConfiguration()
- {
- var config = GetConfiguration();
- var loggerFactory = new LoggerBuilder().AddConsole().Services.BuildServiceProvider().GetRequiredService();
-
- return new SamplesContext(config, loggerFactory);
- }
-
- public SamplesContext(IConfiguration config, ILoggerFactory loggerFactory)
- {
- _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
- Configuration = config ?? throw new ArgumentNullException(nameof(config));
- }
-
- private static IConfiguration GetConfiguration()
- {
- return new ConfigurationBuilder()
- .AddJsonFile("appsettings.json")
- .Build();
- }
-
- public IServiceProvider CreateServiceProvider(string? schema = null)
- {
- var services = new ServiceCollection()
- .AddDbContext(builder => builder
- .UseSqlServer(ConnectionString, sqlOptions =>
- {
- if (schema != null)
- sqlOptions.MigrationsHistoryTable("__EFMigrationsHistory", schema);
-
- sqlOptions.AddWindowFunctionsSupport()
- .AddTenantDatabaseSupport()
- .AddBulkOperationSupport()
- .AddCollectionParameterSupport()
- .UseThinktectureSqlServerMigrationsSqlGenerator();
- })
- .ConfigureWarnings(warningsBuilder => warningsBuilder.Ignore(RelationalEventId.PendingModelChangesWarning))
- .EnableSensitiveDataLogging()
- .UseLoggerFactory(_loggerFactory)
- .AddSchemaRespectingComponents()
- .AddNestedTransactionSupport());
-
- if (schema != null)
- services.AddSingleton(new DbDefaultSchema(schema));
-
- return services.BuildServiceProvider();
- }
-
- private class LoggerBuilder : ILoggingBuilder
- {
- public IServiceCollection Services { get; }
-
- public LoggerBuilder()
- {
- Services = new ServiceCollection()
- .AddLogging();
- }
- }
-}
+using Microsoft.EntityFrameworkCore.Diagnostics;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using Thinktecture.Database;
+using Thinktecture.EntityFrameworkCore;
+
+namespace Thinktecture;
+
+public class SamplesContext
+{
+ private readonly ILoggerFactory _loggerFactory;
+ private static readonly Lazy _lazy = new(CreateTestConfiguration);
+
+ public static SamplesContext Instance => _lazy.Value;
+
+ public IConfiguration Configuration { get; }
+
+ public string ConnectionString => Configuration.GetConnectionString("default")
+ ?? throw new Exception("No connection string with name 'default' found.");
+
+ private static SamplesContext CreateTestConfiguration()
+ {
+ var config = GetConfiguration();
+ var loggerFactory = new LoggerBuilder().AddConsole().Services.BuildServiceProvider().GetRequiredService();
+
+ return new SamplesContext(config, loggerFactory);
+ }
+
+ public SamplesContext(IConfiguration config, ILoggerFactory loggerFactory)
+ {
+ _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
+ Configuration = config ?? throw new ArgumentNullException(nameof(config));
+ }
+
+ private static IConfiguration GetConfiguration()
+ {
+ return new ConfigurationBuilder()
+ .AddJsonFile("appsettings.json")
+ .Build();
+ }
+
+ public IServiceProvider CreateServiceProvider(string? schema = null)
+ {
+ var services = new ServiceCollection()
+ .AddDbContext(builder => builder
+ .UseSqlServer(ConnectionString, sqlOptions =>
+ {
+ if (schema != null)
+ sqlOptions.MigrationsHistoryTable("__EFMigrationsHistory", schema);
+
+ sqlOptions.AddWindowFunctionsSupport()
+ .AddTenantDatabaseSupport()
+ .AddBulkOperationSupport()
+ .AddCollectionParameterSupport()
+ .UseThinktectureSqlServerMigrationsSqlGenerator();
+ })
+ .ConfigureWarnings(warningsBuilder => warningsBuilder.Ignore(RelationalEventId.PendingModelChangesWarning))
+ .EnableSensitiveDataLogging()
+ .UseLoggerFactory(_loggerFactory)
+ .AddSchemaRespectingComponents()
+ .AddNestedTransactionSupport());
+
+ if (schema != null)
+ services.AddSingleton(new DbDefaultSchema(schema));
+
+ return services.BuildServiceProvider();
+ }
+
+ private class LoggerBuilder : ILoggingBuilder
+ {
+ public IServiceCollection Services { get; }
+
+ public LoggerBuilder()
+ {
+ Services = new ServiceCollection()
+ .AddLogging();
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj
index f6f1575f..3ac7921a 100644
--- a/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj
+++ b/samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples/Thinktecture.EntityFrameworkCore.SqlServer.Samples.csproj
@@ -1,25 +1,25 @@
-
-
-
- Exe
- $(NoWarn);CS1591
- false
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Exe
+ $(NoWarn);CS1591
+ false
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Customer.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Customer.cs
index 258dfd09..3a6b41c6 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Customer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Customer.cs
@@ -1,35 +1,35 @@
-namespace Thinktecture.Database;
-
-public class Customer
-{
- public Guid Id { get; private set; }
- public string FirstName { get; private set; }
- public string LastName { get; private set; }
-
- private List? _orders;
-
- // ReSharper disable once UnusedMember.Global
- public List Orders
- {
- get => _orders ??= new List();
- set => _orders = value;
- }
-
-#nullable disable
- private Customer()
- {
- }
-#nullable enable
-
- public Customer(Guid id, string firstName, string lastName)
- {
- Id = id;
- FirstName = firstName;
- LastName = lastName;
- }
-
- public override string ToString()
- {
- return $"{{ CustomerId='{Id}', FirstName='{FirstName}', LastName='{LastName}' }}";
- }
-}
+namespace Thinktecture.Database;
+
+public class Customer
+{
+ public Guid Id { get; private set; }
+ public string FirstName { get; private set; }
+ public string LastName { get; private set; }
+
+ private List? _orders;
+
+ // ReSharper disable once UnusedMember.Global
+ public List Orders
+ {
+ get => _orders ??= new List();
+ set => _orders = value;
+ }
+
+#nullable disable
+ private Customer()
+ {
+ }
+#nullable enable
+
+ public Customer(Guid id, string firstName, string lastName)
+ {
+ Id = id;
+ FirstName = firstName;
+ LastName = lastName;
+ }
+
+ public override string ToString()
+ {
+ return $"{{ CustomerId='{Id}', FirstName='{FirstName}', LastName='{LastName}' }}";
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContext.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContext.cs
index d405f040..dd83ebff 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContext.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContext.cs
@@ -1,30 +1,30 @@
-namespace Thinktecture.Database;
-
-public class DemoDbContext : DbContext
-{
-#nullable disable
- public DbSet Customers { get; set; }
- public DbSet Products { get; set; }
- public DbSet Orders { get; set; }
- public DbSet OrderItems { get; set; }
-#nullable enable
-
- public DemoDbContext(DbContextOptions options)
- : base(options)
- {
- }
-
- ///
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- base.OnModelCreating(modelBuilder);
-
- modelBuilder.Entity(builder =>
- {
- builder.Property(c => c.FirstName).HasMaxLength(100);
- builder.Property(c => c.LastName).HasMaxLength(100);
- });
-
- modelBuilder.Entity().HasKey(i => new { i.OrderId, i.ProductId });
- }
-}
+namespace Thinktecture.Database;
+
+public class DemoDbContext : DbContext
+{
+#nullable disable
+ public DbSet Customers { get; set; }
+ public DbSet Products { get; set; }
+ public DbSet Orders { get; set; }
+ public DbSet OrderItems { get; set; }
+#nullable enable
+
+ public DemoDbContext(DbContextOptions options)
+ : base(options)
+ {
+ }
+
+ ///
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ modelBuilder.Entity(builder =>
+ {
+ builder.Property(c => c.FirstName).HasMaxLength(100);
+ builder.Property(c => c.LastName).HasMaxLength(100);
+ });
+
+ modelBuilder.Entity().HasKey(i => new { i.OrderId, i.ProductId });
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
index 0c96fc6d..f88607fe 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/DemoDbContextDesignTimeDbContextFactory.cs
@@ -1,16 +1,16 @@
-using Microsoft.EntityFrameworkCore.Design;
-
-namespace Thinktecture.Database;
-
-public class DemoDbContextDesignTimeDbContextFactory : IDesignTimeDbContextFactory
-{
- public DemoDbContext CreateDbContext(string[] args)
- {
- var options = new DbContextOptionsBuilder()
- .UseSqlite(SamplesContext.Instance.ConnectionString)
- .AddSchemaRespectingComponents()
- .Options;
-
- return new DemoDbContext(options);
- }
+using Microsoft.EntityFrameworkCore.Design;
+
+namespace Thinktecture.Database;
+
+public class DemoDbContextDesignTimeDbContextFactory : IDesignTimeDbContextFactory
+{
+ public DemoDbContext CreateDbContext(string[] args)
+ {
+ var options = new DbContextOptionsBuilder()
+ .UseSqlite(SamplesContext.Instance.ConnectionString)
+ .AddSchemaRespectingComponents()
+ .Options;
+
+ return new DemoDbContext(options);
+ }
}
\ No newline at end of file
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Order.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Order.cs
index 47d9d730..6f5f3ecd 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Order.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Order.cs
@@ -1,22 +1,22 @@
-namespace Thinktecture.Database;
-
-public class Order
-{
- public Guid Id { get; set; }
- public DateTime Date { get; set; }
- public string? Text { get; set; }
- public Guid CustomerId { get; set; }
-
-#nullable disable
- public Customer Customer { get; set; }
-#nullable enable
-
- private List? _orderItems;
-
- // ReSharper disable once UnusedMember.Global
- public List OrderItems
- {
- get => _orderItems ??= new List();
- set => _orderItems = value;
- }
-}
+namespace Thinktecture.Database;
+
+public class Order
+{
+ public Guid Id { get; set; }
+ public DateTime Date { get; set; }
+ public string? Text { get; set; }
+ public Guid CustomerId { get; set; }
+
+#nullable disable
+ public Customer Customer { get; set; }
+#nullable enable
+
+ private List? _orderItems;
+
+ // ReSharper disable once UnusedMember.Global
+ public List OrderItems
+ {
+ get => _orderItems ??= new List();
+ set => _orderItems = value;
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/OrderItem.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/OrderItem.cs
index a368d6b0..6d103bb4 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/OrderItem.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/OrderItem.cs
@@ -1,13 +1,13 @@
-namespace Thinktecture.Database;
-
-public class OrderItem
-{
- public Guid OrderId { get; set; }
- public Guid ProductId { get; set; }
- public int Count { get; set; }
-
-#nullable disable
- public Order Order { get; set; }
- public Product Product { get; set; }
-#nullable enable
-}
+namespace Thinktecture.Database;
+
+public class OrderItem
+{
+ public Guid OrderId { get; set; }
+ public Guid ProductId { get; set; }
+ public int Count { get; set; }
+
+#nullable disable
+ public Order Order { get; set; }
+ public Product Product { get; set; }
+#nullable enable
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Product.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Product.cs
index e496d9f8..f7a2ef82 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Product.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Database/Product.cs
@@ -1,15 +1,15 @@
-namespace Thinktecture.Database;
-
-public class Product
-{
- public Guid Id { get; set; }
-
- private List? _orderItems;
-
- // ReSharper disable once UnusedMember.Global
- public List OrderItems
- {
- get => _orderItems ??= new List();
- set => _orderItems = value;
- }
-}
+namespace Thinktecture.Database;
+
+public class Product
+{
+ public Guid Id { get; set; }
+
+ private List? _orderItems;
+
+ // ReSharper disable once UnusedMember.Global
+ public List OrderItems
+ {
+ get => _orderItems ??= new List();
+ set => _orderItems = value;
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Extensions/DemoDbContextExtensions.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Extensions/DemoDbContextExtensions.cs
index 663c0fb3..cdfe08b1 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Extensions/DemoDbContextExtensions.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Extensions/DemoDbContextExtensions.cs
@@ -1,62 +1,62 @@
-using Thinktecture.Database;
-
-// ReSharper disable once CheckNamespace
-namespace Thinktecture;
-
-public static class DemoDbContextExtensions
-{
- public static async Task EnsureCustomerAsync(this DemoDbContext ctx, Guid id)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Customers.AnyAsync(c => c.Id == id))
- {
- ctx.Customers.Add(new Customer(id, $"First name of '{id}'", $"Last name of '{id}'"));
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureProductAsync(this DemoDbContext ctx, Guid id)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Products.AnyAsync(c => c.Id == id))
- {
- ctx.Products.Add(new Product { Id = id });
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureOrderAsync(this DemoDbContext ctx, Guid id, Guid customerId)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- if (!await ctx.Orders.AnyAsync(c => c.Id == id))
- {
- ctx.Orders.Add(new Order { Id = id, CustomerId = customerId });
- await ctx.SaveChangesAsync();
- }
-
- return id;
- }
-
- public static async Task EnsureOrderItemAsync(this DemoDbContext ctx, Guid orderId, Guid productId, int count)
- {
- ArgumentNullException.ThrowIfNull(ctx);
-
- var orderItem = await ctx.OrderItems.FirstOrDefaultAsync(c => c.OrderId == orderId && c.ProductId == productId);
-
- if (orderItem == null)
- {
- orderItem = new OrderItem { OrderId = orderId, ProductId = productId };
- ctx.OrderItems.Add(orderItem);
- }
-
- orderItem.Count = count;
- await ctx.SaveChangesAsync();
- }
-}
+using Thinktecture.Database;
+
+// ReSharper disable once CheckNamespace
+namespace Thinktecture;
+
+public static class DemoDbContextExtensions
+{
+ public static async Task EnsureCustomerAsync(this DemoDbContext ctx, Guid id)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Customers.AnyAsync(c => c.Id == id))
+ {
+ ctx.Customers.Add(new Customer(id, $"First name of '{id}'", $"Last name of '{id}'"));
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureProductAsync(this DemoDbContext ctx, Guid id)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Products.AnyAsync(c => c.Id == id))
+ {
+ ctx.Products.Add(new Product { Id = id });
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureOrderAsync(this DemoDbContext ctx, Guid id, Guid customerId)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ if (!await ctx.Orders.AnyAsync(c => c.Id == id))
+ {
+ ctx.Orders.Add(new Order { Id = id, CustomerId = customerId });
+ await ctx.SaveChangesAsync();
+ }
+
+ return id;
+ }
+
+ public static async Task EnsureOrderItemAsync(this DemoDbContext ctx, Guid orderId, Guid productId, int count)
+ {
+ ArgumentNullException.ThrowIfNull(ctx);
+
+ var orderItem = await ctx.OrderItems.FirstOrDefaultAsync(c => c.OrderId == orderId && c.ProductId == productId);
+
+ if (orderItem == null)
+ {
+ orderItem = new OrderItem { OrderId = orderId, ProductId = productId };
+ ctx.OrderItems.Add(orderItem);
+ }
+
+ orderItem.Count = count;
+ await ctx.SaveChangesAsync();
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.Designer.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.Designer.cs
index e3470a49..8e423ce4 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.Designer.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.Designer.cs
@@ -1,119 +1,119 @@
-//
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Thinktecture.Database;
-
-namespace Thinktecture.Migrations
-{
- [DbContext(typeof(DemoDbContext))]
- [Migration("20200602165914_Initial_Migration")]
- partial class Initial_Migration
- {
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "3.1.3");
-
- modelBuilder.Entity("Thinktecture.Database.Customer", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("TEXT");
-
- b.Property("FirstName")
- .IsRequired()
- .HasColumnType("TEXT")
- .HasMaxLength(100);
-
- b.Property("LastName")
- .IsRequired()
- .HasColumnType("TEXT")
- .HasMaxLength(100);
-
- b.HasKey("Id");
-
- b.ToTable("Customers");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("TEXT");
-
- b.Property("CustomerId")
- .HasColumnType("TEXT");
-
- b.Property("Date")
- .HasColumnType("TEXT");
-
- b.Property("Text")
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.HasIndex("CustomerId");
-
- b.ToTable("Orders");
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.Property("OrderId")
- .HasColumnType("TEXT");
-
- b.Property("ProductId")
- .HasColumnType("TEXT");
-
- b.Property("Count")
- .HasColumnType("INTEGER");
-
- b.HasKey("OrderId", "ProductId");
-
- b.HasIndex("ProductId");
-
- b.ToTable("OrderItems");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Product", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("TEXT");
-
- b.HasKey("Id");
-
- b.ToTable("Products");
- });
-
- modelBuilder.Entity("Thinktecture.Database.Order", b =>
- {
- b.HasOne("Thinktecture.Database.Customer", "Customer")
- .WithMany("Orders")
- .HasForeignKey("CustomerId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-
- modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
- {
- b.HasOne("Thinktecture.Database.Order", "Order")
- .WithMany("OrderItems")
- .HasForeignKey("OrderId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("Thinktecture.Database.Product", "Product")
- .WithMany("OrderItems")
- .HasForeignKey("ProductId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
- });
-#pragma warning restore 612, 618
- }
- }
-}
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Thinktecture.Database;
+
+namespace Thinktecture.Migrations
+{
+ [DbContext(typeof(DemoDbContext))]
+ [Migration("20200602165914_Initial_Migration")]
+ partial class Initial_Migration
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.1.3");
+
+ modelBuilder.Entity("Thinktecture.Database.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("TEXT")
+ .HasMaxLength(100);
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("TEXT")
+ .HasMaxLength(100);
+
+ b.HasKey("Id");
+
+ b.ToTable("Customers");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.Property("CustomerId")
+ .HasColumnType("TEXT");
+
+ b.Property("Date")
+ .HasColumnType("TEXT");
+
+ b.Property("Text")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.Property("OrderId")
+ .HasColumnType("TEXT");
+
+ b.Property("ProductId")
+ .HasColumnType("TEXT");
+
+ b.Property("Count")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("OrderId", "ProductId");
+
+ b.HasIndex("ProductId");
+
+ b.ToTable("OrderItems");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.Order", b =>
+ {
+ b.HasOne("Thinktecture.Database.Customer", "Customer")
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Thinktecture.Database.OrderItem", b =>
+ {
+ b.HasOne("Thinktecture.Database.Order", "Order")
+ .WithMany("OrderItems")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Thinktecture.Database.Product", "Product")
+ .WithMany("OrderItems")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.cs b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.cs
index 5a6c89b6..b8f4de52 100644
--- a/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.cs
+++ b/samples/Thinktecture.EntityFrameworkCore.Sqlite.Samples/Migrations/20200602165914_Initial_Migration.cs
@@ -1,82 +1,82 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Thinktecture.Migrations
-{
- // ReSharper disable once InconsistentNaming
- // ReSharper disable once UnusedMember.Global
- public partial class Initial_Migration : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable("Customers",
- table => new
- {
- Id = table.Column(nullable: false),
- FirstName = table.Column(maxLength: 100, nullable: false),
- LastName = table.Column