Exemple #1
0
 /// <summary>Writes a delta resource set and performs an action in-between.</summary>
 /// <param name="deltaResourceSet">The delta resource set or collection to write.</param>
 /// <param name="nestedAction">The action to perform in-between writing the resource set.</param>
 /// <returns>This ODataWriter, allowing for chaining operations.</returns>
 public ODataWriter Write(ODataDeltaResourceSet deltaResourceSet, Action nestedAction)
 {
     WriteStart(deltaResourceSet);
     nestedAction();
     WriteEnd();
     return(this);
 }
        /// <summary>
        /// Provide additional serialization information to the <see cref="ODataDeltaWriter"/> for <paramref name="deltaResourceSet"/>.
        /// </summary>
        /// <param name="deltaResourceSet">The instance to set the serialization info.</param>
        /// <param name="serializationInfo">The serialization info to set.</param>
        public static void SetSerializationInfo(this ODataDeltaResourceSet deltaResourceSet, ODataDeltaResourceSetSerializationInfo serializationInfo)
        {
            ExceptionUtils.CheckArgumentNotNull(deltaResourceSet, "deltaResourceSet");
            ODataResourceSerializationInfo resourceSerializationInfo = new ODataResourceSerializationInfo()
            {
                NavigationSourceName           = serializationInfo.EntitySetName,
                NavigationSourceEntityTypeName = serializationInfo.EntityTypeName,
                NavigationSourceKind           = EdmNavigationSourceKind.EntitySet,
                ExpectedTypeName = serializationInfo.ExpectedTypeName
            };

            deltaResourceSet.SerializationInfo = resourceSerializationInfo;
        }
        /// <summary>
        /// Validates an <see cref="ODataDeltaResourceSet"/> to ensure all required information is specified and valid on the WriteEnd call.
        /// </summary>
        /// <param name="resourceSet">The resource set to validate.</param>
        /// <param name="writingRequest">Flag indicating whether the resource set is written as part of a request or a response.</param>
        internal static void ValidateDeltaResourceSetAtEnd(ODataDeltaResourceSet resourceSet, bool writingRequest)
        {
            Debug.Assert(resourceSet != null, "resourceSet != null");

            // Verify next link
            if (resourceSet.NextPageLink != null)
            {
                // Check that NextPageLink is not set for requests
                if (writingRequest)
                {
                    throw new ODataException(Strings.WriterValidationUtils_NextPageLinkInRequest);
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Asynchronously start writing a delta resource set.
 /// </summary>
 /// <param name="deltaResourceSet">Delta resource set/collection to write.</param>
 /// <returns>A task instance that represents the asynchronous write operation.</returns>
 public abstract Task WriteStartAsync(ODataDeltaResourceSet deltaResourceSet);
Exemple #5
0
 /// <summary>
 /// Start writing a delta resource set.
 /// </summary>
 /// <param name="deltaResourceSet">Delta resource set/collection to write.</param>
 public abstract void WriteStart(ODataDeltaResourceSet deltaResourceSet);
Exemple #6
0
 /// <summary> Asynchronously start writing a resource set. </summary>
 /// <returns>A task instance that represents the asynchronous write operation.</returns>
 /// <param name="deltaResourceSet">The resource set or collection to write.</param>
 public virtual Task WriteStartAsync(ODataDeltaResourceSet deltaResourceSet)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 /// <summary>Writes a delta resource set.</summary>
 /// <param name="deltaResourceSet">The delta resource set or collection to write.</param>
 /// <returns>This ODataWriter, allowing for chaining operations.</returns>
 public ODataWriter Write(ODataDeltaResourceSet deltaResourceSet)
 {
     WriteStart(deltaResourceSet);
     WriteEnd();
     return(this);
 }
Exemple #8
0
 /// <summary>Starts the writing of a delta resource set.</summary>
 /// <param name="deltaResourceSet">The resource set or collection to write.</param>
 public virtual void WriteStart(ODataDeltaResourceSet deltaResourceSet)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 /// <summary> Asynchronously start writing a resource set. </summary>
 /// <returns>A task instance that represents the asynchronous write operation.</returns>
 /// <param name="deltaResourceSet">The resource set or collection to write.</param>
 public virtual Task WriteStartAsync(ODataDeltaResourceSet deltaResourceSet)
 {
     return(TaskUtils.GetTaskForSynchronousOperation(() => this.WriteStart(deltaResourceSet)));
 }
 /// <summary>
 /// Provide additional serialization information to the <see cref="ODataDeltaWriter"/> for <paramref name="deltaResourceSet"/>.
 /// </summary>
 /// <param name="deltaResourceSet">The instance to set the serialization info.</param>
 /// <param name="serializationInfo">The serialization info to set.</param>
 public static void SetSerializationInfo(this ODataDeltaResourceSet deltaResourceSet, ODataResourceSerializationInfo serializationInfo)
 {
     ExceptionUtils.CheckArgumentNotNull(deltaResourceSet, "deltaResourceSet");
     deltaResourceSet.SerializationInfo = serializationInfo;
 }