public static GetNodeID ( string uri ) : System.Int64 | ||
uri | string | |
Результат | System.Int64 |
// OK to cache as long as dependency is working! public string GetRegistryDefinedVisiblity(string ownerUri) { if (ownerUri == null || ownerUri.Trim().Length == 0) { return(null); } Dictionary <int, string> registeredApps = (Dictionary <int, string>)Framework.Utilities.Cache.FetchObject(REGISTERED_APPS_CACHE_PREFIX + ownerUri); if (registeredApps == null) { registeredApps = new Dictionary <int, string>(); Profiles.ORNG.Utilities.DataIO data = new Profiles.ORNG.Utilities.DataIO(); using (SqlDataReader dr = data.GetRegisteredApps(ownerUri)) { while (dr.Read()) { registeredApps[dr.GetInt32(0)] = dr.GetString(1); } } Framework.Utilities.Cache.Set(REGISTERED_APPS_CACHE_PREFIX + ownerUri, registeredApps, OpenSocialManager.GetNodeID(ownerUri), null); } return(registeredApps.ContainsKey(GetAppId()) ? registeredApps[GetAppId()] : null); }
// OK to cache as long as dependency is working! // think about this, as this is now only set manually via DB public bool IsRegistered(string ownerUri) { if (ownerUri == null || ownerUri.Trim().Length == 0) { return(false); } HashSet <int> registeredApps = (HashSet <int>)Framework.Utilities.Cache.FetchObject(REGISTERED_APPS_CACHE_PREFIX + ownerUri); if (registeredApps == null) { registeredApps = new HashSet <int>(); Profiles.ORNG.Utilities.DataIO data = new Profiles.ORNG.Utilities.DataIO(); using (SqlDataReader dr = data.GetRegisteredApps(ownerUri)) { while (dr.Read()) { registeredApps.Add(dr.GetInt32(0)); } } Framework.Utilities.Cache.Set(REGISTERED_APPS_CACHE_PREFIX + ownerUri, registeredApps, OpenSocialManager.GetNodeID(ownerUri), null); } return(registeredApps.Contains(GetAppId())); }