本文整理汇总了C#中ObjectReference.GetOwner方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference.GetOwner方法的具体用法?C# ObjectReference.GetOwner怎么用?C# ObjectReference.GetOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectReference
的用法示例。
在下文中一共展示了ObjectReference.GetOwner方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InferJoinExpression
private SimpleExpression InferJoinExpression(ObjectReference table)
{
if (table.GetOwner().IsNull()) return null;
var table1 = _schema.FindTable(table.GetOwner().GetName());
var table2 = _schema.FindTable(table.GetName());
var foreignKey = GetForeignKey(table1, table2);
return MakeJoinExpression(table, foreignKey);
}
示例2: GetColumn
private Column GetColumn(ObjectReference reference)
{
if (ReferenceEquals(reference, null))
{
return null;
}
var table = _schema.FindTable(reference.GetOwner().ToString());
return table.FindColumn(reference.GetName());
}
示例3: ResolveSubs
private IEnumerable<object> ResolveSubs(IDictionary<string, object> dict, ObjectReference objectReference, string key)
{
if (objectReference.IsNull()) return Enumerable.Empty<object>();
if (dict.ContainsKey(objectReference.GetName()))
{
var master = dict[objectReference.GetName()] as IDictionary<string,object>;
if (master != null)
{
if (master.ContainsKey(key))
{
return new[] {master[key]};
}
}
var detail = dict[objectReference.GetName()] as IEnumerable<IDictionary<string, object>>;
if (detail != null)
{
return detail.SelectMany(d => Resolve(d, objectReference, key));
}
}
return ResolveSubs(dict, objectReference.GetOwner(), key);
}
示例4: 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()));
}
示例5: GetOwnerTable
private Table GetOwnerTable(ObjectReference objectReference, out string associationPath)
{
associationPath = string.Empty;
var owner = objectReference.GetOwner();
if (ReferenceEquals(owner, null))
return null;
if (ReferenceEquals(owner.GetOwner(), null))
return _findTable(owner.GetName());
var table = GetOwnerTable(owner, out associationPath);
var association = table.FindAssociation(owner.GetName());
associationPath = FormatObjectPath(associationPath, association.ActualName);
return _findTable(association.ReferenceTableName);
}
示例6: AddWithAlias
private ObjectReference AddWithAlias(ObjectReference c, RelationType relationType = RelationType.None)
{
if (relationType == RelationType.None)
relationType = _schema.GetRelationType(c.GetOwner().GetOwner().GetName(), c.GetOwner().GetName());
if (relationType == RelationType.None) throw new InvalidOperationException("No Join found");
return c.As(string.Format("__with{0}__{1}__{2}",
relationType == RelationType.OneToMany
? "n"
: "1", c.GetOwner().GetAliasOrName(), c.GetName()));
}
示例7: ObjectReferenceIsInJoinClause
private static bool ObjectReferenceIsInJoinClause(JoinClause clause, ObjectReference reference)
{
return reference.GetOwner().GetAliasOrName().Equals(clause.Table.GetAliasOrName());
}
示例8: GetFullName
internal static string GetFullName(ObjectReference reference)
{
var names = new Stack<string>();
string name;
while (!ReferenceEquals(reference.GetOwner(), null))
{
name = reference.GetName();
name = name == "Id" || name == "id" ? "_id" : name;
names.Push(name);
reference = reference.GetOwner();
}
return string.Join(".", names.ToArray());
}
示例9: TryFormatAsObjectReference
private string TryFormatAsObjectReference(ObjectReference objectReference)
{
if (ReferenceEquals(objectReference, null)) return null;
var table = _schema.FindTable(objectReference.GetOwner().GetName());
var column = table.FindColumn(objectReference.GetName());
if (objectReference.Alias == null)
return string.Format("{0}.{1}", table.QualifiedName, column.QuotedName);
else
return string.Format("{0}.{1} AS {2}", table.QualifiedName, column.QuotedName,
_schema.QuoteObjectName(objectReference.Alias));
}
示例10: IsTableChain
private bool IsTableChain(string tableName, ObjectReference o)
{
var ownerName = tableName.Contains(".") ? o.GetOwner().GetAllObjectNamesDotted() : o.GetOwner().GetName();
return (!ownerName.Equals(tableName, StringComparison.InvariantCultureIgnoreCase)) && _schema.IsTable(ownerName);
}