Exemple #1
0
        /// <summary>
        /// Validates the <paramref name="source"/> model and creates the <see cref="DmnDefinition"/> from <see cref="DmnModel"/>
        /// </summary>
        /// <param name="source">Source DMN Model parsed from XML</param>
        ///<exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
        /// <returns>DMN model definition that can be used to execute the decisions within the <see cref="runtime.DmnExecutionContext"/></returns>
        public static DmnDefinition CreateDmnDefinition(DmnModel source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            var factory = new DmnDefinitionFactory(source);

            return(new DmnDefinition(factory.Variables, factory.InputData, factory.Decisions));
        }
Exemple #2
0
        /// <summary>
        /// Validates the <paramref name="source"/> model and creates the <see cref="DmnDefinition"/> from <see cref="DmnModel"/>
        /// </summary>
        /// <param name="source">Source DMN Model parsed from XML</param>
        ///<exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
        /// <returns>DMN model definition that can be used to execute the decisions within the <see cref="runtime.DmnExecutionContext"/></returns>
        public static DmnDefinition CreateDmnDefinition(DmnModel source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            var factory = new DmnDefinitionFactory(source);

            return(new DmnDefinition(
                       factory.Variables.ToDictionary(
                           v => v.Key,
                           v => (IDmnVariable)v.Value),
                       factory.Decisions));
        }