當前位置: 首頁>>代碼示例>>C#>>正文


C# SqlStringBuilder.RemoveAt方法代碼示例

本文整理匯總了C#中NHibernate.SqlCommand.SqlStringBuilder.RemoveAt方法的典型用法代碼示例。如果您正苦於以下問題:C# SqlStringBuilder.RemoveAt方法的具體用法?C# SqlStringBuilder.RemoveAt怎麽用?C# SqlStringBuilder.RemoveAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.SqlCommand.SqlStringBuilder的用法示例。


在下文中一共展示了SqlStringBuilder.RemoveAt方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RemoveAt

		public void RemoveAt() 
		{
			SqlStringBuilder builder = new SqlStringBuilder();

			builder.Add("   select * ");
			builder.Add("from table");
			Assert.AreEqual( "   select * from table", builder.ToSqlString().ToString() );

			builder.RemoveAt(0);
			Assert.AreEqual( "from table", builder.ToSqlString().ToString(), "Removed the first element in the SqlStringBuilder" );

			builder.Insert(0, "SELECT * ");
			Assert.AreEqual( "SELECT * from table", builder.ToSqlString().ToString() );
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:14,代碼來源:SqlStringBuilderFixture.cs

示例2: ToGroupSqlString

		public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery,
												   IDictionary<string, IFilter> enabledFilters)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			foreach (IProjection projection in args)
			{
				if (projection.IsGrouped)
				{
					buf.Add(projection.ToGroupSqlString(criteria, criteriaQuery, enabledFilters)).Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			return buf.ToSqlString();
		}
開發者ID:snbbgyth,項目名稱:WorkFlowEngine,代碼行數:17,代碼來源:SqlFunctionProjection.cs

示例3: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			for (int i = 0; i < Length; i++)
			{
				IProjection proj = this[i];
				if (proj.IsGrouped)
				{
					buf.Add(proj.ToGroupSqlString(criteria, criteriaQuery,enabledFilters))
						.Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			return buf.ToSqlString();
		}
開發者ID:hazzik,項目名稱:nh-contrib-everything,代碼行數:18,代碼來源:ProjectionList.cs

示例4: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			for (int i = 0; i < Length; i++)
			{
				IProjection proj = this[i];
				if (proj.IsGrouped)
				{
					buf.Add(proj.ToGroupSqlString(criteria, criteriaQuery))
						.Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			//if (buf.Length > 2) buf.Length = buf.Length - 2; //pull off the last ", "
			return buf.ToSqlString();
		}
開發者ID:Novthirteen,項目名稱:sconit_timesseiko,代碼行數:19,代碼來源:ProjectionList.cs

示例5: OrderBy

		/// <summary>
		/// Get the order by string required for collection fetching
		/// </summary>
		protected SqlString OrderBy(IList<OuterJoinableAssociation> associations)
		{
			SqlStringBuilder buf = new SqlStringBuilder();

			OuterJoinableAssociation last = null;
			foreach (OuterJoinableAssociation oj in associations)
			{
				if (oj.JoinType == JoinType.LeftOuterJoin)
				{
					if (oj.Joinable.IsCollection)
					{
						IQueryableCollection queryableCollection = (IQueryableCollection)oj.Joinable;
						if (queryableCollection.HasOrdering)
						{
							string orderByString = queryableCollection.GetSQLOrderByString(oj.RHSAlias);
							buf.Add(orderByString).Add(StringHelper.CommaSpace);
						}
					}
					else
					{
						// it might still need to apply a collection ordering based on a
						// many-to-many defined order-by...
						if (last != null && last.Joinable.IsCollection)
						{
							IQueryableCollection queryableCollection = (IQueryableCollection)last.Joinable;
							if (queryableCollection.IsManyToMany && last.IsManyToManyWith(oj))
							{
								if (queryableCollection.HasManyToManyOrdering)
								{
									string orderByString = queryableCollection.GetManyToManyOrderByString(oj.RHSAlias);
									buf.Add(orderByString).Add(StringHelper.CommaSpace);
								}
							}
						}
					}
				}
				last = oj;
			}

			if (buf.Count > 0) {
				buf.RemoveAt(buf.Count-1);
			}

			return buf.ToSqlString();
		}
開發者ID:rbirkby,項目名稱:nhibernate-core,代碼行數:48,代碼來源:JoinWalker.cs

示例6: BuildSubstring

		private SqlStringBuilder BuildSubstring(int startIndex)
		{
			SqlStringBuilder builder = new SqlStringBuilder(this);

			int offset = 0;

			while (builder.Count > 0)
			{
				int nextOffset = offset + LengthOfPart(builder[0]);

				if (nextOffset > startIndex)
				{
					break;
				}

				builder.RemoveAt(0);
				offset = nextOffset;
			}

			if (builder.Count > 0 && offset < startIndex)
			{
				builder[0] = ((string) builder[0]).Substring(startIndex - offset);
			}

			return builder;
		}
開發者ID:remcoros,項目名稱:nhibernate,代碼行數:26,代碼來源:SqlString.cs

示例7: Substring

		/// <summary>
		/// Retrieves a substring from this instance. The substring starts at a specified character position. 
		/// </summary>
		/// <param name="startIndex">The starting character position of a substring in this instance.</param>
		/// <returns>
		/// A new SqlString to the substring that begins at startIndex in this instance. 
		/// </returns>
		/// <remarks>
		/// If the first SqlPart is a Parameter then no action is taken and a copy of the SqlString is
		/// returned.
		/// 
		/// If the startIndex is greater than the length of the strings before the first SqlPart that
		/// is a Parameter then all of the strings will be removed and the first SqlPart returned
		/// will be the Parameter. 
		/// </remarks>
		public SqlString Substring( int startIndex )
		{
			SqlStringBuilder builder = new SqlStringBuilder( Compact() );

			string part = builder[ 0 ] as string;

			// if the first part is null then it is not a string so just
			// return them the compacted version
			if( part != null )
			{
				if( part.Length < startIndex )
				{
					builder.RemoveAt( 0 );
				}
				else
				{
					builder[ 0 ] = part.Substring( startIndex );
				}
			}

			return builder.ToSqlString();
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:37,代碼來源:SqlString.cs


注:本文中的NHibernate.SqlCommand.SqlStringBuilder.RemoveAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。