Пример #1
0
 private void ValidatePatch(SqlParentTable table, BlittableJsonReaderObject document)
 {
     try
     {
         table.GetJsPatch().PatchDocument(document);
     }
     catch (Exception e)
     {
         AddError(SqlMigrationImportResult.Error.ErrorType.InvalidPatch, $"Cannot patch table '{table.Name}' using the given script. Error: {e}", table.Name);
     }
 }
Пример #2
0
        private void SetTablesFromBlittableArray(List <SqlMigrationImportOperation.SqlMigrationTable> tablesToWrite, SqlTable parentTable = null)
        {
            foreach (var item in tablesToWrite)
            {
                SqlTable table;

                if (parentTable != null)
                {
                    table = new SqlEmbeddedTable(item.Name, item.Query, this, item.NewName, parentTable.Name);
                    parentTable.EmbeddedTables.Add((SqlEmbeddedTable)table);
                    EmbeddedTables.Add((SqlEmbeddedTable)table);
                }
                else
                {
                    table = new SqlParentTable(item.Name, item.Query, this, item.NewName, item.Patch);
                    ParentTables.Add((SqlParentTable)table);
                }

                if (item.EmbeddedTables != null)
                {
                    SetTablesFromBlittableArray(item.EmbeddedTables, table);
                }
            }
        }