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


C# IConnector.GetPhysicalTableName方法代码示例

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


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

示例1: SetMaxLengthOnTextBoxes

		/// <summary>
		/// Atribui a propriedade MaxLength de todos os <see cref="TextBox"/>es filhos de um controle.
		/// </summary>
		/// <param name="parent">O controle a partir de onde serão atribuidas as propriedades <c>MaxLength</c>.</param>
		/// <param name="connector">O <see cref="IConnector"/></param>
		/// <param name="mdCache">O objeto <see cref="DbMetadataCache"/> utilizado para buscar as informações sobre as tabelas</param>
		/// <param name="defaultTableName">O nome da tabela</param>
		public static void SetMaxLengthOnTextBoxes(Control parent, IConnector connector, DbMetadataCache mdCache, string defaultTableName)
		{
			var rx = new Regex(@"(?<t>[^.]+)\.(?<f>[^.]+)", RegexOptions.ExplicitCapture | RegexOptions.Compiled);
			Match m;

			if (connector != null)
				defaultTableName = connector.GetPhysicalTableName(defaultTableName);

			foreach (TextBox txt in SelectControls(parent, new TypeCondition(typeof(TextBox))))
				if (txt.Enabled && !txt.ReadOnly && txt.ID != null && txt.ID.Length > 3)
				{
					var dbRelated = txt as IDatabaseFieldRelated;
					if (dbRelated != null && dbRelated.DatabaseField != null && (m = rx.Match(dbRelated.DatabaseField)).Success)
					{
						string table = m.Groups["t"].Value;
						string field = m.Groups["f"].Value;
						if (connector != null)
							table = connector.GetPhysicalTableName(table);
						txt.MaxLength = mdCache.MaxLength(table, field);
						continue;
					}
					txt.MaxLength = mdCache.MaxLength(defaultTableName, txt.ID.Substring(3));
				}
		}
开发者ID:elementar,项目名称:Suprifattus.Util,代码行数:31,代码来源:WebUtil.cs


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