Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch: Netstandard odatalib7, Issue with ODataResponse #14

Closed

Conversation

neerajks
Copy link

Hi,
First of all let me thankyou for a fantastic library. Its better than the Microsoft Client in several areas.

I recently was using the beta version of the library for a project and got stuck with the following issue.
I have noticed a small issue in ODataResponseMessage GetStreamAsync Method.
dotnetstandard 2 onwards HttpResponseMessage.Content directly supports the ReadAsStreamAsync method. Hence the typecast to StreamContent. The above typecase fails as the response.Content is of type NoWriteNoSeekStreamContent. So propose the following change

As is:
public Task GetStreamAsync()
{
var responseContent = _response.Content as StreamContent;
if (responseContent != null)
{
return responseContent.ReadAsStreamAsync();
}
else
{
var completionSource = new TaskCompletionSource();
completionSource.SetResult(Stream.Null);
return completionSource.Task;
}
}

To be:
public Task GetStreamAsync()
{
var responseContent = _response.Content;
if (responseContent != null)
{
return responseContent.ReadAsStreamAsync();
}
else
{
var completionSource = new TaskCompletionSource();
completionSource.SetResult(Stream.Null);
return completionSource.Task;
}
}

Do let me know your thoughts.
Thanks,
Neeraj

object and others added 28 commits July 9, 2017 13:51
This adds a layer of indirection to the reduce the model parsing calls to only
one per cached URI. The IODataModelAdapter follows the IODataAdapter pattern
and is used to create the model from the parsed metadata. The IODataAdapter then
marries the ISession and IODataModelAdapter to create the ODataAdapter for the
given version of the OData protocol.
@object object closed this May 21, 2018
@object object deleted the netstandard_odatalib7 branch May 21, 2018 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.