Skip to content

Commit ad075c8

Browse files
authored
Remove obsolete members for v2.0 (#519)
1 parent f82f353 commit ad075c8

File tree

3 files changed

+2
-72
lines changed

3 files changed

+2
-72
lines changed

src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionAttribute.cs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,9 @@ namespace Microsoft.AspNetCore.SystemWebAdapters;
99
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
1010
public sealed class SessionAttribute : Attribute
1111
{
12-
[Obsolete("Prefer SessionBehavior instead.")]
13-
public SessionBehavior Behavior
14-
{
15-
get
16-
{
17-
if (SessionBehavior is SessionStateBehavior.Disabled)
18-
{
19-
return SystemWebAdapters.SessionBehavior.None;
20-
}
21-
22-
return IsPreLoad ? SystemWebAdapters.SessionBehavior.Preload : SystemWebAdapters.SessionBehavior.OnDemand;
23-
}
24-
set
25-
{
26-
SessionBehavior = value switch
27-
{
28-
SystemWebAdapters.SessionBehavior.None => SessionStateBehavior.Disabled,
29-
SystemWebAdapters.SessionBehavior.Preload => SessionStateBehavior.Required,
30-
SystemWebAdapters.SessionBehavior.OnDemand => SessionStateBehavior.Required,
31-
_ => throw new ArgumentOutOfRangeException(nameof(value)),
32-
};
33-
}
34-
}
35-
3612
public SessionStateBehavior SessionBehavior { get; set; } = SessionStateBehavior.Required;
3713

3814
public bool IsPreLoad { get; set; } = true;
3915

40-
public bool IsReadOnly
41-
{
42-
get => SessionBehavior is SessionStateBehavior.ReadOnly;
43-
[Obsolete("Prefer SessionBehavior property")]
44-
set
45-
{
46-
if (value)
47-
{
48-
SessionBehavior = SessionStateBehavior.ReadOnly;
49-
}
50-
}
51-
}
16+
public bool IsReadOnly => SessionBehavior is SessionStateBehavior.ReadOnly;
5217
}

src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionBehavior.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System;
5-
using System.ComponentModel;
65
using Microsoft.AspNetCore.Builder;
76
using Microsoft.AspNetCore.SystemWebAdapters;
87
using Microsoft.AspNetCore.SystemWebAdapters.SessionState.Serialization;
@@ -11,13 +10,8 @@
1110

1211
namespace Microsoft.Extensions.DependencyInjection;
1312

14-
public static class ISystemWebAdapterBuilderSessionExtensions
13+
public static class WrappedSessionExtensions
1514
{
16-
[Obsolete("Prefer AddWrappedAspNetCoreSession instead")]
17-
[EditorBrowsable(EditorBrowsableState.Never)]
18-
public static ISystemWebAdapterBuilder WrapAspNetCoreSession(this ISystemWebAdapterBuilder builder, Action<SessionOptions>? options = null)
19-
=> builder.AddWrappedAspNetCoreSession(options);
20-
2115
public static ISystemWebAdapterBuilder AddWrappedAspNetCoreSession(this ISystemWebAdapterBuilder builder, Action<SessionOptions>? options = null)
2216
{
2317
ArgumentNullException.ThrowIfNull(builder);

0 commit comments

Comments
 (0)