Esempio n. 1
0
 /// <summary>
 /// Created a SingleEntityCastNode with the given source node and the given type to cast to.
 /// </summary>
 /// <param name="source"> Source <see cref="SingleValueNode"/> that is being cast.</param>
 /// <param name="entityType">Type to cast to.</param>
 /// <exception cref="System.ArgumentNullException">Throws if the input entityType is null.</exception>
 public SingleEntityCastNode(SingleEntityNode source, IEdmEntityType entityType)
 {
     ExceptionUtils.CheckArgumentNotNull(entityType, "entityType");
     this.source              = source;
     this.entitySet           = source != null ? source.EntitySet : null;
     this.entityTypeReference = new EdmEntityTypeReference(entityType, false);
 }
Esempio n. 2
0
 /// <summary>
 /// Creates a CollectionNavigationNode.
 /// </summary>
 /// <param name="navigationProperty">The navigation property that defines the collection node.</param>
 /// <param name="source">The parent of this collection navigation node.</param>
 /// <returns>The collection node.</returns>
 /// <exception cref="System.ArgumentNullException">Throws if the input source or navigation property is null.</exception>
 /// <exception cref="ArgumentException">Throws if the input navigation doesn't target a collection.</exception>
 public CollectionNavigationNode(IEdmNavigationProperty navigationProperty, SingleEntityNode source)
     : this(navigationProperty)
 {
     ExceptionUtils.CheckArgumentNotNull(source, "source");
     this.source    = source;
     this.entitySet = source.EntitySet != null?source.EntitySet.FindNavigationTarget(navigationProperty) : null;
 }
Esempio n. 3
0
        /// <summary>
        /// Constructs a SingleNavigationNode.
        /// </summary>
        /// <param name="navigationProperty">The navigation property this node represents.</param>
        /// <param name="source">The previous node in the path.</param>
        /// <exception cref="System.ArgumentNullException">Throws if the input navigationProperty or source is null.</exception>
        /// <exception cref="ArgumentException">Throws if the input navigationProperty targets more than one entity.</exception>
        public SingleNavigationNode(IEdmNavigationProperty navigationProperty, SingleEntityNode source)
        {
            ExceptionUtils.CheckArgumentNotNull(navigationProperty, "navigationProperty");
            ExceptionUtils.CheckArgumentNotNull(source, "source");

            EdmMultiplicity multiplicity = navigationProperty.TargetMultiplicityTemporary();

            if (multiplicity != EdmMultiplicity.One && multiplicity != EdmMultiplicity.ZeroOrOne)
            {
                throw new ArgumentException(ODataErrorStrings.Nodes_CollectionNavigationNode_MustHaveSingleMultiplicity);
            }

            this.source              = source;
            this.navigationProperty  = navigationProperty;
            this.entityTypeReference = (IEdmEntityTypeReference)this.NavigationProperty.Type;
            this.entitySet           = source.EntitySet != null?source.EntitySet.FindNavigationTarget(navigationProperty) : null;
        }