This repository was archived by the owner on Nov 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove use of IConfiguration from ServiceCollection * Removing the Add* methods from IServiceCollection that don't accept an IServiceDescriptor Fixes #116 #117
- Loading branch information
Showing
5 changed files
with
239 additions
and
82 deletions.
There are no files selected for viewing
28 changes: 13 additions & 15 deletions
28
src/Microsoft.Framework.DependencyInjection/IServiceCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Framework.DependencyInjection | ||
{ | ||
/// <summary> | ||
/// Specifies the contract for a collection of service descriptors. | ||
/// </summary> | ||
#if ASPNET50 || ASPNETCORE50 | ||
[Microsoft.Framework.Runtime.AssemblyNeutral] | ||
#endif | ||
public interface IServiceCollection : IEnumerable<IServiceDescriptor> | ||
{ | ||
/// <summary> | ||
/// Adds the <paramref name="descriptor"/> to this instance. | ||
/// </summary> | ||
/// <param name="descriptor">The <see cref="IServiceDescriptor"/> to add.</param> | ||
/// <returns>A reference to the current instance of <see cref="IServiceCollection"/>.</returns> | ||
IServiceCollection Add(IServiceDescriptor descriptor); | ||
|
||
/// <summary> | ||
/// Adds a sequence of <see cref="IServiceDescriptor"/> to this instance. | ||
/// </summary> | ||
/// <param name="descriptor">The <see cref="IEnumerable{T}"/> of <see cref="IServiceDescriptor"/>s to add.</param> | ||
/// <returns>A reference to the current instance of <see cref="IServiceCollection"/>.</returns> | ||
IServiceCollection Add(IEnumerable<IServiceDescriptor> descriptors); | ||
|
||
IServiceCollection AddTransient(Type service, Type implementationType); | ||
|
||
IServiceCollection AddTransient(Type service, Func<IServiceProvider, object> implementationFactory); | ||
|
||
IServiceCollection AddScoped(Type service, Type implementationType); | ||
|
||
IServiceCollection AddScoped(Type service, Func<IServiceProvider, object> implementationFactory); | ||
|
||
IServiceCollection AddSingleton(Type service, Type implementationType); | ||
|
||
IServiceCollection AddSingleton(Type service, Func<IServiceProvider, object> implementationFactory); | ||
|
||
IServiceCollection AddInstance(Type service, object implementationInstance); | ||
} | ||
} |
61 changes: 7 additions & 54 deletions
61
src/Microsoft.Framework.DependencyInjection/ServiceCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.