当前位置: 首页>>代码示例>>C#>>正文


C# IContext.WriteVerbose方法代码示例

本文整理汇总了C#中IContext.WriteVerbose方法的典型用法代码示例。如果您正苦于以下问题:C# IContext.WriteVerbose方法的具体用法?C# IContext.WriteVerbose怎么用?C# IContext.WriteVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContext的用法示例。


在下文中一共展示了IContext.WriteVerbose方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveItem

        public void RemoveItem(IContext context, string path, bool recurse)
        {
            var ddl = "DROP TABLE " + path;
            context.WriteVerbose( ddl );

            var cmd = _context.CreateCommand(ddl);
            cmd.ExecuteNonQuery();
        }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:SQLiteTableNodeFactory.cs

示例2: RemoveItem

        public void RemoveItem(IContext context, string path, bool recurse)
        {
            var factory = new DynamicParametersFactory(_context, _record.Table.TableName);
            var sql = factory.ToDeleteRecord( PrimaryKey );

            context.WriteVerbose("DELETE SQL: " + sql);
            _context.Execute(sql);
        }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:SQLiteRecordNodeFactory.cs

示例3: SetItem

        public IPathNode SetItem(IContext context, string path, object value)
        {
            var factory = new DynamicParametersFactory(_context, _record.Table.TableName);

            //TODO: invert sql generation and parameter snooping to update only specified fields
            var cmd = factory.ToUpdate();

            context.WriteVerbose("UPDATE SQL: " + cmd.CommandText);
            
            factory.Parameterize(cmd, PrimaryKey, value, context.DynamicParameters as RuntimeDefinedParameterDictionary);

            cmd.ExecuteNonQuery();
            return GetNodeValue();
        }
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:SQLiteRecordNodeFactory.cs

示例4: GetNodeChildren

        public override IEnumerable<INodeFactory> GetNodeChildren( IContext context )
        {
            var filter = context.Filter;
            var sql = "SELECT * FROM " + Name;
            if( ! String.IsNullOrEmpty( filter ) )
            {
                sql += " WHERE ( " + filter + " )";
            }
            var command = new SqliteCommand(sql , _context.Connection);
            var table = new DataTable( Name );
            
            context.WriteVerbose( sql );
            using( var data = new SqliteDataAdapter(command) )
            {
                data.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                data.Fill(table);
            }

            foreach( DataRow row in table.Rows )
            {
                yield return new SQLiteRecordNodeFactory( _context, row);
            }
        }
开发者ID:nickchal,项目名称:pash,代码行数:23,代码来源:SQLiteTableNodeFactory.cs

示例5: NewItem

        public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue)
        {
            var parameterDictionary = context.DynamicParameters as RuntimeDefinedParameterDictionary;
            var value = newItemValue.ToPSObject();
            
            var factory = new DynamicParametersFactory(_context, Name);
            var command = factory.ToInsert();
            
            context.WriteVerbose( "INSERT SQL: " + command.CommandText );

            factory.Parameterize(command, value, parameterDictionary);

            foreach (SqliteParameter param in command.Parameters)
            {
                context.WriteVerbose("PARAMETERS: @" + param.ParameterName + " = [" + param.Value + "]");
            }

            var id = command.ExecuteScalar();
            
            return Resolve(context, id.ToString()).First().GetNodeValue();
        }
开发者ID:nickchal,项目名称:pash,代码行数:21,代码来源:SQLiteTableNodeFactory.cs

示例6: InvokeItem

        public IEnumerable<object> InvokeItem(IContext context, string path)
        {
            InvokeItemParameters parameters =
                context.DynamicParameters as InvokeItemParameters;

            var filter = context.Filter;
            var sql = parameters.Sql;
            if (String.IsNullOrEmpty(sql))
            {
                return null;
            }

            var command = new SqliteCommand(sql, _context.Connection);
            context.WriteVerbose(sql);
            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    PSObject record = new PSObject();
                    for (int c = 0; c < reader.FieldCount; ++c)
                    {
                        var name = reader.GetName(c);
                        var value = reader.GetValue(c);
                        record.Properties.Add(new PSNoteProperty(name, value));
                    }

                    context.WriteItemObject(record, path, false);
                    //yield return new SQLiteRecordNodeFactory(_sqliteContext, reader.);
                }
            }

            return null;
        }
开发者ID:nickchal,项目名称:pash,代码行数:33,代码来源:SQLiteTableNodeFactory.cs

示例7: NewItem

        public IPathNode NewItem(IContext context, string path, string itemTypeName, object newItemValue)
        {
            string ddl = newItemValue as string;
            var schema = newItemValue as Hashtable;
            var parameters = context.DynamicParameters as NewTableParameters;
			path = RemoveInvalidChars (path);
            if( null != ddl)
            {
                ddl = String.Format(@"CREATE TABLE {0} ( {1} )", path, ddl);
            }
            else if (null != schema)
            {
                var coldefs = ConvertToColumnDefinitionDDL(schema);
                ddl = String.Format(@"CREATE TABLE {0} ( {1} )", path, coldefs);
            }
            else if( null != parameters)
            {
                var coldefs = ConvertToColumnDefinitionDDL(parameters);
                ddl = String.Format(@"CREATE TABLE {0} ( {1} )", path, coldefs);
            }

            if ( null == ddl )
            {
                throw new ArgumentException(
                    @"The new table schema must be specified as a DDL string, a hashtable of column names associated with SQLite DDL strings, or as individual parameters.  For instance:
new-item mydb:/tableOfNames -value @{ 
    id = 'INTEGER PRIMARY KEY';
    name = 'TEXT NOT NULL';
    ...
}

or

new-item mydb:/tableOfNames -value 'id INTEGER PRIMARY KEY, name TEXT NOT NULL'

or

new-item mydb:/tableOfNames -id INTEGER PRIMARY KEY -name TEXT NOT NULL
",
                    "newItemValue"
                );
            } 
                        
            context.WriteVerbose(ddl);

            var cmd = _sqliteContext.CreateCommand(ddl);
            cmd.ExecuteNonQuery();

            var node = Resolve(context, path);
            if( null == node || ! node.Any() )
            {
                throw new InvalidOperationException( "Failed to create new table " + path );
            }
            return node.First().GetNodeValue();
        }
开发者ID:nickchal,项目名称:pash,代码行数:55,代码来源:SQLiteRootNodeFactory.cs

示例8: NewChildItem

        protected IPathNode NewChildItem(string thisCodeItemTypeName, IEnumerable<string> newItemTypeNames,
                                         IContext context, string path, string itemTypeName, object newItemValue)
        {
            if (!newItemTypeNames.Contains(itemTypeName, StringComparer.InvariantCultureIgnoreCase))
            {
                WriteNotSupportedItemTypeError(thisCodeItemTypeName, context, itemTypeName, path);

                return null;
            }

            object item = null;
            var p = context.DynamicParameters as NewCodeElementItemParams;

            switch (itemTypeName.ToLowerInvariant())
            {
                case CodeItemTypes.Attribute:
                    item = NewAttribute(p, path, newItemValue);
                    break;
                case CodeItemTypes.Class:
                    item = NewClass(p, path);
                    break;
                case CodeItemTypes.Delegate:
                    item = NewDelegate(p, path);
                    break;
                case CodeItemTypes.Enum:
                    item = NewEnum(p, path);
                    break;
                case CodeItemTypes.Event:
                    item = NewEvent(p, path);
                    break;
                case CodeItemTypes.Method:
                    p.MemberType = p.MemberType ?? "void";
                    item = NewMethod(p, path);
                    break;
                case CodeItemTypes.Property:
                    if (!(p.Set || p.Get))
                    {
                        context.WriteVerbose( "using new-item to create a new property element, but neither -get nor -set are supplied; assuming you want both -get and -set");
                        p.Get = p.Set = true;
                    }
                    item = NewProperty(p, path);
                    break;
                case CodeItemTypes.Struct:
                    item = NewStruct(p, path);
                    break;
                case CodeItemTypes.Variable:
                    item = NewVariable(p, path, newItemValue);
                    break;
                case CodeItemTypes.Parameter:
                    item = NewParameter(p, path, newItemValue);
                    break;
                case CodeItemTypes.Namespace:
                    item = NewNamespace(p, path);
                    break;
                case CodeItemTypes.Interface:
                    item = NewInterface(p, path);
                    break;

                default:
                    item = null;
                    break;
            }

            if (null == item)
            {
                WriteNotSupportedItemTypeError(thisCodeItemTypeName, context, itemTypeName, path);

                return null;
            }

            var shellItem = ShellObjectFactory.CreateFromCodeElement(item as CodeElement);
            return new PathNode(shellItem, shellItem.Name, shellItem.IsContainer);
        }
开发者ID:wangchunlei,项目名称:MyGit,代码行数:73,代码来源:CodeElementWithChildrenNodeFactory.cs


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