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


C# Dialect.GetAddForeignKeyConstraintString方法代码示例

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


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

示例1: SqlConstraintString

		/// <summary>
		/// Generates the SQL string to create the named Foreign Key Constraint in the database.
		/// </summary>
		/// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
		/// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param>
		/// <param name="defaultSchema"></param>
		/// <param name="defaultCatalog"></param>
		/// <returns>
		/// A string that contains the SQL to create the named Foreign Key Constraint.
		/// </returns>
		public override string SqlConstraintString(Dialect.Dialect d, string constraintName, string defaultCatalog, string defaultSchema)
		{
			string[] cols = new string[ColumnSpan];
			string[] refcols = new string[ColumnSpan];
			int i = 0;
			IEnumerable<Column> refiter;
			if (IsReferenceToPrimaryKey)
				refiter = referencedTable.PrimaryKey.ColumnIterator;
			else
				refiter = referencedColumns;
			foreach (Column column in ColumnIterator)
			{
				cols[i] = column.GetQuotedName(d);
				i++;
			}

			i = 0;
			foreach (Column column in refiter)
			{
				refcols[i] = column.GetQuotedName(d);
				i++;
			}
			string result = d.GetAddForeignKeyConstraintString(constraintName, cols, referencedTable.GetQualifiedName(d, defaultCatalog, defaultSchema), refcols, IsReferenceToPrimaryKey);
			return cascadeDeleteEnabled && d.SupportsCascadeDelete ? result + " on delete cascade" : result;
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:35,代码来源:ForeignKey.cs

示例2: SqlConstraintString

		/// <summary>
		/// Generates the SQL string to create the named Foreign Key Constraint in the database.
		/// </summary>
		/// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
		/// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param>
		/// <param name="defaultSchema"></param>
		/// <returns>
		/// A string that contains the SQL to create the named Foreign Key Constraint.
		/// </returns>
		public override string SqlConstraintString( Dialect.Dialect d, string constraintName, string defaultSchema )
		{
			string[ ] cols = new string[ColumnSpan];
			string[ ] refcols = new string[ColumnSpan];
			int i = 0;

			foreach( Column col in referencedTable.PrimaryKey.ColumnCollection )
			{
				refcols[ i ] = col.GetQuotedName( d );
				i++;
			}

			i = 0;
			foreach( Column col in ColumnCollection )
			{
				cols[ i ] = col.GetQuotedName( d );
				i++;
			}

			return d.GetAddForeignKeyConstraintString( constraintName, cols, referencedTable.GetQualifiedName( d, defaultSchema ), refcols );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:30,代码来源:ForeignKey.cs


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