本文整理汇总了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));
}
}