Skip to content

Commit 15cb36a

Browse files
Merge pull request #154 from deanmarcussen/dm/malloc
Obsolete SetMemoryAllocator builder extensions
2 parents d055952 + 2ed89bb commit 15cb36a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/ImageSharp.Web/DependencyInjection/ImageSharpBuilderExtensions.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,20 @@ public static IImageSharpBuilder SetRequestParser(this IImageSharpBuilder builde
5454
/// <param name="builder">The core builder.</param>
5555
/// <param name="implementationFactory">The factory method for returning a <see cref="MemoryAllocator"/>.</param>
5656
/// <returns>The <see cref="IImageSharpBuilder"/>.</returns>
57+
[Obsolete("Use ImageSharp.Configuration.MemoryAllocator. This will be removed in a future version.", true)]
5758
public static IImageSharpBuilder SetMemoryAllocator(this IImageSharpBuilder builder, Func<IServiceProvider, MemoryAllocator> implementationFactory)
58-
{
59-
var descriptor = new ServiceDescriptor(typeof(MemoryAllocator), implementationFactory, ServiceLifetime.Singleton);
60-
builder.Services.Replace(descriptor);
61-
return builder;
62-
}
59+
=> builder;
6360

6461
/// <summary>
6562
/// Sets the given <see cref="MemoryAllocator"/> adding it to the service collection.
6663
/// </summary>
6764
/// <typeparam name="TMemoryAllocator">The type of class implementing <see cref="MemoryAllocator"/>to add.</typeparam>
6865
/// <param name="builder">The core builder.</param>
6966
/// <returns>The <see cref="IImageSharpBuilder"/>.</returns>
67+
[Obsolete("Use ImageSharp.Configuration.MemoryAllocator. This will be removed in a future version.", true)]
7068
public static IImageSharpBuilder SetMemoryAllocator<TMemoryAllocator>(this IImageSharpBuilder builder)
7169
where TMemoryAllocator : MemoryAllocator
72-
{
73-
var descriptor = new ServiceDescriptor(typeof(MemoryAllocator), typeof(TMemoryAllocator), ServiceLifetime.Singleton);
74-
builder.Services.Replace(descriptor);
75-
return builder;
76-
}
70+
=> builder;
7771

7872
/// <summary>
7973
/// Sets the given <see cref="IImageCache"/> adding it to the service collection.

0 commit comments

Comments
 (0)