Inheritance: Glass.Mapper.Config
        private static ISitecoreService CreateSitecoreService(Database database)
        {
            var config      = new Glass.Mapper.Sc.Config();
            var depResolver = new Glass.Mapper.Sc.IoC.DependencyResolver(config);
            var ctx         = Context.Create(depResolver);

            return(new SitecoreService(database, ctx));
        }
        public static IDependencyResolver CreateResolver()
        {
            var config = new Glass.Mapper.Sc.Config();

            var dependencyResolver = new DependencyResolver(config);

            // add any changes to the standard resolver here
            return(dependencyResolver);
        }
Exemple #3
0
        /// <summary>
        /// Gets the language items.
        /// </summary>
        /// <param name="foundItems">The found items.</param>
        /// <param name="language">The language.</param>
        /// <param name="config"></param>
        /// <returns>IEnumerable{Item}.</returns>
        public static IEnumerable<Item> GetLanguageItems(IEnumerable<Item> foundItems, Language language, Config config)
        {
            if (foundItems == null) return Enumerable.Empty<Item>();

            return foundItems.Select(x => GetLanguageItem(x, language, config)).Where(x => x != null);
        }
Exemple #4
0
        public static bool DoVersionCheck(Config config)
        {
            if (config != null && config.ForceItemInPageEditor && GlassHtml.IsInEditingMode)
                return false;


            return Switcher<VersionCountState>.CurrentValue != VersionCountState.Disabled;

        }
Exemple #5
0
        /// <summary>
        /// Gets the language item.
        /// </summary>
        /// <param name="foundItem">The found item.</param>
        /// <param name="language">The language.</param>
        /// <returns>Item.</returns>
        public static Item GetLanguageItem(Item foundItem, Language language, Config config)
        {
            if (foundItem == null) return null;

            var item = foundItem.Database.GetItem(foundItem.ID, language);

            if (item == null || (item.Versions.Count == 0 && Utilities.DoVersionCheck(config)))
            {
                return null;
            }

            return item;
        }
 public static IDependencyResolver CreateResolver()
 {
     var config = new Config();
     return new DependencyResolver(config);
 }
 public ItemVersionHandler(Config config)
 {
     _config = config;
 }
 public CachedItemVersionHandler(ICacheManager cacheManager, Config config) : base(config)
 {
     _cacheManager = cacheManager;
 }