Skip to content

Commit

Permalink
Fixes #2861: Pass the IServiceProvider to ODataUriParser
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhg committed Nov 20, 2024
1 parent 1595edb commit 3acc028
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ internal static ODataDeserializerContext GenerateNestedReadContext(ODataNestedRe
{
try
{
path = new Routing.ODataPath(new ODataUriParser(readContext.Model, new Uri(navigationSource.Path.Path, UriKind.Relative)).ParsePath());
ODataUriParser parser;
if (readContext != null && readContext.InternalRequest != null && readContext.InternalRequest.RequestContainer != null)
{
parser = new ODataUriParser(readContext.Model, new Uri(navigationSource.Path.Path, UriKind.Relative), readContext.InternalRequest.RequestContainer);
}
else
{
parser = new ODataUriParser(readContext.Model, new Uri(navigationSource.Path.Path, UriKind.Relative));
}

path = new Routing.ODataPath(parser.ParsePath());
}
catch (ODataException)
{
Expand Down Expand Up @@ -332,7 +342,16 @@ internal static Routing.ODataPath ApplyIdToPath(ODataDeserializerContext readCon

try
{
ODataUriParser parser = new ODataUriParser(readContext.Model, new Uri(serviceRoot), resourceWrapper.ResourceBase.Id);
ODataUriParser parser;
if (internalRequest.RequestContainer != null)
{
parser = new ODataUriParser(readContext.Model, new Uri(serviceRoot), resourceWrapper.ResourceBase.Id, internalRequest.RequestContainer);
}
else
{
parser = new ODataUriParser(readContext.Model, new Uri(serviceRoot), resourceWrapper.ResourceBase.Id);
}

odataPath = parser.ParsePath();
}
catch (ODataException)
Expand Down

0 comments on commit 3acc028

Please sign in to comment.