Exemplo n.º 1
0
        void ConsumeCollection(string entityType, JArray collection, bool loadedAll)
        {
            CachedEntitySet cachedEntitySet = CachedEntities.GetOrAdd(entityType, new CachedEntitySet(EntityCacheSpecs[entityType]));

            cachedEntitySet.LoadedAll = cachedEntitySet.LoadedAll || loadedAll;
            foreach (var entity in collection)
            {
                cachedEntitySet.Update("Updated", entity as JObject);
            }
        }
Exemplo n.º 2
0
        public void ConsumeResponse(string endpoint, JToken response)
        {
            var path = endpoint.Split('/');

            if (path.Length == 2)
            {
                var entityType = path[0];
                var method     = path[1];
                if (method == "find" || method == "item")
                {
                    var             entity          = response as JObject;
                    CachedEntitySet cachedEntitySet = CachedEntities.GetOrAdd(entityType, new CachedEntitySet(EntityCacheSpecs[entityType]));
                    cachedEntitySet.Update("Updated", entity);
                }
                else if (method == "list" || method == "deps" || method == "ldeps" || method == "suggest" || method == "items")
                {
                    ConsumeCollection(entityType, response as JArray, method == "list" && EntityCacheSpecs[entityType].CanLoadAll);
                }
            }
        }
Exemplo n.º 3
0
        public void Update(string eventType, string entityType, JObject entity)
        {
            CachedEntitySet cachedEntitySet = CachedEntities.GetOrAdd(entityType, new CachedEntitySet(EntityCacheSpecs[entityType]));

            cachedEntitySet.Update(eventType, entity);
        }