Ejemplo n.º 1
0
        public static void PostLoad(IDependencyResolver dependencyResolver)
        {
            //Remove the comments to activate CodeFist

            /* CODE FIRST START
             * var dbs = Sitecore.Configuration.Factory.GetDatabases();
             * foreach (var db in dbs)
             * {
             * var provider = db.GetDataProviders().FirstOrDefault(x => x is GlassDataProvider) as GlassDataProvider;
             * if (provider != null)
             * {
             * using (new SecurityDisabler())
             * {
             * provider.Initialise(db);
             * }
             * }
             * }
             * CODE FIRST END
             */
        }
        /// <summary>
        /// Register Custom Glass Field Handlers
        /// </summary>
        /// <param name="resolver"></param>
        public static void RegisterCustomDataHandlers(IDependencyResolver resolver)
        {
            if (!Configuration.GlassField.Handlers.Any())
            {
                Sitecore.Diagnostics.Log.Info("Common.Foundation.Glass: Field handlers skipped (none registered)",
                                              "Common.Foundation.Glass");
            }
            else
            {
                Sitecore.Diagnostics.Log.Info(
                    string.Format("Common.Foundation.Glass: Processing {0} field handlers...",
                                  Configuration.GlassField.Handlers.Count), "Common.Foundation.Glass");

                foreach (var handler in Configuration.GlassField.Handlers)
                {
                    Sitecore.Diagnostics.Log.Info(string.Format("Common.Foundation.Glass: Registering {0}", handler.ToString()),
                                                  "Common.Foundation.Glass");

                    var handler1 = handler;
                    resolver.DataMapperFactory.Insert(0, () => handler1);
                }
            }
        }
 public static void PostLoad(IDependencyResolver dependencyResolver)
 {
 }