Exemplo n.º 1
0
        protected virtual IItemData GetSourceFromId(ID id, bool useCache = false, bool allowTpSyncFallback = true)
        {
            var item = GetItemFromId(id, useCache);

            if (item == null)
            {
                if (allowTpSyncFallback && !DisableTransparentSync)
                {
                    // note: if reliant on item data, e.g. for saves, this fallback will not have any updates applied
                    // and is thus useless. Disallow fallback for that case but you need data from elsewhere.
                    return(_targetDataStore.GetById(id.Guid, Database.Name));
                }

                return(null);
            }

            return(new ItemData(item));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Given an item definition, resolve it in the target data store
 /// This involves seeing if we can use the Sitecore db to resolve its path
 /// (as definition does not include the path) so we can efficiently look it up
 /// in path based data stores. If we cannot resolve a path, or the path is incorrect,
 /// we fall back to using GetById on the target data store.
 /// </summary>
 protected virtual IItemData GetTargetFromId(ID id)
 {
     return(_targetDataStore.GetById(id.Guid, Database.Name));
 }