Skip to content

Commit

Permalink
Track enableDelta in scope rather than introduce separate stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepizzo committed Nov 24, 2021
1 parent ecc5b87 commit 1e2446d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 41 deletions.
10 changes: 6 additions & 4 deletions src/Microsoft.OData.Core/JsonLight/ODataJsonLightWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,8 @@ protected override ResourceScope CreateResourceScope(ODataResource resource, IEd
/// <returns>The newly created JSON Light nested resource info scope.</returns>
protected override NestedResourceInfoScope CreateNestedResourceInfoScope(WriterState writerState, ODataNestedResourceInfo navLink, IEdmNavigationSource navigationSource, IEdmType itemType, bool skipWriting, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
{
return new JsonLightNestedResourceInfoScope(writerState, navLink, navigationSource, itemType, skipWriting, selectedProperties, odataUri);
Debug.Assert(this.CurrentScope != null, "Creating a nested resource info scope with a null parent scope.");
return new JsonLightNestedResourceInfoScope(writerState, navLink, navigationSource, itemType, skipWriting, selectedProperties, odataUri, this.CurrentScope);
}

/// <summary>
Expand Down Expand Up @@ -3577,8 +3578,9 @@ private sealed class JsonLightNestedResourceInfoScope : NestedResourceInfoScope
/// <param name="skipWriting">true if the content of the scope to create should not be written.</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The ODataUri info of this scope.</param>
internal JsonLightNestedResourceInfoScope(WriterState writerState, ODataNestedResourceInfo navLink, IEdmNavigationSource navigationSource, IEdmType itemType, bool skipWriting, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
: base(writerState, navLink, navigationSource, itemType, skipWriting, selectedProperties, odataUri)
/// <param name="parentScope">The scope of the parent.</param>
internal JsonLightNestedResourceInfoScope(WriterState writerState, ODataNestedResourceInfo navLink, IEdmNavigationSource navigationSource, IEdmType itemType, bool skipWriting, SelectedPropertiesNode selectedProperties, ODataUri odataUri, Scope parentScope)
: base(writerState, navLink, navigationSource, itemType, skipWriting, selectedProperties, odataUri, parentScope)
{
}

Expand Down Expand Up @@ -3621,7 +3623,7 @@ internal bool ResourceSetWritten
/// <returns>The cloned nested resource info scope with the specified writer state.</returns>
internal override NestedResourceInfoScope Clone(WriterState newWriterState)
{
return new JsonLightNestedResourceInfoScope(newWriterState, (ODataNestedResourceInfo)this.Item, this.NavigationSource, this.ItemType, this.SkipWriting, this.SelectedProperties, this.ODataUri)
return new JsonLightNestedResourceInfoScope(newWriterState, (ODataNestedResourceInfo)this.Item, this.NavigationSource, this.ItemType, this.SkipWriting, this.SelectedProperties, this.ODataUri, this.parentScope)
{
EntityReferenceLinkWritten = this.entityReferenceLinkWritten,
ResourceSetWritten = this.resourceSetWritten,
Expand Down

0 comments on commit 1e2446d

Please sign in to comment.