Пример #1
0
        /// <summary>
        /// Configures and creates a new rules engine instance
        /// </summary>
        /// <param name="configureCallback">The callback to perform the configuration</param>
        /// <returns>The new rules engine instance</returns>
        public static RulesEngine New(Action<EngineConfigurator> configureCallback)
        {
            if (configureCallback == null)
                throw new ArgumentNullException("configureCallback");

            var configurator = new OdoyuleEngineConfigurator();

            configureCallback(configurator);

            ConfigurationResult result = configurator.Validate();

            try
            {
                RulesEngine engine = configurator.Create();

                return engine;
            }
            catch (Exception ex)
            {
                throw new RulesEngineConfigurationException(result, ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Configures and creates a new rules engine instance
        /// </summary>
        /// <param name="configureCallback">The callback to perform the configuration</param>
        /// <returns>The new rules engine instance</returns>
        public static RulesEngine New(Action <EngineConfigurator> configureCallback)
        {
            if (configureCallback == null)
            {
                throw new ArgumentNullException("configureCallback");
            }

            var configurator = new OdoyuleEngineConfigurator();

            configureCallback(configurator);

            ConfigurationResult result = configurator.Validate();

            try
            {
                RulesEngine engine = configurator.Create();

                return(engine);
            }
            catch (Exception ex)
            {
                throw new RulesEngineConfigurationException(result, ex);
            }
        }