protected ODataRequestMessageWrapper CreateRequest(EntityDescriptor entityDescriptor) { EntityStates state = entityDescriptor.State; Uri resourceUri = entityDescriptor.GetResourceUri(this.RequestInfo.BaseUriResolver, false); ClientEdmModel model = ClientEdmModel.GetModel(this.RequestInfo.MaxProtocolVersion); Version requestVersion = DetermineRequestVersion(model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityDescriptor.Entity.GetType())), state); string httpMethod = this.GetHttpMethod(state, ref requestVersion); ODataRequestMessageWrapper requestMessage = this.CreateRequestMessage(resourceUri, httpMethod); if (this.IsBatch) { requestMessage.SetHeader("Content-ID", entityDescriptor.ChangeOrder.ToString(CultureInfo.InvariantCulture)); } if (EntityStates.Deleted != entityDescriptor.State) { requestMessage.SetHeader("Content-Type", "application/atom+xml"); } if ((EntityStates.Deleted == state) || (EntityStates.Modified == state)) { string latestETag = entityDescriptor.GetLatestETag(); if (latestETag != null) { requestMessage.SetHeader("If-Match", latestETag); if (!this.IsBatch) { requestMessage.AddHeadersToReset("If-Match"); } } } ApplyPreferences(requestMessage, httpMethod, this.RequestInfo.AddAndUpdateResponsePreference, ref requestVersion); WebUtil.SetOperationVersionHeaders(requestMessage, requestVersion, this.RequestInfo.MaxProtocolVersionAsVersion); return(requestMessage); }
internal void WriteNavigationLink(EntityDescriptor entityDescriptor, IEnumerable <LinkDescriptor> relatedLinks, ODataWriter odataWriter) { ClientTypeAnnotation clientTypeAnnotation = null; foreach (LinkDescriptor descriptor in relatedLinks) { descriptor.ContentGeneratedForSave = true; if (clientTypeAnnotation == null) { ClientEdmModel model = ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion); clientTypeAnnotation = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityDescriptor.Entity.GetType())); } ODataNavigationLink navigationLink = new ODataNavigationLink { Url = this.requestInfo.EntityTracker.GetEntityDescriptor(descriptor.Target).GetLatestEditLink(), IsCollection = new bool?(clientTypeAnnotation.GetProperty(descriptor.SourceProperty, false).IsEntityCollection), Name = descriptor.SourceProperty }; odataWriter.WriteStart(navigationLink); ODataEntityReferenceLink entityReferenceLink = new ODataEntityReferenceLink { Url = navigationLink.Url }; odataWriter.WriteEntityReferenceLink(entityReferenceLink); odataWriter.WriteEnd(); } }
private ODataComplexValue CreateODataComplexValue(Type complexType, object value, string propertyName, bool isCollectionItem, List <object> visitedComplexTypeObjects) { ClientTypeAnnotation clientTypeAnnotation = ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion).GetClientTypeAnnotation(complexType); if (visitedComplexTypeObjects == null) { visitedComplexTypeObjects = new List <object>(); } else if (visitedComplexTypeObjects.Contains(value)) { if (propertyName != null) { throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Serializer_LoopsNotAllowedInComplexTypes(propertyName)); } throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Serializer_LoopsNotAllowedInNonPropertyComplexTypes(clientTypeAnnotation.ElementTypeName)); } if (value == null) { return(null); } visitedComplexTypeObjects.Add(value); ODataComplexValue value2 = new ODataComplexValue(); if (!isCollectionItem) { SerializationTypeNameAnnotation annotation = new SerializationTypeNameAnnotation { TypeName = this.requestInfo.GetServerTypeName(clientTypeAnnotation) }; value2.SetAnnotation <SerializationTypeNameAnnotation>(annotation); } value2.Properties = this.PopulateProperties(clientTypeAnnotation, value, visitedComplexTypeObjects); visitedComplexTypeObjects.Remove(value); return(value2); }
internal ClientTypeAnnotation ResolveEdmTypeName(Type expectedType, string edmTypeName) { ClientTypeAnnotation clientTypeAnnotation; PrimitiveType type; string collectionItemWireTypeName = WebUtil.GetCollectionItemWireTypeName(edmTypeName); string str2 = collectionItemWireTypeName ?? edmTypeName; ClientEdmModel model = ClientEdmModel.GetModel(this.ResponseInfo.MaxProtocolVersion); if (PrimitiveType.TryGetPrimitiveType(str2, out type)) { clientTypeAnnotation = model.GetClientTypeAnnotation(type.ClrType); } else if (!this.edmTypeNameMap.TryGetValue(str2, out clientTypeAnnotation)) { clientTypeAnnotation = model.GetClientTypeAnnotation(str2); } if (collectionItemWireTypeName == null) { return(clientTypeAnnotation); } Type elementType = clientTypeAnnotation.ElementType; if (type != null) { elementType = ClientTypeUtil.GetImplementationType(expectedType, typeof(ICollection <>)).GetGenericArguments()[0]; } Type backingTypeForCollectionProperty = WebUtil.GetBackingTypeForCollectionProperty(expectedType, elementType); return(model.GetClientTypeAnnotation(backingTypeForCollectionProperty)); }
internal QueryOperationResponse LoadProperty() { MaterializeAtom results = null; QueryOperationResponse responseWithType; DataServiceContext source = (DataServiceContext)base.Source; ClientEdmModel model = ClientEdmModel.GetModel(source.MaxProtocolVersion); ClientTypeAnnotation clientTypeAnnotation = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(this.entity.GetType())); EntityDescriptor entityDescriptor = source.GetEntityDescriptor(this.entity); if (EntityStates.Added == entityDescriptor.State) { throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Context_NoLoadWithInsertEnd); } ClientPropertyAnnotation property = clientTypeAnnotation.GetProperty(this.propertyName, false); Type elementType = property.EntityCollectionItemType ?? property.NullablePropertyType; try { if (clientTypeAnnotation.MediaDataMember == property) { results = this.ReadPropertyFromRawData(property); } else { results = this.ReadPropertyFromAtom(entityDescriptor, property); } responseWithType = base.GetResponseWithType(results, elementType); } catch (InvalidOperationException exception) { QueryOperationResponse response = base.GetResponseWithType(results, elementType); if (response != null) { response.Error = exception; throw new DataServiceQueryException(System.Data.Services.Client.Strings.DataServiceException_GeneralError, exception, response); } throw; } return(responseWithType); }
internal IEdmType ResolveWireTypeName(IEdmType expectedEdmType, string wireName) { Type elementType; ClientEdmModel model = ClientEdmModel.GetModel(this.ResponseInfo.MaxProtocolVersion); if (expectedEdmType != null) { ClientTypeAnnotation annotation = model.GetClientTypeAnnotation(expectedEdmType); elementType = annotation.ElementType; if (annotation.EdmType.TypeKind == EdmTypeKind.Primitive) { return(expectedEdmType); } } else { elementType = typeof(object); } Type type2 = this.ResolveTypeFromName(wireName, elementType); ClientTypeAnnotation clientTypeAnnotation = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(type2)); if (clientTypeAnnotation.IsEntityType) { clientTypeAnnotation.EnsureEPMLoaded(); } switch (clientTypeAnnotation.EdmType.TypeKind) { case EdmTypeKind.Entity: case EdmTypeKind.Complex: { string key = clientTypeAnnotation.EdmType.FullName(); if (!this.edmTypeNameMap.ContainsKey(key)) { this.edmTypeNameMap.Add(key, clientTypeAnnotation); } break; } } return(clientTypeAnnotation.EdmType); }
internal void WriteEntry(EntityDescriptor entityDescriptor, IEnumerable <LinkDescriptor> relatedLinks, ODataRequestMessageWrapper requestMessage) { ClientEdmModel model = ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion); ClientTypeAnnotation clientTypeAnnotation = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityDescriptor.Entity.GetType())); using (ODataMessageWriter writer = CreateMessageWriter(requestMessage, this.requestInfo)) { ODataWriter odataWriter = writer.CreateODataEntryWriter(); ODataEntry entry = new ODataEntry(); if (this.requestInfo.HasWritingEventHandlers) { entry.SetAnnotation <WritingEntityInfo>(new WritingEntityInfo(entityDescriptor.Entity, this.requestInfo)); } string serverTypeName = this.requestInfo.GetServerTypeName(entityDescriptor); if (clientTypeAnnotation.ElementTypeName != serverTypeName) { SerializationTypeNameAnnotation annotation = new SerializationTypeNameAnnotation { TypeName = serverTypeName }; entry.SetAnnotation <SerializationTypeNameAnnotation>(annotation); } entry.TypeName = clientTypeAnnotation.ElementTypeName; if (EntityStates.Modified == entityDescriptor.State) { entry.Id = entityDescriptor.GetLatestIdentity(); } if (entityDescriptor.IsMediaLinkEntry || clientTypeAnnotation.IsMediaLinkEntry) { entry.MediaResource = new ODataStreamReferenceValue(); } odataWriter.WriteStart(entry); if (EntityStates.Added == entityDescriptor.State) { this.WriteNavigationLink(entityDescriptor, relatedLinks, odataWriter); } entry.Properties = this.PopulateProperties(clientTypeAnnotation, entityDescriptor.Entity, null); odataWriter.WriteEnd(); } }
internal void AttachLink(object source, string sourceProperty, object target, MergeOption linkMerge) { LinkDescriptor linkDescriptor = new LinkDescriptor(source, sourceProperty, target, this.maxProtocolVersion); LinkDescriptor descriptor2 = this.TryGetLinkDescriptor(source, sourceProperty, target); if (descriptor2 != null) { switch (linkMerge) { case MergeOption.OverwriteChanges: linkDescriptor = descriptor2; break; case MergeOption.PreserveChanges: if (((EntityStates.Added == descriptor2.State) || (EntityStates.Unchanged == descriptor2.State)) || ((EntityStates.Modified == descriptor2.State) && (descriptor2.Target != null))) { linkDescriptor = descriptor2; } break; case MergeOption.NoTracking: throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Context_RelationAlreadyContained); } } else { ClientEdmModel model = ClientEdmModel.GetModel(this.maxProtocolVersion); if (model.GetClientTypeAnnotation(model.GetOrCreateEdmType(source.GetType())).GetProperty(sourceProperty, false).IsEntityCollection || ((descriptor2 = this.DetachReferenceLink(source, sourceProperty, target, linkMerge)) == null)) { this.AddLink(linkDescriptor); this.IncrementChange(linkDescriptor); } else if ((linkMerge != MergeOption.AppendOnly) && ((MergeOption.PreserveChanges != linkMerge) || (EntityStates.Modified != descriptor2.State))) { linkDescriptor = descriptor2; } } linkDescriptor.State = EntityStates.Unchanged; }
internal void WriteBodyOperationParameters(List <BodyOperationParameter> operationParameters, ODataRequestMessageWrapper requestMessage) { using (ODataMessageWriter writer = CreateMessageWriter(requestMessage, this.requestInfo)) { ODataParameterWriter writer2 = writer.CreateODataParameterWriter(null); writer2.WriteStart(); foreach (OperationParameter parameter in operationParameters) { IEnumerator enumerator; ODataCollectionWriter writer3; object obj2; if (parameter.Value == null) { writer2.WriteValue(parameter.Name, parameter.Value); continue; } ClientEdmModel model = ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion); IEdmType orCreateEdmType = model.GetOrCreateEdmType(parameter.Value.GetType()); switch (orCreateEdmType.TypeKind) { case EdmTypeKind.Primitive: { writer2.WriteValue(parameter.Name, parameter.Value); continue; } case EdmTypeKind.Complex: { ODataComplexValue parameterValue = this.CreateODataComplexValue(model.GetClientTypeAnnotation(orCreateEdmType).ElementType, parameter.Value, null, false, null); writer2.WriteValue(parameter.Name, parameterValue); continue; } case EdmTypeKind.Collection: { enumerator = ((ICollection)parameter.Value).GetEnumerator(); writer3 = writer2.CreateCollectionWriter(parameter.Name); ODataCollectionStart collectionStart = new ODataCollectionStart(); writer3.WriteStart(collectionStart); goto Label_016D; } default: throw new NotSupportedException(System.Data.Services.Client.Strings.Serializer_InvalidParameterType(parameter.Name, orCreateEdmType.TypeKind)); } Label_00D3: obj2 = enumerator.Current; if (obj2 == null) { throw new NotSupportedException(System.Data.Services.Client.Strings.Serializer_NullCollectionParamterItemValue(parameter.Name)); } IEdmType edmType = model.GetOrCreateEdmType(obj2.GetType()); switch (edmType.TypeKind) { case EdmTypeKind.Primitive: writer3.WriteItem(obj2); break; case EdmTypeKind.Complex: { ODataComplexValue item = this.CreateODataComplexValue(model.GetClientTypeAnnotation(edmType).ElementType, obj2, null, false, null); writer3.WriteItem(item); break; } default: throw new NotSupportedException(System.Data.Services.Client.Strings.Serializer_InvalidCollectionParamterItemType(parameter.Name, edmType.TypeKind)); } Label_016D: if (enumerator.MoveNext()) { goto Label_00D3; } writer3.WriteEnd(); writer3.Flush(); } writer2.WriteEnd(); writer2.Flush(); } }
private string ConvertToEscapedUriValue(string paramName, object value) { object obj2 = null; string str; bool flag = false; if (value == null) { flag = true; } else if (value.GetType() == typeof(ODataUriNullValue)) { obj2 = value; flag = true; } else { ClientTypeAnnotation annotation3; ClientEdmModel model = ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion); IEdmType orCreateEdmType = model.GetOrCreateEdmType(value.GetType()); switch (orCreateEdmType.TypeKind) { case EdmTypeKind.Primitive: obj2 = value; flag = true; goto Label_0155; case EdmTypeKind.Complex: { ClientTypeAnnotation clientTypeAnnotation = model.GetClientTypeAnnotation(orCreateEdmType); obj2 = this.CreateODataComplexValue(clientTypeAnnotation.ElementType, value, null, false, null); SerializationTypeNameAnnotation annotation = ((ODataComplexValue)obj2).GetAnnotation <SerializationTypeNameAnnotation>(); if ((annotation == null) || string.IsNullOrEmpty(annotation.TypeName)) { throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.DataServiceException_GeneralError); } goto Label_0155; } case EdmTypeKind.Collection: { IEdmCollectionType type2 = orCreateEdmType as IEdmCollectionType; IEdmTypeReference elementType = type2.ElementType; annotation3 = model.GetClientTypeAnnotation(elementType.Definition); switch (annotation3.EdmType.TypeKind) { case EdmTypeKind.Primitive: case EdmTypeKind.Complex: obj2 = this.CreateODataCollection(annotation3.ElementType, null, value, null); goto Label_0155; } break; } default: throw new NotSupportedException(System.Data.Services.Client.Strings.Serializer_InvalidParameterType(paramName, orCreateEdmType.TypeKind)); } throw new NotSupportedException(System.Data.Services.Client.Strings.Serializer_InvalidCollectionParamterItemType(paramName, annotation3.EdmType.TypeKind)); } Label_0155: str = ODataUriUtils.ConvertToUriLiteral(obj2, CommonUtil.ConvertToODataVersion(this.requestInfo.MaxProtocolVersionAsVersion)); if (flag) { return(DataStringEscapeBuilder.EscapeDataString(str)); } return(Uri.EscapeDataString(str)); }
private ODataRequestMessageWrapper CheckAndProcessMediaEntryPost(EntityDescriptor entityDescriptor) { ClientEdmModel model = ClientEdmModel.GetModel(base.RequestInfo.MaxProtocolVersion); ClientTypeAnnotation clientTypeAnnotation = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityDescriptor.Entity.GetType())); if (!clientTypeAnnotation.IsMediaLinkEntry && !entityDescriptor.IsMediaLinkEntry) { return(null); } if ((clientTypeAnnotation.MediaDataMember == null) && (entityDescriptor.SaveStream == null)) { throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Context_MLEWithoutSaveStream(clientTypeAnnotation.ElementTypeName)); } ODataRequestMessageWrapper mediaResourceRequest = null; if (clientTypeAnnotation.MediaDataMember != null) { string contentType = null; int length = 0; if (clientTypeAnnotation.MediaDataMember.MimeTypeProperty == null) { contentType = "application/octet-stream"; } else { object obj2 = clientTypeAnnotation.MediaDataMember.MimeTypeProperty.GetValue(entityDescriptor.Entity); string str2 = (obj2 != null) ? obj2.ToString() : null; if (string.IsNullOrEmpty(str2)) { throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Context_NoContentTypeForMediaLink(clientTypeAnnotation.ElementTypeName, clientTypeAnnotation.MediaDataMember.MimeTypeProperty.PropertyName)); } contentType = str2; } object propertyValue = clientTypeAnnotation.MediaDataMember.GetValue(entityDescriptor.Entity); if (propertyValue == null) { base.mediaResourceRequestStream = null; } else { byte[] bytes = propertyValue as byte[]; if (bytes == null) { string str3; Encoding encoding; HttpProcessUtility.ReadContentType(contentType, out str3, out encoding); if (encoding == null) { encoding = Encoding.UTF8; contentType = contentType + ";charset=UTF-8"; } bytes = encoding.GetBytes(ClientConvert.ToString(propertyValue)); } length = bytes.Length; base.mediaResourceRequestStream = new MemoryStream(bytes, 0, bytes.Length, false, true); } mediaResourceRequest = this.CreateMediaResourceRequest(entityDescriptor.GetResourceUri(base.RequestInfo.BaseUriResolver, false), "POST", Util.DataServiceVersion1, clientTypeAnnotation.MediaDataMember == null, true); mediaResourceRequest.SetHeader("Content-Length", length.ToString(CultureInfo.InvariantCulture)); mediaResourceRequest.SetHeader("Content-Type", contentType); mediaResourceRequest.AddHeadersToReset("Content-Length"); mediaResourceRequest.AddHeadersToReset("Content-Type"); } else { mediaResourceRequest = this.CreateMediaResourceRequest(entityDescriptor.GetResourceUri(base.RequestInfo.BaseUriResolver, false), "POST", Util.DataServiceVersion1, clientTypeAnnotation.MediaDataMember == null, true); this.SetupMediaResourceRequest(mediaResourceRequest, entityDescriptor.SaveStream, null); } entityDescriptor.State = EntityStates.Modified; return(mediaResourceRequest); }
private static BindingEntityInfoPerType GetBindingEntityInfoFor(Type entityType, DataServiceProtocolVersion maxProtocolVersion) { BindingEntityInfoPerType type; metadataCacheLock.EnterReadLock(); try { if (bindingEntityInfos.TryGetValue(entityType, out type)) { return(type); } } finally { metadataCacheLock.ExitReadLock(); } type = new BindingEntityInfoPerType(); EntitySetAttribute attribute = (EntitySetAttribute)entityType.GetCustomAttributes(typeof(EntitySetAttribute), true).SingleOrDefault <object>(); ClientEdmModel model = ClientEdmModel.GetModel(maxProtocolVersion); type.EntitySet = (attribute != null) ? attribute.EntitySet : null; type.ClientType = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityType)); foreach (ClientPropertyAnnotation annotation in type.ClientType.Properties()) { BindingPropertyInfo item = null; Type propertyType = annotation.PropertyType; if (!annotation.IsStreamLinkProperty) { if (annotation.IsPrimitiveOrComplexCollection) { item = new BindingPropertyInfo { PropertyKind = BindingPropertyKind.BindingPropertyKindPrimitiveOrComplexCollection }; } else if (annotation.IsEntityCollection) { if (IsDataServiceCollection(propertyType, maxProtocolVersion)) { item = new BindingPropertyInfo { PropertyKind = BindingPropertyKind.BindingPropertyKindDataServiceCollection }; } } else if (IsEntityType(propertyType, maxProtocolVersion)) { item = new BindingPropertyInfo { PropertyKind = BindingPropertyKind.BindingPropertyKindEntity }; } else if (CanBeComplexType(propertyType)) { item = new BindingPropertyInfo { PropertyKind = BindingPropertyKind.BindingPropertyKindComplex }; } if (item != null) { item.PropertyInfo = annotation; if ((type.ClientType.IsEntityType || (item.PropertyKind == BindingPropertyKind.BindingPropertyKindComplex)) || (item.PropertyKind == BindingPropertyKind.BindingPropertyKindPrimitiveOrComplexCollection)) { type.ObservableProperties.Add(item); } } } } metadataCacheLock.EnterWriteLock(); try { if (!bindingEntityInfos.ContainsKey(entityType)) { bindingEntityInfos[entityType] = type; } } finally { metadataCacheLock.ExitWriteLock(); } return(type); }
internal LinkDescriptor(object source, string sourceProperty, object target, DataServiceProtocolVersion maxProtocolVersion) : this(source, sourceProperty, target, EntityStates.Unchanged) { ClientEdmModel model = ClientEdmModel.GetModel(maxProtocolVersion); this.IsSourcePropertyCollection = model.GetClientTypeAnnotation(model.GetOrCreateEdmType(source.GetType())).GetProperty(sourceProperty, false).IsEntityCollection; }
private ODataRequestMessageWrapper GenerateBatchRequest() { if ((base.ChangedEntries.Count == 0) && (this.Queries == null)) { base.SetCompleted(); return(null); } ODataRequestMessageWrapper requestMessage = this.CreateBatchRequest(); using (ODataMessageWriter writer = Serializer.CreateMessageWriter(requestMessage, base.RequestInfo)) { ODataUtils.SetHeadersForPayload(writer, ODataPayloadKind.Batch); requestMessage.FireSendingRequest2(null); this.batchWriter = writer.CreateODataBatchWriter(); this.batchWriter.WriteStartBatch(); if (this.Queries != null) { for (int i = 0; i < this.Queries.Length; i++) { Uri requestUri = base.RequestInfo.BaseUriResolver.CreateAbsoluteUriIfNeeded(this.Queries[i].QueryComponents(base.RequestInfo.MaxProtocolVersion).Uri); ODataRequestMessageWrapper wrapper2 = this.CreateRequestMessage(requestUri, "GET"); Version requestVersion = this.Queries[i].QueryComponents(base.RequestInfo.MaxProtocolVersion).Version; WebUtil.SetOperationVersionHeaders(wrapper2, requestVersion, base.RequestInfo.MaxProtocolVersionAsVersion); wrapper2.FireSendingRequest2(null); } } else if (0 < base.ChangedEntries.Count) { this.batchWriter.WriteStartChangeset(); ClientEdmModel model = ClientEdmModel.GetModel(base.RequestInfo.MaxProtocolVersion); for (int j = 0; j < base.ChangedEntries.Count; j++) { Descriptor descriptor = base.ChangedEntries[j]; if (!descriptor.ContentGeneratedForSave) { ODataRequestMessageWrapper wrapper3; EntityDescriptor entityDescriptor = descriptor as EntityDescriptor; if (descriptor.DescriptorKind == DescriptorKind.Entity) { if (entityDescriptor.State != EntityStates.Added) { if (((entityDescriptor.State == EntityStates.Unchanged) || (entityDescriptor.State == EntityStates.Modified)) && (entityDescriptor.SaveStream != null)) { throw System.Data.Services.Client.Error.NotSupported(System.Data.Services.Client.Strings.Context_BatchNotSupportedForMediaLink); } } else if (model.GetClientTypeAnnotation(model.GetOrCreateEdmType(entityDescriptor.Entity.GetType())).IsMediaLinkEntry || entityDescriptor.IsMediaLinkEntry) { throw System.Data.Services.Client.Error.NotSupported(System.Data.Services.Client.Strings.Context_BatchNotSupportedForMediaLink); } } else if (descriptor.DescriptorKind == DescriptorKind.NamedStream) { throw System.Data.Services.Client.Error.NotSupported(System.Data.Services.Client.Strings.Context_BatchNotSupportedForNamedStreams); } if (descriptor.DescriptorKind == DescriptorKind.Entity) { wrapper3 = base.CreateRequest(entityDescriptor); } else { wrapper3 = base.CreateRequest((LinkDescriptor)descriptor); } wrapper3.FireSendingRequest2(descriptor); base.CreateChangeData(j, wrapper3); } } this.batchWriter.WriteEndChangeset(); } this.batchWriter.WriteEndBatch(); this.batchWriter.Flush(); } return(requestMessage); }
internal ODataMessageWriter CreateWriter(ODataMessageWriterSettings writerSettings) { return(new ODataMessageWriter(this.requestMessage, writerSettings, ClientEdmModel.GetModel(this.requestInfo.MaxProtocolVersion))); }