Skip to content

Commit 3c94070

Browse files
committed
Obsolete SetMemoryAllocator
1 parent d055952 commit 3c94070

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/ImageSharp.Web/DependencyInjection/ImageSharpBuilderExtensions.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,19 @@ 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.")]
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>
70-
public static IImageSharpBuilder SetMemoryAllocator<TMemoryAllocator>(this IImageSharpBuilder builder)
71-
where TMemoryAllocator : MemoryAllocator
72-
{
73-
var descriptor = new ServiceDescriptor(typeof(MemoryAllocator), typeof(TMemoryAllocator), ServiceLifetime.Singleton);
74-
builder.Services.Replace(descriptor);
75-
return builder;
76-
}
67+
[Obsolete("Use ImageSharp.Configuration.MemoryAllocator. This will be removed in a future version.")]
68+
public static IImageSharpBuilder SetMemoryAllocator<TMemoryAllocator>(this IImageSharpBuilder builder) where TMemoryAllocator : MemoryAllocator
69+
=> builder;
7770

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

0 commit comments

Comments
 (0)