/// <summary>
        /// Extends value population to include stream data
        /// </summary>
        /// <param name="row">The row containing the data</param>
        /// <param name="instance">The structural instacne</param>
        protected override void PopulateInstanceFromRow(EntitySetDataRow row, QueryStructuralValue instance)
        {
            base.PopulateInstanceFromRow(row, instance);
            var rowWithStreams = row as EntitySetDataRowWithStreams;
            if (rowWithStreams != null)
            {
                foreach (var stream in rowWithStreams.Streams)
                {
                    if (stream.IsEditLinkBasedOnConvention)
                    {
                        ExceptionUtilities.CheckObjectNotNull(this.LinkGenerator, "Cannot compute convention-based edit link without injected generator");
                        stream.EditLink = this.LinkGenerator.GenerateStreamEditLink(instance, stream.Name);

                        // for the default stream, there must always be a self-link
                        if (stream.Name == null && stream.SelfLink == null)
                        {
                            stream.SelfLink = stream.EditLink;
                        }
                    }

                    instance.SetStreamValue(stream.Name, stream.ContentType, stream.ETag, stream.EditLink, stream.SelfLink, stream.Content);
                }
            }

            instance.MarkDynamicPropertyValues();
        }
示例#2
0
        /// <summary>
        /// Extends value population to include stream data
        /// </summary>
        /// <param name="row">The row containing the data</param>
        /// <param name="instance">The structural instacne</param>
        protected override void PopulateInstanceFromRow(EntitySetDataRow row, QueryStructuralValue instance)
        {
            base.PopulateInstanceFromRow(row, instance);
            var rowWithStreams = row as EntitySetDataRowWithStreams;

            if (rowWithStreams != null)
            {
                foreach (var stream in rowWithStreams.Streams)
                {
                    if (stream.IsEditLinkBasedOnConvention)
                    {
                        ExceptionUtilities.CheckObjectNotNull(this.LinkGenerator, "Cannot compute convention-based edit link without injected generator");
                        stream.EditLink = this.LinkGenerator.GenerateStreamEditLink(instance, stream.Name);

                        // for the default stream, there must always be a self-link
                        if (stream.Name == null && stream.SelfLink == null)
                        {
                            stream.SelfLink = stream.EditLink;
                        }
                    }

                    instance.SetStreamValue(stream.Name, stream.ContentType, stream.ETag, stream.EditLink, stream.SelfLink, stream.Content);
                }
            }

            instance.MarkDynamicPropertyValues();
        }