/// <summary>
        /// Validates row names and value types against schema
        /// </summary>
        /// <param name="schema"></param>
        /// <returns></returns>
        public virtual Exception Validate(ResultSetSchema schema)
        {
            schema.ThrowIfNull("schema");

            var ex = schema.Validate(true);

            if (ex != null)
            {
                return(new InvalidOperationException("Invalid schema", ex));
            }

            ex = CheckForEmptyValuesWithoutColumnName();
            if (ex != null)
            {
                return(ex);
            }

            ex = CheckForInvalidCOlumnNames(schema);
            if (ex != null)
            {
                return(ex);
            }

            ex = CheckForInvalidValueTypes(schema);
            if (ex != null)
            {
                return(ex);
            }

            return(null); // nothing to validate here TODO: validate against given schema!!
        }
Exemple #2
0
        public virtual Exception Validate(ResultSetSchema schema, bool recursive = false)
        {
            schema.ThrowIfNull("schema");

            if (recursive)
            {
                foreach (var row in this)
                {
                    var ex = row.Validate(schema);
                    if (ex != null)
                    {
                        return(new InvalidOperationException("Found invalid row(s)", ex));
                    }
                }
            }

            return(null);
        }