Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,9 @@ namespace Microsoft.AspNetCore.SystemWebAdapters;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class SessionAttribute : Attribute
{
[Obsolete("Prefer SessionBehavior instead.")]
public SessionBehavior Behavior
{
get
{
if (SessionBehavior is SessionStateBehavior.Disabled)
{
return SystemWebAdapters.SessionBehavior.None;
}

return IsPreLoad ? SystemWebAdapters.SessionBehavior.Preload : SystemWebAdapters.SessionBehavior.OnDemand;
}
set
{
SessionBehavior = value switch
{
SystemWebAdapters.SessionBehavior.None => SessionStateBehavior.Disabled,
SystemWebAdapters.SessionBehavior.Preload => SessionStateBehavior.Required,
SystemWebAdapters.SessionBehavior.OnDemand => SessionStateBehavior.Required,
_ => throw new ArgumentOutOfRangeException(nameof(value)),
};
}
}

public SessionStateBehavior SessionBehavior { get; set; } = SessionStateBehavior.Required;

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

public bool IsReadOnly
{
get => SessionBehavior is SessionStateBehavior.ReadOnly;
[Obsolete("Prefer SessionBehavior property")]
set
{
if (value)
{
SessionBehavior = SessionStateBehavior.ReadOnly;
}
}
}
public bool IsReadOnly => SessionBehavior is SessionStateBehavior.ReadOnly;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.ComponentModel;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.SystemWebAdapters;
using Microsoft.AspNetCore.SystemWebAdapters.SessionState.Serialization;
Expand All @@ -11,13 +10,8 @@

namespace Microsoft.Extensions.DependencyInjection;

public static class ISystemWebAdapterBuilderSessionExtensions
public static class WrappedSessionExtensions
{
[Obsolete("Prefer AddWrappedAspNetCoreSession instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static ISystemWebAdapterBuilder WrapAspNetCoreSession(this ISystemWebAdapterBuilder builder, Action<SessionOptions>? options = null)
=> builder.AddWrappedAspNetCoreSession(options);

public static ISystemWebAdapterBuilder AddWrappedAspNetCoreSession(this ISystemWebAdapterBuilder builder, Action<SessionOptions>? options = null)
{
ArgumentNullException.ThrowIfNull(builder);
Expand Down