/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">True if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataWriterCore( ODataOutputContext outputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, IODataReaderWriterListener listener = null) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.writingFeed = writingFeed; // create a collection validator when writing a top-level feed and a user model is present if (this.writingFeed && this.outputContext.Model.IsUserModel()) { this.feedValidator = new FeedWithoutExpectedTypeValidator(); } if (navigationSource != null && entityType == null) { entityType = this.outputContext.EdmTypeResolver.GetElementType(navigationSource); } ODataUri odataUri = outputContext.MessageWriterSettings.ODataUri.Clone(); // Remove key for top level entry if (!writingFeed && odataUri != null && odataUri.Path != null) { odataUri.Path = odataUri.Path.TrimEndingKeySegment(); } this.listener = listener; this.scopes.Push(new Scope(WriterState.Start, /*item*/null, navigationSource, entityType, /*skipWriting*/false, outputContext.MessageWriterSettings.SelectedProperties, odataUri)); }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> protected ODataSerializer(ODataOutputContext outputContext) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.WriterValidator = outputContext.WriterValidator; }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="operation">The operation import whose parameters will be written.</param> protected ODataParameterWriterCore(ODataOutputContext outputContext, IEdmOperation operation) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.operation = operation; this.scopes.Push(ParameterWriterState.Start); }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="itemTypeReference">The item type of the collection being written or null if no metadata is available.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference itemTypeReference) : this(outputContext, itemTypeReference, null) { }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> protected ODataSerializer(ODataOutputContext outputContext) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; }
public TestODataWriterCore(ODataOutputContext outputContext, IEdmEntitySet navigationSource, IEdmEntityType entityType, bool writingFeed): base(outputContext, navigationSource, entityType, writingFeed) { }