Ejemplo n.º 1
0
        public static RulesEngine New(Action <RulesEngineConfigurator> configureCallback)
        {
            if (configureCallback == null)
            {
                throw new ArgumentNullException("configureCallback");
            }

            var configurator = new RulesEngineConfiguratorImpl();

            configureCallback(configurator);


            ConfigurationResult result = ConfigurationResultImpl.CompileResults(configurator.ValidateConfiguration());

            try
            {
                RulesEngine engine = configurator.Create();

                return(engine);
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception was thrown during rules engine creation", ex);
            }
        }
Ejemplo n.º 2
0
        public static RulesEngine New(Action<RulesEngineConfigurator> configureCallback)
        {
            if (configureCallback == null)
                throw new ArgumentNullException("configureCallback");

            var configurator = new RulesEngineConfiguratorImpl();

            configureCallback(configurator);

            ConfigurationResult result = ConfigurationResultImpl.CompileResults(configurator.ValidateConfiguration());

            try
            {
                RulesEngine engine = configurator.Create();

                return engine;
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception was thrown during rules engine creation", ex);
            }
        }