本文整理汇总了C#中IEdmNavigationProperty类的典型用法代码示例。如果您正苦于以下问题:C# IEdmNavigationProperty类的具体用法?C# IEdmNavigationProperty怎么用?C# IEdmNavigationProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEdmNavigationProperty类属于命名空间,在下文中一共展示了IEdmNavigationProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AppendNavigationPropertySegment
/// <summary>
/// Build a segment representing a navigation property.
/// </summary>
/// <param name="path">Path to perform the computation on.</param>
/// <param name="navigationProperty">The navigation property this segment represents.</param>
/// <param name="navigationSource">The navigation source of the entities targetted by this navigation property. This can be null.</param>
/// <returns>The ODataPath with navigation property appended in the end in the end</returns>
public static ODataPath AppendNavigationPropertySegment(this ODataPath path, IEdmNavigationProperty navigationProperty, IEdmNavigationSource navigationSource)
{
var newPath = new ODataPath(path);
NavigationPropertySegment np = new NavigationPropertySegment(navigationProperty, navigationSource);
newPath.Add(np);
return newPath;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:14,代码来源:ODataPathExtensions.cs
示例2: ODataSerializerContext
/// <summary>
/// Initializes a new instance of the <see cref="ODataSerializerContext"/> class.
/// </summary>
/// <param name="entity">The entity whose navigation property is being expanded.</param>
/// <param name="selectExpandClause">The <see cref="SelectExpandClause"/> for the navigation property being expanded.</param>
/// <param name="navigationProperty">The navigation property being expanded.</param>
/// <remarks>This constructor is used to construct the serializer context for writing expanded properties.</remarks>
public ODataSerializerContext(EntityInstanceContext entity, SelectExpandClause selectExpandClause, IEdmNavigationProperty navigationProperty)
{
if (entity == null)
{
throw Error.ArgumentNull("entity");
}
if (navigationProperty == null)
{
throw Error.ArgumentNull("navigationProperty");
}
ODataSerializerContext context = entity.SerializerContext;
Request = context.Request;
Url = context.Url;
EntitySet = context.EntitySet;
Model = context.Model;
Path = context.Path;
RootElementName = context.RootElementName;
SkipExpensiveAvailabilityChecks = context.SkipExpensiveAvailabilityChecks;
MetadataLevel = context.MetadataLevel;
ExpandedEntity = entity;
SelectExpandClause = selectExpandClause;
NavigationProperty = navigationProperty;
EntitySet = context.EntitySet.FindNavigationTarget(navigationProperty);
}
开发者ID:RhysC,项目名称:aspnetwebstack,代码行数:34,代码来源:ODataSerializerContext.cs
示例3: FindNavigationTarget
/// <summary>
/// Finds the navigation source that a navigation property targets.
/// </summary>
/// <param name="property">The navigation property.</param>
/// <returns>The navigation source that the navigation propertion targets, or null if no such navigation source exists.</returns>
public virtual IEdmNavigationSource FindNavigationTarget(IEdmNavigationProperty property)
{
EdmUtil.CheckArgumentNull(property, "property");
if (!property.ContainsTarget)
{
IEdmNavigationSource result;
if (this.navigationPropertyMappings.TryGetValue(property, out result))
{
return result;
}
}
else
{
return EdmUtil.DictionaryGetOrUpdate(
this.containedNavigationPropertyCache,
property,
navProperty => new EdmContainedEntitySet(this, navProperty));
}
return EdmUtil.DictionaryGetOrUpdate(
this.unknownNavigationPropertyCache,
property,
navProperty => new EdmUnknownEntitySet(this, navProperty));
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:30,代码来源:EdmNavigationSource.cs
示例4: GenerateNavigationPropertyLink
internal static Uri GenerateNavigationPropertyLink(EntityInstanceContext entityContext, IEdmNavigationProperty navigationProperty, EntitySetConfiguration configuration, bool includeCast)
{
string routeName;
Dictionary<string, object> routeValues = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
routeValues.Add(LinkGenerationConstants.Controller, configuration.Name);
routeValues.Add(LinkGenerationConstants.ParentId, ConventionsHelpers.GetEntityKeyValue(entityContext, configuration.EntityType));
routeValues.Add(LinkGenerationConstants.NavigationProperty, navigationProperty.Name);
if (includeCast)
{
routeName = ODataRouteNames.PropertyNavigationWithCast;
routeValues.Add(LinkGenerationConstants.Entitytype, entityContext.EntityType.FullName());
}
else
{
routeName = ODataRouteNames.PropertyNavigation;
}
string link = entityContext.UrlHelper.Link(routeName, routeValues);
if (link == null)
{
throw Error.InvalidOperation(SRResources.NavigationPropertyRouteMissingOrIncorrect, navigationProperty.Name, ODataRouteNames.PropertyNavigation);
}
return new Uri(link);
}
开发者ID:cubski,项目名称:aspnetwebstack,代码行数:28,代码来源:NavigationLinksGenerationConvention.cs
示例5: GenerateNavigationPropertyLink
/// <summary>
/// Generates a navigation link following the OData URL conventions for the entity represented by <paramref name="entityContext"/> and the given
/// navigation property.
/// </summary>
/// <param name="entityContext">The <see cref="EntityInstanceContext"/> representing the entity for which the navigation link needs to be generated.</param>
/// <param name="navigationProperty">The EDM navigation property.</param>
/// <param name="includeCast">Represents whether the generated link should have a cast segment representing a type cast.</param>
/// <returns>The navigation link following the OData URL conventions.</returns>
public static Uri GenerateNavigationPropertyLink(this EntityInstanceContext entityContext, IEdmNavigationProperty navigationProperty, bool includeCast)
{
if (entityContext == null)
{
throw Error.ArgumentNull("entityContext");
}
if (entityContext.Url == null)
{
throw Error.Argument("entityContext", SRResources.UrlHelperNull, typeof(EntityInstanceContext).Name);
}
List<ODataPathSegment> navigationPathSegments = new List<ODataPathSegment>();
navigationPathSegments.Add(new EntitySetPathSegment(entityContext.EntitySet));
navigationPathSegments.Add(new KeyValuePathSegment(ConventionsHelpers.GetEntityKeyValue(entityContext)));
if (includeCast)
{
navigationPathSegments.Add(new CastPathSegment(entityContext.EntityType));
}
navigationPathSegments.Add(new NavigationPathSegment(navigationProperty));
string link = entityContext.Url.CreateODataLink(navigationPathSegments);
if (link == null)
{
return null;
}
return new Uri(link);
}
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:38,代码来源:LinkGenerationHelpers.cs
示例6: ODataAtomReaderNavigationLinkDescriptor
/// <summary>
/// Constructor.
/// </summary>
/// <param name="navigationLink">The navigation link.</param>
/// <param name="navigationProperty">The navigation property for the link, if it's available.</param>
internal ODataAtomReaderNavigationLinkDescriptor(ODataNavigationLink navigationLink, IEdmNavigationProperty navigationProperty)
{
Debug.Assert(navigationLink != null, "navigationLink != null");
this.navigationLink = navigationLink;
this.navigationProperty = navigationProperty;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:ODataAtomReaderNavigationLinkDescriptor.cs
示例7: ODataAtomReaderNavigationLinkDescriptor
/// <summary>
/// Constructor.
/// </summary>
/// <param name="navigationLink">The navigation link.</param>
/// <param name="navigationProperty">The navigation property for the link, if it's available.</param>
internal ODataAtomReaderNavigationLinkDescriptor(ODataNavigationLink navigationLink, IEdmNavigationProperty navigationProperty)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(navigationLink != null, "navigationLink != null");
this.navigationLink = navigationLink;
this.navigationProperty = navigationProperty;
}
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:13,代码来源:ODataAtomReaderNavigationLinkDescriptor.cs
示例8: NavigationMetadata
internal NavigationMetadata(IEdmNavigationProperty edmNavigationProperty, IEntitySetMetadata targetEntitySet)
{
Contract.Assert(edmNavigationProperty != null);
Contract.Assert(targetEntitySet != null);
EdmNavigationProperty = edmNavigationProperty;
TargetEntitySet = targetEntitySet;
}
开发者ID:mdabbagh88,项目名称:ODataServer,代码行数:8,代码来源:NavigationMetadata.cs
示例9: ODataJsonLightReaderNavigationLinkInfo
/// <summary>
/// Constructor.
/// </summary>
/// <param name="navigationLink">The navigation link to report.</param>
/// <param name="navigationProperty">The navigation property for which the link will be reported.</param>
/// <param name="isExpanded">true if the navigation link is expanded.</param>
private ODataJsonLightReaderNavigationLinkInfo(ODataNavigationLink navigationLink, IEdmNavigationProperty navigationProperty, bool isExpanded)
{
Debug.Assert(navigationLink != null, "navigationLink != null");
Debug.Assert(navigationProperty == null || navigationProperty.Name == navigationLink.Name, "The name of the navigation link doesn't match the name of the property.");
this.navigationLink = navigationLink;
this.navigationProperty = navigationProperty;
this.isExpanded = isExpanded;
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:ODataJsonLightReaderNavigationLinkInfo.cs
示例10: EdmUnknownEntitySet
/// <summary>
/// Initializes a new instance of the <see cref="EdmUnknownEntitySet"/> class.
/// </summary>
/// <param name="parentNavigationSource">The <see cref="IEdmNavigationSource"/> that container element belongs to</param>
/// <param name="navigationProperty">An <see cref="IEdmNavigationProperty"/> containing the navagation property definition of the contained element</param>
public EdmUnknownEntitySet(IEdmNavigationSource parentNavigationSource, IEdmNavigationProperty navigationProperty)
: base(navigationProperty.Name, navigationProperty.ToEntityType())
{
EdmUtil.CheckArgumentNull(parentNavigationSource, "parentNavigationSource");
EdmUtil.CheckArgumentNull(navigationProperty, "navigationProperty");
this.parentNavigationSource = parentNavigationSource;
this.navigationProperty = navigationProperty;
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:14,代码来源:EdmUnknownEntitySet.cs
示例11: BuildNavigationLink
public override Uri BuildNavigationLink(EntityInstanceContext context, IEdmNavigationProperty navigationProperty, ODataMetadataLevel metadataLevel)
{
if (NavigationLinkBuilder != null)
{
return NavigationLinkBuilder(context, navigationProperty, metadataLevel);
}
return null;
}
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:9,代码来源:MockEntitySetLinkBuilderAnnotation.cs
示例12: GetAssociationAnnotations
public static void GetAssociationAnnotations(this IEdmModel model, IEdmNavigationProperty property, out IEnumerable<IEdmDirectValueAnnotation> annotations, out IEnumerable<IEdmDirectValueAnnotation> end1Annotations, out IEnumerable<IEdmDirectValueAnnotation> end2Annotations, out IEnumerable<IEdmDirectValueAnnotation> constraintAnnotations)
{
annotations = null;
end1Annotations = null;
end2Annotations = null;
constraintAnnotations = null;
EdmUtil.CheckArgumentNull<IEdmModel>(model, "model");
EdmUtil.CheckArgumentNull<IEdmNavigationProperty>(property, "property");
property.PopulateCaches();
SerializationExtensionMethods.AssociationAnnotations annotationValue = model.GetAnnotationValue<SerializationExtensionMethods.AssociationAnnotations>(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationAnnotations");
if (annotationValue == null)
{
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations = Enumerable.Empty<IEdmDirectValueAnnotation>();
annotations = edmDirectValueAnnotations;
end1Annotations = edmDirectValueAnnotations;
end2Annotations = edmDirectValueAnnotations;
constraintAnnotations = edmDirectValueAnnotations;
return;
}
else
{
IEnumerable<IEdmDirectValueAnnotation> enumerablePointers = annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations1 = annotationValue.Annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations2 = edmDirectValueAnnotations1;
if (edmDirectValueAnnotations1 == null)
{
edmDirectValueAnnotations2 = Enumerable.Empty<IEdmDirectValueAnnotation>();
}
(enumerablePointers) = edmDirectValueAnnotations2;
IEnumerable<IEdmDirectValueAnnotation> enumerablePointers1 = end1Annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations3 = annotationValue.End1Annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations4 = edmDirectValueAnnotations3;
if (edmDirectValueAnnotations3 == null)
{
edmDirectValueAnnotations4 = Enumerable.Empty<IEdmDirectValueAnnotation>();
}
(enumerablePointers1) = edmDirectValueAnnotations4;
IEnumerable<IEdmDirectValueAnnotation> enumerablePointers2 = end2Annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations5 = annotationValue.End2Annotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations6 = edmDirectValueAnnotations5;
if (edmDirectValueAnnotations5 == null)
{
edmDirectValueAnnotations6 = Enumerable.Empty<IEdmDirectValueAnnotation>();
}
(enumerablePointers2) = edmDirectValueAnnotations6;
IEnumerable<IEdmDirectValueAnnotation> enumerablePointers3 = constraintAnnotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations7 = annotationValue.ConstraintAnnotations;
IEnumerable<IEdmDirectValueAnnotation> edmDirectValueAnnotations8 = edmDirectValueAnnotations7;
if (edmDirectValueAnnotations7 == null)
{
edmDirectValueAnnotations8 = Enumerable.Empty<IEdmDirectValueAnnotation>();
}
(enumerablePointers3) = edmDirectValueAnnotations8;
return;
}
}
开发者ID:nickchal,项目名称:pash,代码行数:56,代码来源:SerializationExtensionMethods.cs
示例13: SetNavigationTarget
/// <summary>
/// Sets the navigation target for a particular navigation property.
/// </summary>
/// <param name="navigationProperty">The navigation property.</param>
/// <param name="target">The target entity set.</param>
public void SetNavigationTarget(IEdmNavigationProperty navigationProperty, IEdmEntitySet target)
{
this.navigationTargets[navigationProperty] = target;
var stubTarget = (StubEdmEntitySet)target;
if (stubTarget.FindNavigationTarget(navigationProperty.Partner) != this)
{
stubTarget.SetNavigationTarget(navigationProperty.Partner, this);
}
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:15,代码来源:StubEdmEntitySet.cs
示例14: NavigationPathSegment
/// <summary>
/// Initializes a new instance of the <see cref="NavigationPathSegment" /> class.
/// </summary>
/// <param name="navigationProperty">The navigation property being accessed by this segment.</param>
public NavigationPathSegment(IEdmNavigationProperty navigationProperty)
{
if (navigationProperty == null)
{
throw Error.ArgumentNull("navigation");
}
NavigationProperty = navigationProperty;
NavigationPropertyName = navigationProperty.Name;
}
开发者ID:genusP,项目名称:WebApi,代码行数:14,代码来源:NavigationPathSegment.cs
示例15: FindNavigationTarget
/// <summary>
/// Finds the entity set that a navigation property targets.
/// </summary>
/// <param name="property">The navigation property.</param>
/// <returns>The entity set that the navigation property targets</returns>
public override IEdmNavigationSource FindNavigationTarget(IEdmNavigationProperty property)
{
IEdmNavigationSource navigationTarget = base.FindNavigationTarget(property);
if (navigationTarget is IEdmUnknownEntitySet)
{
return this.parentNavigationSource.FindNavigationTarget(property);
}
return navigationTarget;
}
开发者ID:rossjempson,项目名称:odata.net,代码行数:15,代码来源:EdmContainedEntitySet.cs
示例16: FindNavigationTarget
/// <summary>
/// Finds the entity set that a navigation property targets.
/// </summary>
/// <param name="navigationProperty">The navigation property.</param>
/// <returns>The entity set that the navigation propertion targets, or null if no such entity set exists.</returns>
public IEdmEntitySet FindNavigationTarget(IEdmNavigationProperty navigationProperty)
{
Util.CheckArgumentNull(navigationProperty, "navigationProperty");
var navigationFacade = navigationProperty as EdmNavigationPropertyFacade;
if (navigationFacade == null)
{
return null;
}
return navigationFacade.FindNavigationTarget(this.serverEntitySet);
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:17,代码来源:EdmEntitySetFacade.cs
示例17: EdmNavigationPropertyFacade
/// <summary>
/// Initializes a new instance of the <see cref="EdmNavigationPropertyFacade"/> class.
/// </summary>
/// <param name="name">The name of the property.</param>
/// <param name="modelFacade">The model facade.</param>
/// <param name="declaringTypeFacade">The type facade.</param>
/// <param name="serverProperty">The server property if one exists.</param>
/// <param name="clientProperty">The client property.</param>
internal EdmNavigationPropertyFacade(string name, EdmModelFacade modelFacade, EdmEntityTypeFacade declaringTypeFacade, IEdmNavigationProperty serverProperty, IEdmNavigationProperty clientProperty)
{
Debug.Assert(clientProperty != null, "clientProperty != null");
Debug.Assert(serverProperty != null, "serverProperty != null");
Debug.Assert(modelFacade != null, "modelFacade != null");
Debug.Assert(declaringTypeFacade != null, "declaringTypeFacade != null");
this.Name = name;
this.modelFacade = modelFacade;
this.declaringTypeFacade = declaringTypeFacade;
this.serverProperty = serverProperty;
this.clientProperty = clientProperty;
}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:21,代码来源:EdmNavigationPropertyFacade.cs
示例18: FindNavigationTarget
public IEdmEntitySet FindNavigationTarget(IEdmNavigationProperty property)
{
IEdmEntitySet edmEntitySet = null;
IEdmNavigationProperty edmNavigationProperty = property;
if (edmNavigationProperty == null || !this.navigationPropertyMappings.TryGetValue(edmNavigationProperty, out edmEntitySet))
{
return null;
}
else
{
return edmEntitySet;
}
}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:EdmEntitySet.cs
示例19: GetAssociationEndName
public static string GetAssociationEndName(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", "AssociationEndName");
string name = annotationValue;
if (annotationValue == null)
{
name = property.Partner.Name;
}
return name;
}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:SerializationExtensionMethods.cs
示例20: FindLinksActionName
private static string FindLinksActionName(ILookup<string, HttpActionDescriptor> actionMap,
IEdmNavigationProperty navigationProperty, IEdmEntityType declaringType, HttpMethod method)
{
string actionNamePrefix;
if (method == HttpMethod.Delete)
{
actionNamePrefix = DeleteLinkActionNamePrefix;
}
else
{
actionNamePrefix = CreateLinkActionNamePrefix;
}
return actionMap.FindMatchingAction(
actionNamePrefix + "To" + navigationProperty.Name + "From" + declaringType.Name,
actionNamePrefix + "To" + navigationProperty.Name,
actionNamePrefix);
}
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:18,代码来源:LinksRoutingConvention.cs
注:本文中的IEdmNavigationProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论