/// <summary> /// 获取当前操作人标识 /// </summary> /// <param name="session">用户会话</param> public static T GetUserId <T>(this ISession session) { return(Convert.To <T>(session.UserId)); }
/// <summary> /// 获取当前应用程序标识 /// </summary> /// <param name="session">用户会话</param> public static T GetApplicationId <T>(this ISession session) { return(Convert.To <T>(Web.Identity.GetValue(ClaimTypes.ApplicationId))); }
/// <summary> /// 动态创建实例 /// </summary> /// <typeparam name="T">目标类型</typeparam> /// <param name="type">类型</param> /// <param name="parameters">传递给构造函数的参数</param> public static T CreateInstance <T>(Type type, params object[] parameters) { return(Convert.To <T>(Activator.CreateInstance(type, parameters))); }