Class DiySession
Namespace: Tool.Web.Session
Assembly: Tool.Net.dll
用于提供实现自定义Session
public abstract class DiySession : ISessionInheritance
Implements
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
提供当前请求信息模块
public HttpContext Context { get; }Property Value
Id
SessionId
public string Id { get; }Property Value
IsAvailable
Session 是否可用(可用时将自动标记,可用标志)
public bool IsAvailable { get; set; }Property Value
Logger
提供日志输出模块
public ILogger Logger { get; }Property Value
Methods
Clear()
清空 Session 的全部键值
public abstract void Clear()GetKeys()
提供 Session 的全部键
public abstract IEnumerable<string> GetKeys()Returns
Initialize()
创建Session对象的认证流程
public virtual Task Initialize()Returns
Remove(string)
删除 Session 指定的键值
public abstract void Remove(string key)Parameters
key string
指定的键
Set(string, byte[])
添加键值的方法
public abstract void Set(string key, byte[] value)Parameters
key string
键
value byte[]
值
SetId(string)
设置Id值
protected void SetId(string id)Parameters
id string
SessionId
ToString()
显示说明
public override string ToString()Returns
TryGetValue(string, out byte[])
获取键值的方法
public abstract bool TryGetValue(string key, out byte[] value)Parameters
key string
键
value byte[]
值
Returns
返回是否存在