• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IShellContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IShellContext的典型用法代码示例。如果您正苦于以下问题:C# IShellContext类的具体用法?C# IShellContext怎么用?C# IShellContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IShellContext类属于命名空间,在下文中一共展示了IShellContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DoRun

        protected override void DoRun(IShellContext context)
        {
            var db = GetDatabaseStructure(context);
            if (Table != null && Tables != null) throw new Exception("DBSH-00085 SetTableProperty: both of Table and tables attribute is set");
            if (Table == null && Tables == null) throw new Exception("DBSH-00086 SetTableProperty: none of Table and tables attribute is set");

            string value = context.Replace(Value);
            if (Table != null)
            {
                var table = db.FindTableLike(Table);
                if (table != null)
                {
                    table.Properties[Name] = value;
                }
            }
            if (Tables != null)
            {
                foreach (var table in db.Tables)
                {
                    if (Regex.Match(table.Name, Tables).Success)
                    {
                        table.Properties[Name] = value;
                    }
                }
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:26,代码来源:SetTableProperty.cs


示例2: DoRun

 protected override void DoRun(IShellContext context)
 {
     using (var conn = GetConnectionProvider(context).Connect())
     {
         GetModel(context).Prepare(conn);
     }
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:Prepare.cs


示例3: CdlFileWriter

 ICdlWriter ITabularDataTarget.CreateWriter(TableInfo rowFormat, CopyTableTargetOptions options, IShellContext context, DataFormatSettings sourceDataFormat)
 {
     string file = GetName(context);
     file = context.ResolveFile(file, ResolveFileMode.Output);
     context.OutputMessage("Writing file " + Path.GetFullPath(file));
     return new CdlFileWriter(file, rowFormat);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:CdlFile.cs


示例4: CdlFileReader

 ICdlReader ITabularDataSource.CreateReader(IShellContext context)
 {
     TableInfo table;
     BinaryReader br;
     OpenRead(out table, out br, context);
     return new CdlFileReader(table, br);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:CdlFile.cs


示例5: DoRun

 protected override void DoRun(IShellContext context)
 {
     var dbs = GetDatabaseStructure(context);
     var model = new DataSetModel(dbs, context, GetConnectionProvider(context).Factory);
     model.KeepUndefinedReferences = KeepUndefinedReferences;
     context.SetVariable(GetDataSetVariableName(context), model);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:DataSet.cs


示例6: DoRun

 protected override void DoRun(IShellContext context)
 {
     context.OutputMessage("Opening MS Excel");
     var model = ExcelModel.CreateNewWindow();
     model.DataFormat = DataFormat;
     context.SetVariable(GetExcelVariableName(context), model);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:NewWindow.cs


示例7: DoRun

 protected override void DoRun(IShellContext context)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Input);
     var model = ExcelModel.OpenFile(file);
     model.DataFormat = DataFormat;
     context.SetVariable(GetExcelVariableName(context), model);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:Open.cs


示例8: DataSetModel

 public DataSetModel(DatabaseInfo targetDatabase, IShellContext context, IDatabaseFactory factory)
 {
     _targetDatabase = targetDatabase;
     _context = context;
     _factory = factory;
     _dda = _factory.CreateDataAdapter();
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:DataSetModel.cs


示例9: DoRun

 protected override void DoRun(IShellContext context)
 {
     GetModel(context).LoadReference(
         new NameWithSchema(context.Replace(Schema), context.Replace(Table)),
         context.Replace(Column), 
         new NameWithSchema(context.Replace(RefSchema), context.Replace(RefTable)));
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:LoadReference.cs


示例10: CreateWriter

 public ICdlWriter CreateWriter(TableInfo rowFormat, CopyTableTargetOptions options, IShellContext context, DataFormatSettings sourceDataFormat)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
     var fw = new StreamWriter(file);
     var provider = GetConnectionProvider(context);
     return new SqlFileWriter(fw, provider.Factory);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:SqlDataWriter.cs


示例11: DoRun

 protected override void DoRun(IShellContext context)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
     if (Expression != null && Value != null) throw new Exception("DBSH-00078 SaveToFile: both Expression and Value is set");
     if (Expression == null && Value == null) throw new Exception("DBSH-00079 SaveToFile: none of Expression and Value is set");
     if (Expression != null)
     {
         object obj = context.Evaluate(Expression);
         if (obj is byte[])
         {
             var bytes = (byte[]) obj;
             using (var fw = System.IO.File.OpenWrite(file))
             {
                 fw.Write(bytes, 0, bytes.Length);
             }
         }
         else
         {
             using (var fw = new StreamWriter(file, false, Encoding))
             {
                 fw.Write(obj.ToString());
             }
         }
     }
     if (Value!=null)
     {
         string val = context.Replace(Value);
         using (var fw = new StreamWriter(file, false, Encoding))
         {
             fw.Write(val);
         }
     }
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:33,代码来源:SaveToFile.cs


示例12: RunContainer

        //public override void EnumChildren(Action<IShellElement> enumFunc)
        //{
        //    base.EnumChildren(enumFunc);
        //    foreach (var item in Commands) YieldChild(enumFunc, item);
        //}

        protected void RunContainer(IShellContext context)
        {
            foreach(var item in Commands)
            {
                item.Run(context);
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:13,代码来源:RunnableContainer.cs


示例13: OpenDbfRead

 private SocialExplorer.IO.FastDBF.DbfFile OpenDbfRead(IShellContext context)
 {
     var dbf = new SocialExplorer.IO.FastDBF.DbfFile(Encoding);
     var name = context.ResolveFile(context.Replace(Name), ResolveFileMode.Input);
     dbf.Open(name, System.IO.FileMode.Open);
     return dbf;
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:7,代码来源:DbfFile.cs


示例14: DoRun

 protected override void DoRun(IShellContext context)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
     context.OutputMessage("Writing file " + Path.GetFullPath(file));
     var model = ExcelModel.CreateFile(file);
     model.DataFormat = DataFormat;
     context.SetVariable(GetExcelVariableName(context), model);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:Create.cs


示例15: ColumnMapperReader

 public ColumnMapperReader(ICdlReader source, TableInfo outputFormat, List<IColumnMapping> columnMap, List<int> counts, IShellContext context )
     : base(outputFormat)
 {
     _source = source;
     _columnMap = columnMap;
     _counts = counts;
     _context = context;
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:ColumnMapperReader.cs


示例16: CreateSource

 private ITabularDataSource CreateSource(IShellContext context)
 {
     string name = GetName(context);
     if (name.ToLower().EndsWith(".cdl")) return new CdlFile {Connection = Connection, Name = name};
     if (name.ToLower().EndsWith(".csv")) return new CsvFile { Connection = Connection, Name = name };
     if (name.ToLower().EndsWith(".xml")) return new XmlReader { Connection = Connection, File = name, AnalyseColumns = true };
     throw new Exception("DBSH-00002 Unknown soruce file type:" + name);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:File.cs


示例17: using

 DataFormatSettings ITabularDataSource.GetSourceFormat(IShellContext context)
 {
     using (var childCtx = context.CreateChildContext())
     {
         childCtx.SetVariable(context.Replace(PropertyName), context.Replace(PrimaryFile));
         return SourceTemplate.GetSourceFormat(childCtx);
     }
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:DirectoryTabularDataSource.cs


示例18: DoRun

 protected override void DoRun(IShellContext context)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Input);
     var model = ShapeFileModel.OpenFile(file, SpatialTool.GetProjection(Projection, context));
     model.DataFormat = DataFormat;
     model.AddFileIdentifier = AddFileIdentifier;
     context.SetVariable(GetShpVariableName(context), model);
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:ShpOpen.cs


示例19: TargetEntitySqlModel

        public TargetEntitySqlModel(DataSyncSqlModel dataSyncSqlModel, Target dbsh, IShellContext context)
        {
            this._dataSyncSqlModel = dataSyncSqlModel;
            this._dbsh = dbsh;
            TargetTable = new NameWithSchema(context.Replace(dbsh.TableSchema), context.Replace(dbsh.TableName));
            string findSchema = dbsh.TableSchema;
            if (findSchema != null && findSchema.StartsWith(NameWithSchema.NoQuotePrefix)) findSchema = null;
            Structure = dataSyncSqlModel.TargetStructure.FindTableLike(findSchema, TargetTable.Name);
            SqlAlias = _dbsh.Alias ?? "dst_" + _dataSyncSqlModel.Entities.Count;

            foreach (var col in dbsh.Columns)
            {
                var targetCol = new TargetNoRefColumnSqlModel(col, FindColumnInfo(col.Name));
                TargetColumns.Add(targetCol);

                foreach (string alias in ExtractColumnSources(col))
                {
                    SourceColumnSqlModel source = null;
                    if (dataSyncSqlModel.SourceGraphModel == null)
                    {
                        // flat sync
                        if (!String.IsNullOrEmpty(dbsh.PrimarySource))
                        {
                            var tableSource = DataSync.FlatSources.FirstOrDefault(x => x.Match(Dbsh.PrimarySource));
                            if (tableSource != null)
                            {
                                source = tableSource.Columns.FirstOrDefault(x => x.Alias == alias);
                            }
                        }
                    }
                    else
                    {
                        source = dataSyncSqlModel.SourceGraphModel[alias];
                        //targetCol.Sources.Add(source);
                    }
                    RequiredSourceColumns.Add(source);
                    if (col.IsKey) KeySourceColumns.Add(source);
                }
            }

            if (!String.IsNullOrEmpty(_dbsh.Connection))
            {
                var ctxConn = new NormalizedDatabaseConnectionInfo(new DatabaseConnectionInfoHolder { ProviderString = context.GetDefaultConnection() });
                var tableConn = new NormalizedDatabaseConnectionInfo(new DatabaseConnectionInfoHolder { ProviderString = context.Replace(_dbsh.Connection), LinkedInfo = _dbsh.LinkedInfo });

                if (ctxConn != tableConn)
                {
                    if (ctxConn.ServerConnectionString == tableConn.ServerConnectionString)
                    {
                        TargetLinkedInfo = tableConn.GetLinkedInfo();
                    }
                    else
                    {
                        throw new IncorrectRdsDefinitionException($"DBSH-00000 RDS target must be reachable by database or linked server: ({TargetTable})");
                    }
                }
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:58,代码来源:TargetEntitySqlModel.cs


示例20: DoRun

 protected override void DoRun(IShellContext context)
 {
     string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
     context.OutputMessage("DBSH-00118 Exporting SQL file Writing " + file);
     using (var fw = new StreamWriter(file))
     {
         GetModel(context).WriteSql(fw);
     }
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:9,代码来源:WriteSql.cs



注:本文中的IShellContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IShellFolder类代码示例发布时间:2022-05-24
下一篇:
C# ISheet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap