本文整理汇总了C#中ObjectReference.GetAlias方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference.GetAlias方法的具体用法?C# ObjectReference.GetAlias怎么用?C# ObjectReference.GetAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectReference
的用法示例。
在下文中一共展示了ObjectReference.GetAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCoreTable
private bool IsCoreTable(ObjectReference tableReference)
{
if (ReferenceEquals(tableReference, null)) throw new ArgumentNullException("tableReference");
if (!string.IsNullOrWhiteSpace(tableReference.GetAlias())) return false;
return _schema.FindTable(tableReference.GetName()) == _table;
}
示例2: TryFormatAsObjectReference
private string TryFormatAsObjectReference(ObjectReference objectReference, bool excludeAlias)
{
if (ReferenceEquals(objectReference, null)) return null;
var table = _schema.FindTable(objectReference.GetOwner().GetAllObjectNamesDotted());
var tableName = string.IsNullOrWhiteSpace(objectReference.GetOwner().GetAlias())
? table.QualifiedName
: _schema.QuoteObjectName(objectReference.GetOwner().GetAlias());
var column = table.FindColumn(objectReference.GetName());
if (excludeAlias || objectReference.GetAlias() == null)
{
return string.Format("{0}.{1}", tableName, column.QuotedName);
}
return string.Format("{0}.{1} AS {2}", tableName, column.QuotedName,
_schema.QuoteObjectName(objectReference.GetAlias()));
}
示例3: CreateJoinExpression
private SimpleExpression CreateJoinExpression(ObjectReference table, ForeignKey foreignKey, int columnIndex)
{
var masterObjectReference = ObjectReference.FromStrings(foreignKey.MasterTable.Name,
foreignKey.UniqueColumns[columnIndex]);
var detailObjectReference = ObjectReference.FromStrings(foreignKey.DetailTable.Name,
foreignKey.Columns[columnIndex]);
if (!string.IsNullOrWhiteSpace(table.GetAlias()))
{
if (detailObjectReference.GetOwner().GetName() == table.GetName())
detailObjectReference = new ObjectReference(detailObjectReference.GetName(), table);
else if (masterObjectReference.GetOwner().GetName() == table.GetName())
masterObjectReference = new ObjectReference(masterObjectReference.GetName(), table);
}
return masterObjectReference == detailObjectReference;
}