Skip to content

Class DiySession

Namespace: Tool.Web.Session
Assembly: Tool.Net.dll

用于提供实现自定义Session

csharp
public abstract class DiySession : ISession

Inheritance

objectDiySession

Implements

ISession

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), SessionExtension.Get(ISession, string), SessionExtension.Get<T>(ISession, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), SessionExtension.Set(ISession, string, object), SessionExtension.Set<T>(ISession, string, T), SessionExtension.Set(ISession, string, string), SessionExtension.SetAvailable(ISession, bool), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object), SessionExtension.TryGetValue(ISession, string, out string), SessionExtension.TryGetValue<T>(ISession, string, out T), SessionExtension.TryGetValue(ISession, string, Type, out object)

Remarks

代码由逆血提供支持

Properties

Context

提供当前请求信息模块

csharp
public HttpContext Context { get; }

Property Value

HttpContext

Id

SessionId

csharp
public string Id { get; }

Property Value

string

IsAvailable

Session 是否可用(可用时将自动标记,可用标志)

csharp
public bool IsAvailable { get; set; }

Property Value

bool

Logger

提供日志输出模块

csharp
public ILogger Logger { get; }

Property Value

ILogger

Methods

Clear()

清空 Session 的全部键值

csharp
public abstract void Clear()

GetKeys()

提供 Session 的全部键

csharp
public abstract IEnumerable<string> GetKeys()

Returns

IEnumerable<string>

Initialize()

创建Session对象的认证流程

csharp
public virtual Task Initialize()

Returns

Task

Remove(string)

删除 Session 指定的键值

csharp
public abstract void Remove(string key)

Parameters

key string

指定的键

Set(string, byte[])

添加键值的方法

csharp
public abstract void Set(string key, byte[] value)

Parameters

key string

value byte[]

SetId(string)

设置Id值

csharp
protected void SetId(string id)

Parameters

id string

SessionId

ToString()

显示说明

csharp
public override string ToString()

Returns

string

TryGetValue(string, out byte[])

获取键值的方法

csharp
public abstract bool TryGetValue(string key, out byte[] value)

Parameters

key string

value byte[]

Returns

bool

返回是否存在

基于Apache-2.0协议开源