本文整理汇总了C#中ObjectReference.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference.GetName方法的具体用法?C# ObjectReference.GetName怎么用?C# ObjectReference.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectReference
的用法示例。
在下文中一共展示了ObjectReference.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetColumn
private Column GetColumn(ObjectReference reference)
{
if (ReferenceEquals(reference, null))
{
return null;
}
var table = _schema.FindTable(reference.GetOwner().ToString());
return table.FindColumn(reference.GetName());
}
示例2: 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);
}
示例3: 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()));
}
示例4: TryFormatAsObjectReference
private string TryFormatAsObjectReference(ObjectReference objectReference)
{
if (ReferenceEquals(objectReference, null)) return null;
if (_findTable == null)
{
return objectReference.GetName();
}
else
{
string associationPath;
Table table = GetOwnerTable(objectReference, out associationPath);
return FormatObjectPath(associationPath, table.FindColumn(objectReference.GetName()).ActualName);
}
}
示例5: 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;
}
示例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: 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;
}
示例8: 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);
}
示例9: SetMemberAsSchema
internal DynamicSchema SetMemberAsSchema(ObjectReference reference, DynamicSchema schema)
{
if (reference == null) throw new ArgumentNullException("reference");
_members.TryUpdate(reference.GetName(), schema, reference);
return (DynamicSchema) _members[reference.GetName()];
}
示例10: SetMemberAsTable
internal DynamicTable SetMemberAsTable(ObjectReference reference, DynamicTable table)
{
if (reference == null) throw new ArgumentNullException("reference");
_members.TryUpdate(reference.GetName(), table, reference);
return (DynamicTable) _members[reference.GetName()];
}
示例11: 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());
}
示例12: 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));
}
示例13: SetMemberAsSchema
internal DynamicSchema SetMemberAsSchema(ObjectReference reference)
{
if (ReferenceEquals(reference, null)) throw new ArgumentNullException("reference");
_members.TryUpdate(reference.GetName(), new DynamicSchema(reference.GetName(), this), reference);
return (DynamicSchema) _members[reference.GetName()];
}
示例14: TryFormatAsObjectReference
private string TryFormatAsObjectReference(ObjectReference objectReference)
{
if (ReferenceEquals(objectReference, null)) return null;
return objectReference.GetName();
}
示例15: BuildReferenceResolver
private static Func<XElement, object> BuildReferenceResolver(ObjectReference reference)
{
var resolver = BuildElementResolver(reference);
return xml => resolver(xml).TryGetAttribute(reference.GetName()).ConvertValue();
}