From 9ac69c54c9431513251ed32f858bb32f9317f835 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 4 May 2021 21:57:03 -0700 Subject: [PATCH 1/2] Move ServiceCollection to abstractions --- ...tensions.DependencyInjection.Abstractions.cs | 17 +++++++++++++++++ .../src/ServiceCollection.cs | 0 ...t.Extensions.DependencyInjection.Forwards.cs | 7 +++++++ .../Microsoft.Extensions.DependencyInjection.cs | 17 ----------------- ...rosoft.Extensions.DependencyInjection.csproj | 1 + 5 files changed, 25 insertions(+), 17 deletions(-) rename src/libraries/{Microsoft.Extensions.DependencyInjection => Microsoft.Extensions.DependencyInjection.Abstractions}/src/ServiceCollection.cs (100%) create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs index 482c51e78384d5..4f438875cbcf7b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.cs @@ -49,6 +49,23 @@ public partial interface ISupportRequiredService object GetRequiredService(System.Type serviceType); } public delegate object ObjectFactory(System.IServiceProvider serviceProvider, object?[]? arguments); + public partial class ServiceCollection : Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public ServiceCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public Microsoft.Extensions.DependencyInjection.ServiceDescriptor this[int index] { get { throw null; } set { } } + public void Clear() { } + public bool Contains(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void CopyTo(Microsoft.Extensions.DependencyInjection.ServiceDescriptor[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void Insert(int index, Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } + public bool Remove(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } + public void RemoveAt(int index) { } + void System.Collections.Generic.ICollection.Add(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } public static partial class ServiceCollectionServiceExtensions { public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddScoped(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type serviceType) { throw null; } diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceCollection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollection.cs similarity index 100% rename from src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceCollection.cs rename to src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceCollection.cs diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs new file mode 100644 index 00000000000000..ea093fb5cc7676 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.Forwards.cs @@ -0,0 +1,7 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the https://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection))] diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs index 3b0c8c0af2b3df..d2161d89051508 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.cs @@ -13,23 +13,6 @@ public DefaultServiceProviderFactory(Microsoft.Extensions.DependencyInjection.Se public Microsoft.Extensions.DependencyInjection.IServiceCollection CreateBuilder(Microsoft.Extensions.DependencyInjection.IServiceCollection services) { throw null; } public System.IServiceProvider CreateServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection containerBuilder) { throw null; } } - public partial class ServiceCollection : Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public ServiceCollection() { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public Microsoft.Extensions.DependencyInjection.ServiceDescriptor this[int index] { get { throw null; } set { } } - public void Clear() { } - public bool Contains(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void CopyTo(Microsoft.Extensions.DependencyInjection.ServiceDescriptor[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void Insert(int index, Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } - public bool Remove(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { throw null; } - public void RemoveAt(int index) { } - void System.Collections.Generic.ICollection.Add(Microsoft.Extensions.DependencyInjection.ServiceDescriptor item) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } public static partial class ServiceCollectionContainerBuilderExtensions { public static Microsoft.Extensions.DependencyInjection.ServiceProvider BuildServiceProvider(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { throw null; } diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj index b1b514112a7c05..c8ea291c9b5d77 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj @@ -4,6 +4,7 @@ + From f4afe2b6d21dd62a2b5a3dd343eff9acb4f14bfc Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 5 May 2021 08:28:33 -0700 Subject: [PATCH 2/2] Added the type forward in the source --- .../src/Properties/TypeForwards.cs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs new file mode 100644 index 00000000000000..9c4e2191403115 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/src/Properties/TypeForwards.cs @@ -0,0 +1,4 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection))]