-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support write resource with stream property and Support query stream …
…property (#2401) * Support write resource with stream property and Support query stream property * For stream property, we should use ODataStreamPropertyInfo * Address the comments * Address the comments * resolve the comments * Resolve the comments * fix the failing public api
- Loading branch information
Showing
17 changed files
with
507 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/Microsoft.AspNet.OData.Shared/Formatter/ODataStreamMediaTypeMapping.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.AspNet.OData.Formatter | ||
{ | ||
/// <summary> | ||
/// Media type mapping that associates requests with stream property. | ||
/// </summary> | ||
public partial class ODataStreamMediaTypeMapping | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ODataStreamMediaTypeMapping"/> class. | ||
/// </summary> | ||
public ODataStreamMediaTypeMapping() | ||
: base("application/octet-stream") | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Microsoft.AspNet.OData/Formatter/ODataStreamMediaTypeMapping.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System.Net.Http; | ||
using System.Net.Http.Formatting; | ||
using Microsoft.AspNet.OData.Common; | ||
using Microsoft.AspNet.OData.Extensions; | ||
using Microsoft.AspNet.OData.Routing; | ||
|
||
namespace Microsoft.AspNet.OData.Formatter | ||
{ | ||
/// <summary> | ||
/// Media type mapping that associates requests with stream property. | ||
/// </summary> | ||
public partial class ODataStreamMediaTypeMapping : MediaTypeMapping | ||
{ | ||
/// <inheritdoc/> | ||
public override double TryMatchMediaType(HttpRequestMessage request) | ||
{ | ||
if (request == null) | ||
{ | ||
throw Error.ArgumentNull("request"); | ||
} | ||
|
||
return request.ODataProperties().Path.IsStreamPropertyPath() ? 1 : 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Microsoft.AspNetCore.OData/Formatter/ODataStreamMediaTypeMapping.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using Microsoft.AspNet.OData.Common; | ||
using Microsoft.AspNet.OData.Extensions; | ||
using Microsoft.AspNet.OData.Routing; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNet.OData.Formatter | ||
{ | ||
/// <summary> | ||
/// Media type mapping that associates requests with stream property. | ||
/// </summary> | ||
/// <remarks>This class derives from a platform-specific class.</remarks> | ||
public partial class ODataStreamMediaTypeMapping : MediaTypeMapping | ||
{ | ||
/// <inheritdoc/> | ||
public override double TryMatchMediaType(HttpRequest request) | ||
{ | ||
if (request == null) | ||
{ | ||
throw Error.ArgumentNull("request"); | ||
} | ||
|
||
return request.ODataFeature().Path.IsStreamPropertyPath() ? 1 : 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.