Beispiel #1
0
        public void Export(string itemNames, string filename)
        {
            var authentication = this.CommandContext.GetAuthentication(this);
            var dataBase       = this.CremaHost.Dispatcher.Invoke(() => this.CremaHost.DataBases[this.DataBaseName]);
            var dataSet        = new CremaDataSet();

            using (DataBaseUsing.Set(dataBase, authentication, true))
            {
                if (this.Context == CremaSchema.TableDirectory)
                {
                    this.ReadTables(dataSet, dataBase, itemNames);
                }
                else
                {
                    this.ReadTypes(dataSet, dataBase, itemNames);
                }
            }

            if (this.Context == CremaSchema.TableDirectory)
            {
                this.WriteTables(dataSet, filename);
            }
            else
            {
                this.WriteTypes(dataSet, filename);
            }
        }
Beispiel #2
0
        public void Import(string filename, string itemNames = null)
        {
            var authentication = this.CommandContext.GetAuthentication(this);
            var path           = Path.Combine(this.CommandContext.BaseDirectory, filename);
            var dataBase       = this.CremaHost.Dispatcher.Invoke(() => this.CremaHost.DataBases[this.DataBaseName]);
            var dataSet        = new CremaDataSet();

            using (DataBaseUsing.Set(dataBase, authentication, true))
            {
                if (this.Context == CremaSchema.TableDirectory)
                {
                    this.ReadTables(dataSet, dataBase, path, itemNames);
                    this.ImportTables(dataSet, dataBase);
                }
                else
                {
                    throw new NotImplementedException("타입 가져오기 기능은 구현되지 않았습니다.");
                }
            }

            dataBase.Dispatcher.Invoke(() =>
            {
                dataBase.TableContext.Import(authentication, dataSet, this.Comment);
            });
        }