本文整理汇总了C#中ObjectClass.GetRelations方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectClass.GetRelations方法的具体用法?C# ObjectClass.GetRelations怎么用?C# ObjectClass.GetRelations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectClass
的用法示例。
在下文中一共展示了ObjectClass.GetRelations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyPropertyMappings
protected virtual void ApplyPropertyMappings(ObjectClass cls)
{
if (cls.GetTableMapping() == TableMapping.TPH && cls.BaseObjectClass != null)
{
ApplyPropertyMappings(cls.BaseObjectClass);
}
var relevantRelations = cls.GetRelations() // Managed by a cache
.Where(r => (r.A.Type.ID == cls.ID && r.Storage == StorageType.MergeIntoA)
|| (r.B.Type.ID == cls.ID && r.Storage == StorageType.MergeIntoB))
.ToList()
.OrderBy(r => r.GetAssociationName());
foreach (var rel in relevantRelations)
{
string propertyName;
string columnName;
if (rel.A.Type == cls && rel.NeedsPositionStorage(RelationEndRole.A) && rel.A.Navigator != null)
{
propertyName = Construct.ListPositionPropertyName(rel.A);
columnName = Construct.ListPositionColumnName(rel.B);
this.WriteLine(" <ScalarProperty Name=\"{0}\" ColumnName=\"{1}\" />", propertyName, columnName);
}
if (rel.B.Type == cls && rel.NeedsPositionStorage(RelationEndRole.B) && rel.B.Navigator != null)
{
propertyName = Construct.ListPositionPropertyName(rel.B);
columnName = Construct.ListPositionColumnName(rel.A);
this.WriteLine(" <ScalarProperty Name=\"{0}\" ColumnName=\"{1}\" />", propertyName, columnName);
}
}
foreach (var prop in cls.Properties.OfType<ValueTypeProperty>().Where(p => !p.IsList).OrderBy(p => p.Name))
{
ModelMslEntityTypeMappingScalarProperty.Call(Host, ctx, prop, String.Empty);
}
foreach (var prop in cls.Properties.OfType<CompoundObjectProperty>().Where(p => !p.IsList).OrderBy(p => p.Name))
{
ModelMslEntityTypeMappingComplexProperty.Call(Host, ctx, prop, String.Empty);
}
}
示例2: NotifyDeleting
public static void NotifyDeleting(ObjectClass obj)
{
var ctx = obj.Context;
foreach (var ac in obj.AccessControlList)
{
ctx.Delete(ac);
}
foreach (var f in obj.FilterConfigurations)
{
ctx.Delete(f);
}
foreach (var cls in obj.SubClasses)
{
ctx.Delete(cls);
}
foreach (var rel in obj.GetRelations())
{
ctx.Delete(rel);
}
}