diff --git a/.editorconfig b/.editorconfig
index 74089b2787..2524b768e6 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,6 +6,8 @@ end_of_line = lf
indent_style = space
indent_size = 4
+csharp_space_around_binary_operators = before_and_after
+
#### Naming styles ####
# Constants are PascalCase
@@ -84,6 +86,9 @@ dotnet_style_namespace_match_folder = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+csharp_style_prefer_primary_constructors = true:suggestion
+csharp_prefer_system_threading_lock = true:suggestion
+csharp_space_after_keywords_in_control_flow_statements = true
[*.xml]
indent_size = 2
@@ -92,4 +97,7 @@ indent_size = 2
indent_size = 2
[*.csproj]
+indent_size = 2
+
+[*.yml]
indent_size = 2
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc9b02ee10..cc829bc373 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,11 +3,14 @@ name: CI
on:
push:
branches:
- - master
+ - main
pull_request:
- branches:
- - master
+env:
+ DOTNET_NOLOGO: true
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
+ MINVERBUILDMETADATA: build.${{ github.run_id }}.${{ github.run_attempt}}
permissions:
+ id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -16,26 +19,64 @@ jobs:
build:
strategy:
fail-fast: false
- runs-on: windows-latest
+ runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4.2.0
with:
fetch-depth: 0
- - name: Install SQL Local DB
- run: ./Setup.ps1
- shell: pwsh
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+ 10.0.x
- name: Build and Test
run: ./Build.ps1
shell: pwsh
- - name: Push to MyGet
- env:
- NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
- NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
- run: ./Push.ps1
- shell: pwsh
- - name: Artifacts
- uses: actions/upload-artifact@v2
- with:
- name: artifacts
- path: artifacts/**/*
\ No newline at end of file
+ build-windows:
+ needs: build
+ strategy:
+ fail-fast: false
+ runs-on: windows-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4.2.0
+ with:
+ fetch-depth: 0
+ - name: Azure Login via OIDC
+ uses: azure/login@v2
+ with:
+ client-id: ${{ secrets.AZURE_CLIENT_ID }}
+ tenant-id: ${{ secrets.AZURE_TENANT_ID }}
+ subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+ 10.0.x
+ - name: Install NuGetKeyVaultSignTool
+ run: dotnet tool install --global NuGetKeyVaultSignTool
+ - name: Build and Test
+ run: ./Build.ps1
+ shell: pwsh
+ - name: Sign packages
+ run: |-
+ foreach ($f in Get-ChildItem "./artifacts" -Filter "*.nupkg") {
+ NuGetKeyVaultSignTool sign $f.FullName --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-managed-identity --azure-key-vault-url ${{ secrets.AZURE_KEYVAULT_URI }} --azure-key-vault-certificate ${{ secrets.CODESIGN_CERT_NAME }}
+ }
+ - name: Push to MyGet
+ if: github.ref == 'refs/heads/main'
+ env:
+ NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json
+ NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }}
+ run: ./Push.ps1
+ shell: pwsh
+ - name: Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: artifacts
+ path: artifacts/**/*
diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml
index ad2421a611..c76bec743d 100644
--- a/.github/workflows/lock.yml
+++ b/.github/workflows/lock.yml
@@ -3,6 +3,7 @@ name: 'Lock threads'
on:
schedule:
- cron: '0 0 * * 0'
+ workflow_dispatch:
permissions:
contents: read
@@ -12,18 +13,21 @@ jobs:
permissions:
issues: write # for dessant/lock-threads to lock issues
pull-requests: write # for dessant/lock-threads to lock PRs
+ discussions: write # for dessant/lock-threads to lock discussions
runs-on: ubuntu-latest
steps:
- - uses: dessant/lock-threads@v2
+ - uses: dessant/lock-threads@v5
with:
- github-token: ${{ github.token }}
- issue-lock-inactive-days: 31
- pr-lock-inactive-days: 31
- issue-lock-comment: >
+ issue-inactive-days: 31
+ pr-inactive-days: 31
+ discussion-inactive-days: 31
+ issue-comment: >
This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
- pr-lock-comment: >
+ pr-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
- Please open a new issue for related bugs.
+ discussion-comment: >
+ This discussion has been automatically locked since there
+ has not been any recent activity after it was closed.
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index affbcbd18c..3204a42176 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,42 +1,78 @@
name: Release
-
on:
push:
tags:
- - '*.*.*'
+ - "*.*.*"
permissions:
+ id-token: write
contents: read
-
jobs:
build:
+ strategy:
+ fail-fast: false
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+ 10.0.x
+ - name: Build and Test
+ run: ./Build.ps1
+ shell: pwsh
+ build-windows:
+ needs: build
strategy:
fail-fast: false
runs-on: windows-latest
steps:
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
- - name: Install SQL Local DB
- run: ./Setup.ps1
- shell: pwsh
- - name: Build and Test
- run: ./Build.ps1
- shell: pwsh
- - name: Push to MyGet
- env:
- NUGET_URL: https://www.myget.org/F/automapperdev/api/v3/index.json
- NUGET_API_KEY: ${{ secrets.MYGET_CI_API_KEY }}
- run: ./Push.ps1
- shell: pwsh
- - name: Push to NuGet
- env:
- NUGET_URL: https://api.nuget.org/v3/index.json
- NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- run: ./Push.ps1
- shell: pwsh
- - name: Artifacts
- uses: actions/upload-artifact@v2
- with:
- name: artifacts
- path: artifacts/**/*
\ No newline at end of file
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Azure Login via OIDC
+ uses: azure/login@v2
+ with:
+ client-id: ${{ secrets.AZURE_CLIENT_ID }}
+ tenant-id: ${{ secrets.AZURE_TENANT_ID }}
+ subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: |
+ 8.0.x
+ 9.0.x
+ 10.0.x
+ - name: Install NuGetKeyVaultSignTool
+ run: dotnet tool install --global NuGetKeyVaultSignTool
+ - name: Build and Test
+ run: ./Build.ps1
+ shell: pwsh
+ - name: Sign packages
+ run: |-
+ foreach ($f in Get-ChildItem "./artifacts" -Filter "*.nupkg") {
+ NuGetKeyVaultSignTool sign $f.FullName --file-digest sha256 --timestamp-rfc3161 http://timestamp.digicert.com --azure-key-vault-managed-identity --azure-key-vault-url ${{ secrets.AZURE_KEYVAULT_URI }} --azure-key-vault-certificate ${{ secrets.CODESIGN_CERT_NAME }}
+ }
+ - name: Push to MyGet
+ env:
+ NUGET_URL: https://f.feedz.io/lucky-penny-software/automapper/nuget/index.json
+ NUGET_API_KEY: ${{ secrets.FEEDZIO_ACCESS_TOKEN }}
+ run: ./Push.ps1
+ shell: pwsh
+ - name: Push to NuGet
+ env:
+ NUGET_URL: https://api.nuget.org/v3/index.json
+ NUGET_API_KEY: ${{ secrets.AUTOMAPPER_NUGET_API_KEY }}
+ run: ./Push.ps1
+ shell: pwsh
+ - name: Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: artifacts
+ path: artifacts/**/*
diff --git a/.gitignore b/.gitignore
index da0ff61b78..8915351bf8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ packages
.nuget
project.lock.json
.vs
+.DS_Store
# JetBrains Rider
.idea/
diff --git a/.readthedocs.yml b/.readthedocs.yml
index af59f269aa..3a7e5af642 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -1 +1,13 @@
-requirements_file: docs/requirements.txt
+version: "2"
+
+build:
+ os: "ubuntu-22.04"
+ tools:
+ python: "3.10"
+
+python:
+ install:
+ - requirements: docs/requirements.txt
+
+sphinx:
+ configuration: docs/source/conf.py
\ No newline at end of file
diff --git a/AutoMapper.WindowsCI.slnf b/AutoMapper.WindowsCI.slnf
new file mode 100644
index 0000000000..7cf49bf142
--- /dev/null
+++ b/AutoMapper.WindowsCI.slnf
@@ -0,0 +1,10 @@
+{
+ "solution": {
+ "path": "AutoMapper.sln",
+ "projects": [
+ "src\\AutoMapper\\AutoMapper.csproj",
+ "src\\AutoMapper.DI.Tests\\AutoMapper.DI.Tests.csproj",
+ "src\\UnitTests\\AutoMapper.UnitTests.csproj"
+ ]
+ }
+}
diff --git a/AutoMapper.sln b/AutoMapper.sln
index 92bcf049c6..d2fb09b5a1 100644
--- a/AutoMapper.sln
+++ b/AutoMapper.sln
@@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Push.ps1 = Push.ps1
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
- Setup.ps1 = Setup.ps1
+ AutoMapper.snk = AutoMapper.snk
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "src\Benchmark\Benchmark.csproj", "{B8051389-CB47-46FB-B234-9D49506704AA}"
@@ -26,6 +26,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.UnitTests", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.IntegrationTests", "src\IntegrationTests\AutoMapper.IntegrationTests.csproj", "{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoMapper.DI.Tests", "src\AutoMapper.DI.Tests\AutoMapper.DI.Tests.csproj", "{BEBD620A-8BAA-463F-BE0F-8319AD3C1644}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "src\TestApp\TestApp.csproj", "{35CED3AE-B825-4703-992D-A58B5BE646DC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -96,6 +100,38 @@ Global
{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x64.Build.0 = Release|Any CPU
{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x86.ActiveCfg = Release|Any CPU
{24B47F4C-0035-4F29-AAD9-4C47E1AAD98E}.Release|x86.Build.0 = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|ARM.Build.0 = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|x64.Build.0 = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Debug|x86.Build.0 = Debug|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|ARM.ActiveCfg = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|ARM.Build.0 = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|x64.ActiveCfg = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|x64.Build.0 = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|x86.ActiveCfg = Release|Any CPU
+ {BEBD620A-8BAA-463F-BE0F-8319AD3C1644}.Release|x86.Build.0 = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|ARM.Build.0 = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|x64.Build.0 = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Debug|x86.Build.0 = Debug|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|ARM.ActiveCfg = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|ARM.Build.0 = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|x64.ActiveCfg = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|x64.Build.0 = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|x86.ActiveCfg = Release|Any CPU
+ {35CED3AE-B825-4703-992D-A58B5BE646DC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Build.ps1 b/Build.ps1
index f3c142e64f..b37ce69612 100644
--- a/Build.ps1
+++ b/Build.ps1
@@ -26,6 +26,18 @@ $artifacts = ".\artifacts"
if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }
-exec { & dotnet test -c Release --results-directory $artifacts -l trx --verbosity=normal }
+if ($env:GITHUB_ACTIONS -eq 'true' -and $env:RUNNER_OS -eq 'Windows') {
+ Write-Host "✅ Running inside GitHub Actions on a Windows runner"
+ $solution = "./AutoMapper.WindowsCI.slnf"
+}
+else {
+ Write-Host "🖥️ Running locally or on a different platform"
+ $solution = "./AutoMapper.sln"
+}
-exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj -c Release -o $artifacts --no-build }
+exec { & dotnet test $solution --configuration Release --results-directory $artifacts --logger trx }
+
+# Only pack AutoMapper project on Windows runners in GitHub Actions
+if ($env:GITHUB_ACTIONS -eq 'true' -and $env:RUNNER_OS -eq 'Windows') {
+ exec { & dotnet pack .\src\AutoMapper\AutoMapper.csproj --configuration Release --output $artifacts --no-build }
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ae47413075..8e2323c194 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,7 @@ Then we can decide if and how a feature or a change could be implemented and if
Also read this first: [Being a good open source citizen](https://hackernoon.com/being-a-good-open-source-citizen-9060d0ab9732#.x3hocgw85)
## General feedback and discussions
-Please start a discussion on the [core repo issue tracker](https://github.com/AutoMapper/AutoMapper/issues).
+Please start a discussion on the [core repo issue tracker](https://github.com/LuckyPennySoftware/AutoMapper/issues).
## Platform
AutoMapper is built using the RTM tooling that ships with the latest Visual Studio. This is the only configuration accepted.
@@ -18,14 +18,10 @@ Run the PowerShell script `Build.ps1` from the command line. This builds and run
## Bugs and feature requests?
Please log a new issue in the appropriate GitHub repo:
-* [Core](https://github.com/AutoMapper/AutoMapper)
+* [Core](https://github.com/LuckyPennySoftware/AutoMapper)
* [EF6 Extensions](https://github.com/AutoMapper/AutoMapper.EF6)
* [IDataReader/Record Extensions](https://github.com/AutoMapper/AutoMapper.Data)
* [Collection Extensions](https://github.com/AutoMapper/AutoMapper.Collection)
-* [Microsoft DI Extensions](https://github.com/AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection)
-
-## Other discussions
-https://gitter.im/AutoMapper/AutoMapper
## Filing issues
The best way to get your bug fixed is to be as detailed as you can be about the problem.
@@ -39,11 +35,10 @@ Here are questions you can answer before you file a bug to make sure you're not
GitHub supports [markdown](https://github.github.com/github-flavored-markdown/), so when filing bugs make sure you check the formatting before clicking submit.
## Contributing code and content
-You will need to sign a [Contributor License Agreement](https://cla.dotnetfoundation.org/) before submitting your pull request.
Make sure you can build the code. Familiarize yourself with the project workflow and our coding conventions. If you don't know what a pull request is read this article: https://help.github.com/articles/using-pull-requests.
-**We only accept PRs to the master branch.**
+**We only accept PRs to the main branch.**
Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Here's a list of blog posts that are worth reading before doing a pull request:
diff --git a/Directory.Build.props b/Directory.Build.props
index 52fa6c08a1..9b4a5ab2dd 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,6 +9,15 @@
enable
+
+ $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_OSX())))
+ $([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows())))
+
+
+
+ $(DefineConstants);FULL_OR_STANDARD
+
+
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index b4ca933abe..9f2fa003eb 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,8 +1,8 @@
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000000..8d5c9bce5d
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,10 @@
+By accessing code under the [Lucky Penny Software GitHub Organization](https://github.com/LuckyPennySoftware) (Lucky Penny Software) here, you are agreeing to the following licensing terms.
+If you do not agree to these terms, do not access Lucky Penny Software code.
+
+Your license to Lucky Penny Software source code and/or binaries is governed by the Reciprocal Public License 1.5 (RPL1.5) license as described here:
+
+https://opensource.org/license/rpl-1-5/
+
+If you do not wish to release the source of software you build using Lucky Penny Software source code and/or binaries under the terms above, you may use Lucky Penny Software source code and/or binaries under the License Agreement described here:
+
+https://luckypennysoftware.com/license
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index ed254c2438..0000000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2010 Jimmy Bogard
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Push.ps1 b/Push.ps1
index 9663563b23..989042d40e 100644
--- a/Push.ps1
+++ b/Push.ps1
@@ -6,7 +6,7 @@ if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
} else {
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
Write-Host "$($scriptName): Pushing $($_.Name)"
- dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
+ dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY --skip-duplicate
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
diff --git a/README.md b/README.md
index 9b288ebad0..dee46cc8d4 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
-
+
-[](https://github.com/AutoMapper/AutoMapper/actions?query=workflow%3ACI)
+[](https://github.com/luckypennysoftware/AutoMapper/actions?query=workflow%3ACI)
[](https://www.nuget.org/packages/AutoMapper/)
-[](https://myget.org/feed/automapperdev/package/nuget/AutoMapper)
+[](https://docs.automapper.io/en/stable/?badge=stable)
+
### What is AutoMapper?
@@ -10,7 +11,6 @@ AutoMapper is a simple little library built to solve a deceptively complex probl
This is the main repository for AutoMapper, but there's more:
-* [Microsoft DI Extensions](https://github.com/AutoMapper/AutoMapper.Extensions.Microsoft.DependencyInjection)
* [Collection Extensions](https://github.com/AutoMapper/AutoMapper.Collection)
* [Expression Mapping](https://github.com/AutoMapper/AutoMapper.Extensions.ExpressionMapping)
* [EF6 Extensions](https://github.com/AutoMapper/AutoMapper.EF6)
@@ -23,15 +23,23 @@ First, configure AutoMapper to know what types you want to map, in the startup o
```csharp
var configuration = new MapperConfiguration(cfg =>
+{
+ cfg.CreateMap();
+ cfg.CreateMap();
+}, loggerFactory);
+
+// or more typically, using IServiceCollection
+services.AddAutoMapper(cfg =>
{
cfg.CreateMap();
cfg.CreateMap();
});
+
// only during development, validate your mappings; remove it before release
#if DEBUG
configuration.AssertConfigurationIsValid();
#endif
-// use DI (http://docs.automapper.org/en/latest/Dependency-injection.html) or create the mapper yourself
+// use DI (http://docs.automapper.io/en/latest/Dependency-injection.html) or create the mapper yourself
var mapper = configuration.CreateMapper();
```
Then in your application code, execute the mappings:
@@ -41,7 +49,7 @@ var fooDto = mapper.Map(foo);
var barDto = mapper.Map(bar);
```
-Check out the [getting started guide](https://automapper.readthedocs.io/en/latest/Getting-started.html). When you're done there, the [wiki](https://automapper.readthedocs.io/en/latest/) goes in to the nitty-gritty details. If you have questions, you can post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/automapper) or in our [Gitter](https://gitter.im/AutoMapper/AutoMapper).
+Check out the [getting started guide](https://automapper.readthedocs.io/en/latest/Getting-started.html). When you're done there, the [wiki](https://automapper.readthedocs.io/en/latest/) goes in to the nitty-gritty details. If you have questions, you can post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/automapper).
### Where can I get it?
@@ -57,19 +65,21 @@ dotnet add package AutoMapper
### Do you have an issue?
-First check if it's already fixed by trying the [MyGet build](https://automapper.readthedocs.io/en/latest/The-MyGet-build.html).
-
You might want to know exactly what [your mapping does](https://automapper.readthedocs.io/en/latest/Understanding-your-mapping.html) at runtime.
If you're still running into problems, file an issue above.
-### License, etc.
+If you are a paying customer, you can contact support via your account.
-This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
-For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
+### How do I set the license key?
-AutoMapper is Copyright © 2009 [Jimmy Bogard](https://jimmybogard.com) and other contributors under the [MIT license](LICENSE.txt).
+You can set the license key when registering AutoMapper:
-### .NET Foundation
+```csharp
+services.AddAutoMapper(cfg =>
+{
+ cfg.LicenseKey = "";
+})
+```
-This project is supported by the [.NET Foundation](https://dotnetfoundation.org).
+You can register for your license key at [AutoMapper.io](https://automapper.io)
\ No newline at end of file
diff --git a/docs/API-Changes.md b/docs/API-Changes.md
deleted file mode 100644
index d3875bccf3..0000000000
--- a/docs/API-Changes.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# API Changes
-
-Starting with version 9.0, you can find out [what changed](https://raw.githubusercontent.com/AutoMapper/AutoMapper/master/src/AutoMapper/ApiCompatBaseline.txt) in the public API from the last major version release.
-From the [releases page](https://github.com/AutoMapper/AutoMapper/releases) you can reach the source code for that release and the version of ApiCompatBaseline.txt in that tree will tell you what changed.
-A major version release is compared with the previous major version release (so 9.0.0 with 8.0.0) and a minor version release with the current major version release (so 9.1.1 with 9.0.0).
\ No newline at end of file
diff --git a/docs/Makefile b/docs/Makefile
index 2f136bfb63..269cadcf83 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,12 +1,12 @@
# Minimal makefile for Sphinx documentation
#
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = python -msphinx
-SPHINXPROJ = AutoMapper
-SOURCEDIR = .
-BUILDDIR = _build
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
diff --git a/docs/The-MyGet-build.md b/docs/The-MyGet-build.md
deleted file mode 100644
index b84e784230..0000000000
--- a/docs/The-MyGet-build.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# The MyGet Build
-
-AutoMapper uses MyGet to publish development builds based on the master branch. This means that the MyGet build sometimes contains fixes that are not available in the current NuGet package. Please try the latest MyGet build before reporting issues, in case your issue has already been fixed but not released.
-
-The AutoMapper MyGet gallery is available [here](https://myget.org/feed/automapperdev/package/nuget/AutoMapper). Be sure to include prereleases.
-
-## Installing the Package
-
-If you want to install the latest MyGet package into a project, you can use the following command:
-
-```
-Install-Package AutoMapper -Source https://www.myget.org/F/automapperdev/api/v3/index.json -IncludePrerelease
-```
diff --git a/docs/conf.py b/docs/conf.py
deleted file mode 100644
index cc465859ff..0000000000
--- a/docs/conf.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# AutoMapper documentation build configuration file, created by
-# sphinx-quickstart on Thu Oct 05 09:44:33 2017.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
-
-from recommonmark.parser import CommonMarkParser
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = []
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-source_parsers = {
- '.md': CommonMarkParser
-}
-
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = ['.rst', '.md']
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'AutoMapper'
-copyright = u'2017, Jimmy Bogard'
-author = u'Jimmy Bogard'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = u''
-# The full version, including alpha/beta/rc tags.
-release = u''
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = None
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = False
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = 'sphinx_rtd_theme'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#
-# html_theme_options = {}
-
-html_theme_options = {
- 'logo_only': True,
- 'display_version': False
-}
-
-html_logo = 'img/logo.png'
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# Custom sidebar templates, must be a dictionary that maps document names
-# to template names.
-#
-# This is required for the alabaster theme
-# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
-html_sidebars = {
- '**': [
- 'about.html',
- 'navigation.html',
- 'relations.html', # needs 'show_related': True theme option to display
- 'searchbox.html',
- 'donate.html',
- ]
-}
-
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'AutoMapperdoc'
-
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
-
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
-
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
-
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- (master_doc, 'AutoMapper.tex', u'AutoMapper Documentation',
- u'Jimmy Bogard', 'manual'),
-]
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- (master_doc, 'automapper', u'AutoMapper Documentation',
- [author], 1)
-]
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- (master_doc, 'AutoMapper', u'AutoMapper Documentation',
- author, 'AutoMapper', 'One line description of project.',
- 'Miscellaneous'),
-]
diff --git a/docs/make.bat b/docs/make.bat
index 1568929e2d..53941892e6 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -5,32 +5,31 @@ pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=python -msphinx
+ set SPHINXBUILD=sphinx-build
)
-set SOURCEDIR=.
-set BUILDDIR=_build
-set SPHINXPROJ=AutoMapper
+set SOURCEDIR=source
+set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
- echo.The Sphinx module was not found. Make sure you have Sphinx installed,
- echo.then set the SPHINXBUILD environment variable to point to the full
- echo.path of the 'sphinx-build' executable. Alternatively you may add the
- echo.Sphinx directory to PATH.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
-popd
+popd
\ No newline at end of file
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 4da41f9b71..30d45e6795 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1 +1,3 @@
-sphinx >= 1.6.0
+sphinx==7.1.2
+sphinx-rtd-theme==1.3.0rc1
+myst_parser==2.0.0
\ No newline at end of file
diff --git a/docs/10.0-Upgrade-Guide.md b/docs/source/10.0-Upgrade-Guide.md
similarity index 89%
rename from docs/10.0-Upgrade-Guide.md
rename to docs/source/10.0-Upgrade-Guide.md
index 15de37111e..16c51bb409 100644
--- a/docs/10.0-Upgrade-Guide.md
+++ b/docs/source/10.0-Upgrade-Guide.md
@@ -1,10 +1,10 @@
# 10.0 Upgrade Guide
-[Release notes](https://github.com/AutoMapper/AutoMapper/releases/tag/v10.0.0).
+[Release notes](https://github.com/luckypennysoftware/AutoMapper/releases/tag/v10.0.0).
## All collections are mapped by default, even if they have no setter
-You'll have to explicitly ignore those you don't want mapped. See also [this](https://github.com/AutoMapper/AutoMapper/issues/3449#issuecomment-651522397).
+You'll have to explicitly ignore those you don't want mapped. See also [this](https://github.com/luckypennysoftware/AutoMapper/issues/3449#issuecomment-651522397).
## Matching constructor parameters will be mapped from the source, even if they are optional
diff --git a/docs/11.0-Upgrade-Guide.md b/docs/source/11.0-Upgrade-Guide.md
similarity index 84%
rename from docs/11.0-Upgrade-Guide.md
rename to docs/source/11.0-Upgrade-Guide.md
index 9b32aab080..c2c2c38ea5 100644
--- a/docs/11.0-Upgrade-Guide.md
+++ b/docs/source/11.0-Upgrade-Guide.md
@@ -1,12 +1,12 @@
# 11.0 Upgrade Guide
-[Release notes](https://github.com/AutoMapper/AutoMapper/releases/tag/v11.0.0).
+[Release notes](https://github.com/luckypennysoftware/AutoMapper/releases/tag/v11.0.0).
## AutoMapper now targets .Net Standard 2.1 and doesn't work on .Net Framework
## `ForAllMaps`, `ForAllPropertyMaps`, `Advanced` and other "missing" APIs
-Some APIs were hidden for normal usage. To light them up, you need to add an `using` for `AutoMapper.Internal` and call the [`Internal` extension method](https://github.com/AutoMapper/AutoMapper/blob/9f2f16067ab201a5a8b9bc982f3a37e8790da7a0/src/AutoMapper/Internal/InternalApi.cs#L15) on the configuration object.
+Some APIs were hidden for normal usage. To light them up, you need to add an `using` for `AutoMapper.Internal` and call the [`Internal` extension method](https://github.com/LuckyPennySoftware/AutoMapper/blob/9f2f16067ab201a5a8b9bc982f3a37e8790da7a0/src/AutoMapper/Internal/InternalApi.cs#L15) on the configuration object.
Most users don't need these advanced methods. Some expose internals and are not subject to the usual semantic versioning rules. To avoid such tight coupling to AutoMapper, you should try to stick to the public API.
## Mapping _into_ existing collections
@@ -20,7 +20,7 @@ If you don't use `Map`, just `ProjectTo`, you should use `CreateProjection` inst
## `System.ComponentModel.TypeConverter` is no longer supported
-It was removed for performance reasons. So it's best not to use it anymore. But if you must, there is [a sample](https://github.com/AutoMapper/AutoMapper/search?q=TypeConverterMapper) in the test project.
+It was removed for performance reasons. So it's best not to use it anymore. But if you must, there is [a sample](https://github.com/LuckyPennySoftware/AutoMapper/search?q=TypeConverterMapper) in the test project.
## Generating interface proxies is disabled by default
@@ -28,7 +28,7 @@ That was misleading for a lot of people. You can opt-in per map with `AsProxy` (
## `MapToAttribute` and `IgnoreMapAttribute` were removed
-These were older attributes, unrelated to the newer attributes API. You can switch to the fluent API or implement the attributes in your own code. Check the tests for sample code ([here](https://github.com/AutoMapper/AutoMapper/search?q=MapToAttribute) and [here](https://github.com/AutoMapper/AutoMapper/search?q=IgnoreMapAttribute)).
+These were older attributes, unrelated to the newer attributes API. You can switch to the fluent API or implement the attributes in your own code. Check the tests for sample code ([here](https://github.com/LuckyPennySoftware/AutoMapper/search?q=MapToAttribute) and [here](https://github.com/LuckyPennySoftware/AutoMapper/search?q=IgnoreMapAttribute)).
## Global pre and postfixes are now applied in all maps
diff --git a/docs/12.0-Upgrade-Guide.md b/docs/source/12.0-Upgrade-Guide.md
similarity index 93%
rename from docs/12.0-Upgrade-Guide.md
rename to docs/source/12.0-Upgrade-Guide.md
index bbaa700dac..0b2f2c2bda 100644
--- a/docs/12.0-Upgrade-Guide.md
+++ b/docs/source/12.0-Upgrade-Guide.md
@@ -1,6 +1,6 @@
# 12.0 Upgrade Guide
-[Release notes](https://github.com/AutoMapper/AutoMapper/releases/tag/v12.0.0).
+[Release notes](https://github.com/LuckyPennySoftware/AutoMapper/releases/tag/v12.0.0).
## Equivalent settings overwrite each other
diff --git a/docs/source/13.0-Upgrade-Guide.md b/docs/source/13.0-Upgrade-Guide.md
new file mode 100644
index 0000000000..fb70426950
--- /dev/null
+++ b/docs/source/13.0-Upgrade-Guide.md
@@ -0,0 +1,23 @@
+# 13.0 Upgrade Guide
+
+[Release notes](https://github.com/LuckyPennySoftware/AutoMapper/releases/tag/v13.0.0).
+
+## AutoMapper now targets .Net 6
+
+## `AddAutoMapper` is part of the core package and the DI package is discontinued
+
+## `AllowAdditiveTypeMapCreation` was removed
+
+Be sure to call `CreateMap` once for a source type, destination type pair. If you want to reuse configuration, use mapping inheritance.
+
+## ProjectTo runtime polymorphic mapping with Include/IncludeBase
+
+We consider this an off the beaten path feature and we don't expose it through `CreateProjection`. You can use [an extension method](https://github.com/LuckyPennySoftware/AutoMapper/search?l=C%23&q=Advanced) or `CreateMap`.
+
+## `Context.State` similar to `Context.Items`
+
+The same pattern the framework uses to pass state to delegates. Note that `State` and `Items` are mutually exclusive per `Map` call.
+
+## Custom Equals/GetHashCode for source objects
+
+To avoid broken implementations, we no longer call those when checking for identical source objects, we hard code to checking object references.
diff --git a/docs/source/15.0-Upgrade-Guide.md b/docs/source/15.0-Upgrade-Guide.md
new file mode 100644
index 0000000000..d2bd479823
--- /dev/null
+++ b/docs/source/15.0-Upgrade-Guide.md
@@ -0,0 +1,45 @@
+# 15.0 Upgrade Guide
+
+[Release notes](https://github.com/LuckyPennySoftware/AutoMapper/releases/tag/v15.0.0).
+
+## AutoMapper now targets .NET 8, 9 and .NET Standard 2.0
+
+## AutoMapper now requires a license
+
+You can set your license via the configuration:
+
+```c#
+services.AddAutoMapper(cfg => {
+ cfg.LicenseKey = "";
+});
+```
+
+You can register for your license at [https://automapper.io](https://automapper.io).
+
+## Breaking Changes
+
+### `AddAutoMapper`
+
+With the requirement to supply a license, the `AddAutoMapper` overloads all require the `Action` parameter:
+
+```c#
+// Previous
+services.AddAutoMapper(typeof(Program));
+
+// Current
+services.AddAutoMapper(cfg => cfg.LicenseKey = "", typeof(Program));
+```
+
+This method parameter is first for all `AddAutoMapper` overloads.
+
+### `MapperConfiguration`
+
+The constructor to `MapperConfiguration` now requires an `ILoggerFactory`:
+
+```c#
+public MapperConfiguration(
+ MapperConfigurationExpression configurationExpression,
+ ILoggerFactory loggerFactory)
+```
+
+This parameter is used for diagnostics.
diff --git a/docs/5.0-Upgrade-Guide.md b/docs/source/5.0-Upgrade-Guide.md
similarity index 97%
rename from docs/5.0-Upgrade-Guide.md
rename to docs/source/5.0-Upgrade-Guide.md
index 2e12b9afb5..da377b1b09 100644
--- a/docs/5.0-Upgrade-Guide.md
+++ b/docs/source/5.0-Upgrade-Guide.md
@@ -88,7 +88,7 @@ Starting from 6.1.0 PreserveReferences is set automatically at config time whene
## UseDestinationValue
-UseDestinationValue tells AutoMapper not to create a new object for some member, but to use the existing property of the destination object. It used to be true by default. Consider whether this applies to your case. Check [recent issues](https://github.com/AutoMapper/AutoMapper/search?o=desc&q=UseDestinationValue&s=created&type=Issues&utf8=%E2%9C%93).
+UseDestinationValue tells AutoMapper not to create a new object for some member, but to use the existing property of the destination object. It used to be true by default. Consider whether this applies to your case. Check [recent issues](https://github.com/luckypennysoftware/AutoMapper/search?o=desc&q=UseDestinationValue&s=created&type=Issues&utf8=%E2%9C%93).
```c#
cfg.CreateMap()
diff --git a/docs/8.0-Upgrade-Guide.md b/docs/source/8.0-Upgrade-Guide.md
similarity index 100%
rename from docs/8.0-Upgrade-Guide.md
rename to docs/source/8.0-Upgrade-Guide.md
diff --git a/docs/8.1.1-Upgrade-Guide.md b/docs/source/8.1.1-Upgrade-Guide.md
similarity index 100%
rename from docs/8.1.1-Upgrade-Guide.md
rename to docs/source/8.1.1-Upgrade-Guide.md
diff --git a/docs/9.0-Upgrade-Guide.md b/docs/source/9.0-Upgrade-Guide.md
similarity index 100%
rename from docs/9.0-Upgrade-Guide.md
rename to docs/source/9.0-Upgrade-Guide.md
diff --git a/docs/source/API-Changes.md b/docs/source/API-Changes.md
new file mode 100644
index 0000000000..1a9637f4bb
--- /dev/null
+++ b/docs/source/API-Changes.md
@@ -0,0 +1,5 @@
+# API Changes
+
+Starting with version 9.0, you can find out [what changed](https://raw.githubusercontent.com/LuckyPennySoftware/AutoMapper/main/src/AutoMapper/ApiCompatBaseline.txt) in the public API from the last major version release.
+From the [releases page](https://github.com/LuckyPennySoftware/AutoMapper/releases) you can reach the source code for that release and the version of ApiCompatBaseline.txt in that tree will tell you what changed.
+A major version release is compared with the previous major version release (so 9.0.0 with 8.0.0) and a minor version release with the current major version release (so 9.1.1 with 9.0.0).
\ No newline at end of file
diff --git a/docs/Attribute-mapping.md b/docs/source/Attribute-mapping.md
similarity index 99%
rename from docs/Attribute-mapping.md
rename to docs/source/Attribute-mapping.md
index d667ef110c..9332c37e02 100644
--- a/docs/Attribute-mapping.md
+++ b/docs/source/Attribute-mapping.md
@@ -7,7 +7,7 @@ In addition to fluent configuration is the ability to declare and configure maps
In order to search for maps to configure, use the `AddMaps` method:
```c#
-var configuration = new MapperConfiguration(cfg => cfg.AddMaps("MyAssembly"));
+var configuration = new MapperConfiguration(cfg => cfg.AddMaps("MyAssembly"), loggerFactory);
var mapper = new Mapper(configuration);
```
diff --git a/docs/Before-and-after-map-actions.md b/docs/source/Before-and-after-map-actions.md
similarity index 83%
rename from docs/Before-and-after-map-actions.md
rename to docs/source/Before-and-after-map-actions.md
index 91822a656e..a8bc6bdd4a 100644
--- a/docs/Before-and-after-map-actions.md
+++ b/docs/source/Before-and-after-map-actions.md
@@ -7,7 +7,7 @@ var configuration = new MapperConfiguration(cfg => {
cfg.CreateMap()
.BeforeMap((src, dest) => src.Value = src.Value + 10)
.AfterMap((src, dest) => dest.Name = "John");
-});
+}, loggerFactory);
```
Or you can create before/after map callbacks during mapping:
@@ -42,10 +42,10 @@ var configuration = new MapperConfiguration(cfg => {
});
```
-### Asp.Net Core and `AutoMapper.Extensions.Microsoft.DependencyInjection`
-If you are using Asp.Net Core and the `AutoMapper.Extensions.Microsoft.DependencyInjection` package, this is also a good way of using Dependency Injection. You can't inject dependencies into `Profile` classes, but you can do it in `IMappingAction` implementations.
+### Dependency Injection
+You can't inject dependencies into `Profile` classes, but you can do it in `IMappingAction` implementations.
-The following example shows how to connect an `IMappingAction` accessing the current `HttpContext` to a `Profile` after map action, leveraging Dependency Injection:
+The following example shows how to connect an `IMappingAction` accessing the current `HttpContext` to a `Profile` after map action, leveraging dependency injection:
``` csharp
public class SetTraceIdentifierAction : IMappingAction
@@ -80,10 +80,8 @@ public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
- services.AddAutoMapper(typeof(Startup).Assembly);
+ services.AddAutoMapper(_ => { }, typeof(Startup).Assembly);
}
//..
}
-```
-
-*See `AutoMapper.Extensions.Microsoft.DependencyInjection` for more info.*
+```
\ No newline at end of file
diff --git a/docs/Conditional-mapping.md b/docs/source/Conditional-mapping.md
similarity index 97%
rename from docs/Conditional-mapping.md
rename to docs/source/Conditional-mapping.md
index 02a6f6c8a4..20d2b3eb7a 100644
--- a/docs/Conditional-mapping.md
+++ b/docs/source/Conditional-mapping.md
@@ -19,7 +19,7 @@ In the following mapping the property baz will only be mapped if it is greater t
var configuration = new MapperConfiguration(cfg => {
cfg.CreateMap()
.ForMember(dest => dest.baz, opt => opt.Condition(src => (src.baz >= 0)));
-});
+}, loggerFactory);
```
If you have a resolver, see [here](Custom-value-resolvers.html#resolvers-and-conditions) for a concrete example.
@@ -36,7 +36,7 @@ var configuration = new MapperConfiguration(cfg => {
// Expensive resolution process that can be avoided with a PreCondition
});
});
-});
+}, loggerFactory);
```
You can [see the steps](Understanding-your-mapping.html) yourself.
diff --git a/docs/Configuration-validation.md b/docs/source/Configuration-validation.md
similarity index 91%
rename from docs/Configuration-validation.md
rename to docs/source/Configuration-validation.md
index 2f0efc7386..cbba3f153c 100644
--- a/docs/Configuration-validation.md
+++ b/docs/source/Configuration-validation.md
@@ -17,7 +17,7 @@ public class Destination
In the Destination type, we probably fat-fingered the destination property. Other typical issues are source member renames. To test our configuration, we simply create a unit test that sets up the configuration and executes the AssertConfigurationIsValid method:
```c#
var configuration = new MapperConfiguration(cfg =>
- cfg.CreateMap());
+ cfg.CreateMap(), loggerFactory);
configuration.AssertConfigurationIsValid();
```
@@ -36,7 +36,7 @@ With the third option, we have a member on the destination type that we will fil
var configuration = new MapperConfiguration(cfg =>
cfg.CreateMap()
.ForMember(dest => dest.SomeValuefff, opt => opt.Ignore())
-);
+, loggerFactory);
```
## Selecting members to validate
@@ -47,12 +47,12 @@ By default, AutoMapper uses the destination type to validate members. It assumes
var configuration = new MapperConfiguration(cfg =>
cfg.CreateMap(MemberList.Source);
cfg.CreateMap(MemberList.None);
-);
+, loggerFactory);
```
-To skip validation altogether for this map, use `MemberList.None`.
+To skip validation altogether for this map, use `MemberList.None`. That's the default for `ReverseMap`.
## Custom validations
-You can add custom validations through an extension point. See [here](https://github.com/AutoMapper/AutoMapper/blob/bdc0120497d192a2741183415543f6119f50a982/src/UnitTests/CustomValidations.cs#L42).
+You can add custom validations through an extension point. See [here](https://github.com/LuckyPennySoftware/AutoMapper/blob/main/src/UnitTests/CustomValidations.cs).
diff --git a/docs/Configuration.md b/docs/source/Configuration.md
similarity index 94%
rename from docs/Configuration.md
rename to docs/source/Configuration.md
index 318890ec64..d501a57bd7 100644
--- a/docs/Configuration.md
+++ b/docs/source/Configuration.md
@@ -6,7 +6,7 @@ Create a `MapperConfiguration` instance and initialize configuration via the con
var config = new MapperConfiguration(cfg => {
cfg.CreateMap();
cfg.AddProfile();
-});
+}, loggerFactory);
```
The `MapperConfiguration` instance can be stored statically, in a static field or in a dependency injection container. Once created it cannot be changed/modified.
@@ -15,7 +15,7 @@ The `MapperConfiguration` instance can be stored statically, in a static field o
var configuration = new MapperConfiguration(cfg => {
cfg.CreateMap();
cfg.AddProfile();
-});
+}, loggerFactory);
```
Starting with 9.0, the static API is no longer available.
@@ -65,24 +65,24 @@ or by automatically scanning for profiles:
// ... using instance approach:
var config = new MapperConfiguration(cfg => {
cfg.AddMaps(myAssembly);
-});
-var configuration = new MapperConfiguration(cfg => cfg.AddMaps(myAssembly));
+}, loggerFactory);
+var configuration = new MapperConfiguration(cfg => cfg.AddMaps(myAssembly), loggerFactory);
// Can also use assembly names:
-var configuration = new MapperConfiguration(cfg =>
+var configuration = new MapperConfiguration(cfg => {
cfg.AddMaps(new [] {
"Foo.UI",
"Foo.Core"
});
-);
+}, loggerFactory);
// Or marker types for assemblies:
-var configuration = new MapperConfiguration(cfg =>
+var configuration = new MapperConfiguration(cfg => {
cfg.AddMaps(new [] {
typeof(HomeController),
typeof(Entity)
});
-);
+}, loggerFactory);
```
AutoMapper will scan the designated assemblies for classes inheriting from Profile and add them to the configuration.
@@ -95,7 +95,7 @@ You can set the source and destination naming conventions
var configuration = new MapperConfiguration(cfg => {
cfg.SourceMemberNamingConvention = LowerUnderscoreNamingConvention.Instance;
cfg.DestinationMemberNamingConvention = PascalCaseNamingConvention.Instance;
-});
+}, loggerFactory);
```
This will map the following properties to each other:
@@ -143,7 +143,7 @@ var configuration = new MapperConfiguration(c =>
c.ReplaceMemberName("Ä", "A");
c.ReplaceMemberName("í", "i");
c.ReplaceMemberName("Airlina", "Airline");
-});
+}, loggerFactory);
```
## Recognizing pre/postfixes
@@ -162,7 +162,7 @@ public class Dest {
var configuration = new MapperConfiguration(cfg => {
cfg.RecognizePrefixes("frm");
cfg.CreateMap();
-});
+}, loggerFactory);
configuration.AssertConfigurationIsValid();
```
@@ -172,7 +172,7 @@ By default AutoMapper recognizes the prefix "Get", if you need to clear the pref
var configuration = new MapperConfiguration(cfg => {
cfg.ClearPrefixes();
cfg.RecognizePrefixes("tmp");
-});
+}, loggerFactory);
```
## Global property/field filtering
@@ -188,7 +188,7 @@ var configuration = new MapperConfiguration(cfg =>
// map properties with a public or private getter
cfg.ShouldMapProperty = pi =>
pi.GetMethod != null && (pi.GetMethod.IsPublic || pi.GetMethod.IsPrivate);
-});
+}, loggerFactory);
```
## Configuring visibility
@@ -201,7 +201,7 @@ var configuration = new MapperConfiguration(cfg =>
// map properties with public or internal getters
cfg.ShouldMapProperty = p => p.GetMethod.IsPublic || p.GetMethod.IsAssembly;
cfg.CreateMap();
-});
+}, loggerFactory);
```
Map configurations will now recognize internal/private members.
@@ -211,7 +211,7 @@ Map configurations will now recognize internal/private members.
Because expression compilation can be a bit resource intensive, AutoMapper lazily compiles the type map plans on first map. However, this behavior is not always desirable, so you can tell AutoMapper to compile its mappings directly:
```c#
-var configuration = new MapperConfiguration(cfg => {});
+var configuration = new MapperConfiguration(cfg => {}, loggerFactory);
configuration.CompileMappings();
```
diff --git a/docs/Construction.md b/docs/source/Construction.md
similarity index 89%
rename from docs/Construction.md
rename to docs/source/Construction.md
index 36af6d41ac..945181e64e 100644
--- a/docs/Construction.md
+++ b/docs/source/Construction.md
@@ -15,7 +15,7 @@ public class SourceDto {
get { return _value; }
}
}
-var configuration = new MapperConfiguration(cfg => cfg.CreateMap());
+var configuration = new MapperConfiguration(cfg => cfg.CreateMap(), loggerFactory);
```
If the destination constructor parameter names don't match, you can modify them at config time:
@@ -36,7 +36,7 @@ public class SourceDto {
var configuration = new MapperConfiguration(cfg =>
cfg.CreateMap()
.ForCtorParam("valueParamSomeOtherName", opt => opt.MapFrom(src => src.Value))
-);
+, loggerFactory);
```
This works for both LINQ projections and in-memory mapping.
@@ -44,13 +44,13 @@ This works for both LINQ projections and in-memory mapping.
You can also disable constructor mapping:
```c#
-var configuration = new MapperConfiguration(cfg => cfg.DisableConstructorMapping());
+var configuration = new MapperConfiguration(cfg => cfg.DisableConstructorMapping(), loggerFactory);
```
You can configure which constructors are considered for the destination object:
```c#
// use only public constructors
-var configuration = new MapperConfiguration(cfg => cfg.ShouldUseConstructor = constructor => constructor.IsPublic);
+var configuration = new MapperConfiguration(cfg => cfg.ShouldUseConstructor = constructor => constructor.IsPublic, loggerFactory);
```
When mapping to records, consider using only public constructors.
\ No newline at end of file
diff --git a/docs/Custom-type-converters.md b/docs/source/Custom-type-converters.md
similarity index 99%
rename from docs/Custom-type-converters.md
rename to docs/source/Custom-type-converters.md
index ff3a6b21aa..8b77facd2c 100644
--- a/docs/Custom-type-converters.md
+++ b/docs/source/Custom-type-converters.md
@@ -52,7 +52,7 @@ public void Example()
cfg.CreateMap().ConvertUsing(new DateTimeTypeConverter());
cfg.CreateMap().ConvertUsing();
cfg.CreateMap();
- });
+ }, loggerFactory);
configuration.AssertConfigurationIsValid();
var source = new Source
diff --git a/docs/Custom-value-resolvers.md b/docs/source/Custom-value-resolvers.md
similarity index 96%
rename from docs/Custom-value-resolvers.md
rename to docs/source/Custom-value-resolvers.md
index 58a603d42d..fde7612b40 100644
--- a/docs/Custom-value-resolvers.md
+++ b/docs/source/Custom-value-resolvers.md
@@ -47,7 +47,7 @@ In the below example, we'll use the first option, telling AutoMapper the custom
```c#
var configuration = new MapperConfiguration(cfg =>
cfg.CreateMap()
- .ForMember(dest => dest.Total, opt => opt.MapFrom()));
+ .ForMember(dest => dest.Total, opt => opt.MapFrom()), loggerFactory);
configuration.AssertConfigurationIsValid();
var source = new Source
@@ -83,7 +83,7 @@ If we don't want AutoMapper to use reflection to create the instance, we can sup
var configuration = new MapperConfiguration(cfg => cfg.CreateMap()
.ForMember(dest => dest.Total,
opt => opt.MapFrom(new CustomResolver())
- ));
+ ), loggerFactory);
```
AutoMapper will use that specific object, helpful in scenarios where the resolver might have constructor arguments or need to be constructed by an IoC container.
@@ -104,7 +104,7 @@ cfg.CreateMap()
cfg.CreateMap()
.ForMember(dest => dest.OtherTotal,
opt => opt.MapFrom(src => src.OtherSubTotal));
-});
+}, loggerFactory);
public class CustomResolver : IMemberValueResolver