Example #1
0
        /// <summary>
        /// Sets the global instance of the Lava Engine with the specified configuration options.
        /// </summary>
        /// <param name="lavaEngineType"></param>
        /// <param name="options"></param>
        public static void SetCurrentEngine(Type lavaEngineType, LavaEngineConfigurationOptions options)
        {
            lock ( _initializationLock )
            {
                // Release the current instance.
                _engine = null;

                if (lavaEngineType != null)
                {
                    var engine = NewEngineInstance(lavaEngineType, options);

                    // Assign the current instance.
                    _engine = engine;

                    // If RockLiquid is enabled, set the Lava Engine to throw exceptions so they can be logged.
                    if (RockLiquidIsEnabled)
                    {
                        ExceptionHandlingStrategy = ExceptionHandlingStrategySpecifier.Throw;
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Initializes the Lava engine with the specified options.
        /// </summary>
        public void Initialize(LavaEngineConfigurationOptions options)
        {
            if (options == null)
            {
                options = new LavaEngineConfigurationOptions();
            }

            // Initialize the cache service for the current Lava Engine type.
            _cacheService = options.CacheService;

            if (_cacheService != null)
            {
                _cacheService.Initialize(this.GetType().Name);
            }

            _defaultEnabledCommands = options.DefaultEnabledCommands;

            if (options.ExceptionHandlingStrategy != null)
            {
                this.ExceptionHandlingStrategy = options.ExceptionHandlingStrategy.Value;
            }

            OnSetConfiguration(options);
        }
Example #3
0
        /// <summary>
        /// Create a new Lava Engine instance with the specified configuration options.
        /// </summary>
        /// <param name="lavaEngineType"></param>
        /// <param name="options"></param>
        public static ILavaEngine NewEngineInstance(Type lavaEngineType, LavaEngineConfigurationOptions options)
        {
            var engine = _serviceProvider.GetService(lavaEngineType, options) as ILavaEngine;

            return(engine);
        }
Example #4
0
 /// <summary>
 /// Override this method to set configuration options for the specific Liquid framework engine implementation.
 /// </summary>
 /// <param name="options"></param>
 public abstract void OnSetConfiguration(LavaEngineConfigurationOptions options);