├── .github
└── FUNDING.yml
├── src
├── package.snk
├── Properties
│ └── AssemblyInfo.cs
├── ServiceLocatorProvider.cs
├── Exceptions
│ ├── ActivationException.Desktop.cs
│ └── ActivationException.cs
├── ServiceLocator.cs
├── CommonServiceLocator.csproj
├── IServiceLocator.cs
├── net40
│ └── TypeInfo.cs
└── ServiceLocatorImplBase.cs
├── codecov.yml
├── test
├── Components
│ ├── ILogger.cs
│ ├── SimpleLogger.cs
│ └── AdvancedLogger.cs
├── CommonServiceLocator.Tests.csproj
├── MockServiceLocator.cs
├── ServiceLocatorFixture.cs
└── ServiceLocatorAdapterFixture.cs
├── package.props
├── appveyor.yml
├── azure-pipelines-pr.yml
├── azure-pipelines-test.yml
├── package.sln
├── azure-pipelines.yml
├── LICENSE
├── README.md
└── .gitignore
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [ENikS]
2 | open_collective: unity-container
3 |
--------------------------------------------------------------------------------
/src/package.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unitycontainer/commonservicelocator/HEAD/src/package.snk
--------------------------------------------------------------------------------
/src/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security;
3 |
4 | [assembly:CLSCompliant(true)]
5 | [assembly:SecurityTransparent]
6 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | ignore:
2 | - "tests/*" # Ignore tests
3 | - "src/Utility/*" # Ignore utilities
4 | - "**/*.Designer.cs" # Ignore generated code
5 |
--------------------------------------------------------------------------------
/test/Components/ILogger.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace ServiceLocation.Tests.Components
4 | {
5 | public interface ILogger
6 | {
7 | void Log(string msg);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/test/Components/SimpleLogger.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace ServiceLocation.Tests.Components
6 | {
7 | public class SimpleLogger : ILogger
8 | {
9 | public void Log(string msg)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/Components/AdvancedLogger.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace ServiceLocation.Tests.Components
6 | {
7 | public class AdvancedLogger : ILogger
8 | {
9 | public void Log(string msg)
10 | {
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ServiceLocatorProvider.cs:
--------------------------------------------------------------------------------
1 | namespace CommonServiceLocator
2 | {
3 | ///
4 | /// This delegate type is used to provide a method that will
5 | /// return the current container. Used with the
6 | /// static accessor class.
7 | ///
8 | /// An .
9 | public delegate IServiceLocator ServiceLocatorProvider();
10 | }
11 |
--------------------------------------------------------------------------------
/package.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2.0.7
5 | netcoreapp3.0;netcoreapp2.0;netcoreapp1.0;netstandard1.0;netstandard2.0;netstandard2.1;net46;net47;net48;net50;net6.0;net7.0
6 |
7 |
8 |
9 | This release contains targets for .NET 4.7, and 4.8, 5.0, 6.0, 7.0 .NET Core 1.0, 2.0 and 3.0, .NET Standard 1.0, .NET Standard 2.0 and .NET Standard 2.1
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/CommonServiceLocator.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2022
2 | configuration: Release
3 |
4 | install:
5 | - ps: $env:build_version = (Select-Xml -Path ".\src\CommonServiceLocator.csproj" -XPath "/Project/PropertyGroup/Version" | Select-Object -ExpandProperty Node).InnerText
6 | - ps: Update-AppveyorBuild -Version "$env:build_version.$env:APPVEYOR_BUILD_NUMBER"
7 |
8 | before_build:
9 | - cmd: dotnet restore
10 |
11 | build:
12 | project: package.sln
13 | parallel: true
14 | verbosity: minimal
15 |
16 | dotnet_csproj:
17 | patch: false
18 |
19 | artifacts:
20 | - path: '**\CommonServiceLocator.*.nupkg'
21 | name: 'CommonServiceLocator'
22 |
--------------------------------------------------------------------------------
/azure-pipelines-pr.yml:
--------------------------------------------------------------------------------
1 | # Pull Request build
2 |
3 | pr:
4 | branches:
5 | include:
6 | - master
7 |
8 | pool:
9 | vmImage: 'windows-latest'
10 |
11 | variables:
12 | solution: '**/*.sln'
13 | buildPlatform: 'Any CPU'
14 | buildConfiguration: 'Release'
15 |
16 | steps:
17 | - task: NuGetToolInstaller@1
18 |
19 | - task: NuGetCommand@2
20 | inputs:
21 | restoreSolution: '$(solution)'
22 |
23 | - task: VSBuild@1
24 | inputs:
25 | solution: '$(solution)'
26 | platform: '$(buildPlatform)'
27 | configuration: '$(buildConfiguration)'
28 |
29 | - task: VSTest@2
30 | inputs:
31 | platform: '$(buildPlatform)'
32 | configuration: '$(buildConfiguration)'
33 |
--------------------------------------------------------------------------------
/azure-pipelines-test.yml:
--------------------------------------------------------------------------------
1 | # Build pipeline
2 |
3 | trigger:
4 | - master
5 |
6 | pool:
7 | vmImage: 'windows-latest'
8 |
9 | variables:
10 | solution: '**/*.csproj'
11 | buildPlatform: 'Any CPU'
12 | buildConfiguration: 'Release'
13 | OutputPath: '$(build.artifactstagingdirectory)'
14 |
15 | steps:
16 | - task: NuGetToolInstaller@1
17 |
18 | - task: NuGetCommand@2
19 | inputs:
20 | restoreSolution: '$(solution)'
21 |
22 | - task: VSBuild@1
23 | inputs:
24 | solution: '$(solution)'
25 | platform: '$(buildPlatform)'
26 | configuration: '$(buildConfiguration)'
27 |
28 | - task: VSTest@2
29 | inputs:
30 | platform: '$(buildPlatform)'
31 | configuration: '$(buildConfiguration)'
32 |
33 | - task: PublishBuildArtifacts@1
34 | displayName: 'Publish Artifact'
35 | inputs:
36 | PathtoPublish: '$(build.artifactstagingdirectory)'
37 | ArtifactName: 'Package'
38 |
39 |
--------------------------------------------------------------------------------
/test/MockServiceLocator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using CommonServiceLocator;
5 |
6 | namespace ServiceLocation.Tests.Mocks
7 | {
8 | public class MockServiceLocator : ServiceLocatorImplBase
9 | {
10 | private readonly IEnumerable