Example #1
0
        public static CremaDataSet ReadFromDirectory(string path, CremaDataSetFilter filter)
        {
            ValidateReadFromDirectory(path, filter);

            var dataSet    = new CremaDataSet();
            var fullPath   = new DirectoryInfo(path).FullName;
            var tablePath  = Path.Combine(fullPath, CremaSchema.TableDirectory);
            var typePath   = Path.Combine(fullPath, CremaSchema.TypeDirectory);
            var typeFiles  = filter.FilterTypes(typePath, $"*{CremaSchema.SchemaExtension}");
            var tableFiles = filter.FilterTables(tablePath, $"*{CremaSchema.XmlExtension}");

            dataSet.ReadMany(typeFiles, tableFiles, filter.OmitContent);
            return(dataSet);
        }
Example #2
0
        public static CremaDataSet ReadFromDirectory(string path, string filterExpression, ReadTypes readType)
        {
            var filter = new CremaDataSetFilter();

            if (filterExpression is not null)
            {
                filter.Tables = StringUtility.Split(filterExpression, ';');
            }
            if (readType == ReadTypes.OmitContent)
            {
                filter.OmitContent = true;
            }
            else if (readType == ReadTypes.TypeOnly)
            {
                filter.OmitTable = true;
            }
            return(ReadFromDirectory(path, filter));
        }