Esempio n. 1
0
        public Entity CreateEntityWithID(string entityClassName, long id)
        {
            var key   = new EntityCacheEntry(entityClassName, id);
            var cache = context.site.entityCache;

            if (cache.ContainsKey(key))
            {
                return(cache[key]);
            }

            var entity = CreateEntity(entityClassName);

            cache[key] = entity;
            return(entity);
        }
Esempio n. 2
0
        public T CreateEntityWithID <T>(long id) where T : Entity
        {
            var key   = new EntityCacheEntry(typeof(T).Name.ToLower(), id);
            var cache = context.site.entityCache;

            if (cache.ContainsKey(key))
            {
                return((T)cache[key]);
            }

            var entity = CreateEntity <T>();

            cache[key] = entity;
            return(entity);
        }