Esempio n. 1
0
 /// <summary>
 /// Creates a factory instance and adds a http application injecting facility.
 /// </summary>
 /// <returns>A new factory</returns>
 public static IEngine CreateEngineInstance()
 {
     var typeFinder = new WebAppTypeFinder();
     var engines = typeFinder.FindClassesOfType<IEngine>().ToArray();
     if (engines.Length > 0)
     {
         var defaultEngine = (IEngine)Activator.CreateInstance(engines[0]);
         return defaultEngine;
     }
     else
     {
         throw new ApplicationException("Can not find any IoC engines in the context. Please try to copy the default engine(Kooboo.CMS.Common.Runtime.Dependency.Ninject.dll and Ninject.dll) which implemented in Kooboo CMS into BIN folder.");
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a factory instance and adds a http application injecting facility.
        /// </summary>
        /// <returns>A new factory</returns>
        public static IEngine CreateEngineInstance()
        {
            var typeFinder = new WebAppTypeFinder();
            var engines    = typeFinder.FindClassesOfType <IEngine>().ToArray();

            if (engines.Length > 0)
            {
                var defaultEngine = (IEngine)Activator.CreateInstance(engines[0]);
                return(defaultEngine);
            }
            else
            {
                throw new ApplicationException("Can not find any IoC engines in the context. Please try to copy the default engine(Kooboo.CMS.Common.Runtime.Dependency.Ninject.dll and Ninject.dll) which implemented in Kooboo CMS into BIN folder.");
            }
        }