/// <summary> /// 使用Id手动创建统一资源名称 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <returns></returns> static public string CreateUrnKey <T>(object id) { return(KeyFactory.GetUrnKey <T>(id)); }
/// <summary> /// 获取对象实例的统一资源名称 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="obj">类型实例</param> /// <param name="idFunc">指定获取Id的Func</param> /// <returns></returns> static public string GetUrnKey <T>(T obj, Func <T, object> idFunc) { var id = null == idFunc?GetId(obj) : idFunc(obj); return(KeyFactory.GetUrnKey <T>(id)); }
static public long GetSequenceId <T>() { var key = KeyFactory.GetSequenceKey <T>(); return(Engine.RedisDB.StringIncrement(key)); }