本文整理汇总了C#中IEdmNavigationProperty.GetPrimary方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmNavigationProperty.GetPrimary方法的具体用法?C# IEdmNavigationProperty.GetPrimary怎么用?C# IEdmNavigationProperty.GetPrimary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmNavigationProperty
的用法示例。
在下文中一共展示了IEdmNavigationProperty.GetPrimary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssociationNamespace
public static string GetAssociationNamespace(this IEdmModel model, IEdmNavigationProperty property)
{
EdmUtil.CheckArgumentNull<IEdmModel>(model, "model");
EdmUtil.CheckArgumentNull<IEdmNavigationProperty>(property, "property");
property.PopulateCaches();
string annotationValue = model.GetAnnotationValue<string>(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationNamespace");
if (annotationValue == null)
{
annotationValue = property.GetPrimary().DeclaringEntityType().Namespace;
}
return annotationValue;
}
示例2: GetAssociationNamespace
/// <summary>
/// Gets the namespace used for the association serialized for a navigation property.
/// </summary>
/// <param name="model">Model containing the navigation property.</param>
/// <param name="property">The navigation property.</param>
/// <returns>The association namespace.</returns>
public static string GetAssociationNamespace(this IEdmModel model, IEdmNavigationProperty property)
{
EdmUtil.CheckArgumentNull(model, "model");
EdmUtil.CheckArgumentNull(property, "property");
property.PopulateCaches();
string associationNamespace = model.GetAnnotationValue<string>(property, EdmConstants.InternalUri, CsdlConstants.AssociationNamespaceAnnotation);
if (associationNamespace == null)
{
associationNamespace = property.GetPrimary().DeclaringEntityType().Namespace;
}
return associationNamespace;
}
示例3: GetAssociationName
public static string GetAssociationName(this IEdmModel model, IEdmNavigationProperty property)
{
EdmUtil.CheckArgumentNull<IEdmModel>(model, "model");
EdmUtil.CheckArgumentNull<IEdmNavigationProperty>(property, "property");
property.PopulateCaches();
string annotationValue = model.GetAnnotationValue<string>(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationName");
if (annotationValue == null)
{
IEdmNavigationProperty primary = property.GetPrimary();
IEdmNavigationProperty partner = primary.Partner;
annotationValue = string.Concat(SerializationExtensionMethods.GetQualifiedAndEscapedPropertyName(partner), (char)95, SerializationExtensionMethods.GetQualifiedAndEscapedPropertyName(primary));
}
return annotationValue;
}
示例4: GetAssociationName
/// <summary>
/// Gets the name used for the association serialized for a navigation property.
/// </summary>
/// <param name="model">Model containing the navigation property.</param>
/// <param name="property">The navigation property.</param>
/// <returns>The association name.</returns>
public static string GetAssociationName(this IEdmModel model, IEdmNavigationProperty property)
{
EdmUtil.CheckArgumentNull(model, "model");
EdmUtil.CheckArgumentNull(property, "property");
property.PopulateCaches();
string associationName = model.GetAnnotationValue<string>(property, EdmConstants.InternalUri, CsdlConstants.AssociationNameAnnotation);
if (associationName == null)
{
IEdmNavigationProperty fromPrincipal = property.GetPrimary();
IEdmNavigationProperty toPrincipal = fromPrincipal.Partner;
associationName =
GetQualifiedAndEscapedPropertyName(toPrincipal) +
AssociationNameEscapeChar +
GetQualifiedAndEscapedPropertyName(fromPrincipal);
}
return associationName;
}