Ejemplo n.º 1
0
        public override void Import(Models.Repository repository, System.IO.Stream zipStream, bool @override)
        {
            List <string> schemaNames = new List <string>();
            Dictionary <string, Schema> oldSchemas = new Dictionary <string, Schema>();

            using (var zipFile = ZipFile.Read(zipStream))
            {
                foreach (var entry in zipFile.Entries)
                {
                    if (entry.FileName.IndexOf('/') == entry.FileName.Length - 1)
                    {
                        var schemaName = entry.FileName.Substring(0, entry.FileName.Length - 1);
                        schemaNames.Add(schemaName);
                        oldSchemas[schemaName] = this.Get(new Schema(repository, schemaName));
                    }
                }
            }
            zipStream.Position = 0;
            base.Import(repository, zipStream, @override);

            foreach (var name in schemaNames)
            {
                var oldSchema = oldSchemas[name];
                var newSchema = this.Get(new Models.Schema(repository, name));
                if (oldSchema != null)
                {
                    SchemaManager.Update(newSchema, oldSchema);
                }
                else
                {
                    Initialize(newSchema);
                }
            }
        }
Ejemplo n.º 2
0
 public override void Update(Models.Schema @new, Models.Schema old)
 {
     base.Update(@new, old);
     SchemaManager.Update(@new, old);
 }