当前位置: 首页>>代码示例>>C#>>正文


C# IEdmNavigationProperty类代码示例

本文整理汇总了C#中IEdmNavigationProperty的典型用法代码示例。如果您正苦于以下问题:C# IEdmNavigationProperty类的具体用法?C# IEdmNavigationProperty怎么用?C# IEdmNavigationProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IEdmNavigationProperty类属于命名空间,在下文中一共展示了IEdmNavigationProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IEdmNavigationProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。