Ejemplo n.º 1
0
        private void ValidateSchema(SqlConnection connection, IEnumerable <TableData> tables)
        {
            var schema = new SqlCommand("SELECT TOP 1 [Schema] FROM Sitecore.JobInfo", connection).ExecuteScalar() as string;

            if (schema == null ||
                !TableDataHelpers.FieldsAreEqual(tables.Select(t => t.Schema),
                                                 TableDataHelpers.Deserialize(schema)))
            {
                throw new Exception("Schema check failed. The existing schema does not match the job's schema.");
            }
        }
Ejemplo n.º 2
0
        public IList <TableData> Load(string tempPath)
        {
            var cultureName = "en-US";
            var delim       = "\t";

            var csvConfig = RootState.Select("export");

            if (csvConfig != null)
            {
                cultureName = csvConfig.TryGet("culture", cultureName);
                delim       = csvConfig.TryGet("delim", delim);
            }

            var schemas = TableDataHelpers.Deserialize(File.ReadAllText(Path.Combine(tempPath, "Schema.json")));

            return
                (schemas.Select(
                     s =>
                     (TableData) new CsvTableData(s, Path.Combine(tempPath, s.Name + ".txt"), delim,
                                                  CultureInfo.GetCultureInfo(cultureName))).ToList());
        }