public static DependencyReferenceToken Get(string identifier)
        {
            DependencyReferenceToken value = null;

            if (_reference.TryGetValue(identifier, out value) == false)
            {
                value = new DependencyReferenceToken(DateTime.Now);
                _reference.Add(identifier, value);
            }

            return(value);
        }
        static void InternalTimerCallback(object sender)
        {
            Epi.Web.WCF.SurveyService.IDataService dataService;
            dataService = new Epi.Web.WCF.SurveyService.DataService();
            CacheDependencyRequest request = new CacheDependencyRequest();

            request.Criteria.SurveyIdList = new List <string>(_reference.Keys);
            CacheDependencyResponse       cacheDependencyResponse = (CacheDependencyResponse)dataService.GetCacheDependencyInfo(request);
            Dictionary <string, DateTime> response = cacheDependencyResponse.SurveyDependency;

            foreach (KeyValuePair <string, DateTime> kvp in response)
            {
                if (_reference.ContainsKey(kvp.Key))
                {
                    _reference[kvp.Key].ChangeIfGreater(kvp.Value);
                }
                else
                {
                    DependencyReferenceToken dependencyUpdateToken = new DependencyReferenceToken(kvp.Value);
                    _reference.Add(kvp.Key, dependencyUpdateToken);
                }
            }
        }
예제 #3
0
        public ProxyDependency(string identifier)
        {
            DependencyReferenceToken dependencyReferenceToken = ProxyDependencyReference.Get(identifier);

            dependencyReferenceToken.Changed += new DependencyChangedEventHandler(ProxyDependency_Changed);
        }