Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c978b8

Browse filesBrowse files
Chris Martinezcommonsensesoftware
authored andcommitted
Add model bound settings to partial OData examples
1 parent 3f65e5b commit 7c978b8
Copy full SHA for 7c978b8

File tree

Expand file treeCollapse file tree

3 files changed

+18
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+18
-0
lines changed

‎examples/AspNet/OData/SomeOpenApiODataWebApiExample/Book.cs

Copy file name to clipboardExpand all lines: examples/AspNet/OData/SomeOpenApiODataWebApiExample/Book.cs
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
namespace ApiVersioning.Examples;
22

3+
using Microsoft.AspNet.OData.Query;
4+
5+
// TODO: Model Bound settings can be performed via attributes if the
6+
// return type is known to the API Explorer or can be explicitly done
7+
// via one or more IModelConfiguration implementations
8+
39
/// <summary>
410
/// Represents a book.
511
/// </summary>
12+
[Filter( "author", "published" )]
613
public class Book
714
{
815
/// <summary>

‎examples/AspNet/OData/SomeOpenApiODataWebApiExample/Startup.cs

Copy file name to clipboardExpand all lines: examples/AspNet/OData/SomeOpenApiODataWebApiExample/Startup.cs
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public void Configuration( IAppBuilder builder )
6868
.Allow( Skip | Count )
6969
.AllowTop( 100 )
7070
.AllowOrderBy( "title", "published" );
71+
72+
// applies model bound settings implicitly using an ad hoc EDM. alternatively, you can create your own
73+
// IModelConfiguration + IODataQueryOptionsConvention for full control over what goes in the ad hoc EDM.
74+
options.AdHocModelBuilder.ModelConfigurations.Add( new ImplicitModelBoundSettingsConvention() );
7175
} );
7276

7377
configuration.EnableSwagger(

‎examples/AspNetCore/OData/SomeODataOpenApiExample/Book.cs

Copy file name to clipboardExpand all lines: examples/AspNetCore/OData/SomeODataOpenApiExample/Book.cs
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
namespace ApiVersioning.Examples;
22

3+
using Microsoft.OData.ModelBuilder;
4+
5+
// TODO: Model Bound settings can be performed via attributes if the
6+
// return type is known to the API Explorer or can be explicitly done
7+
// via one or more IModelConfiguration implementations
8+
39
/// <summary>
410
/// Represents a book.
511
/// </summary>
12+
[Filter( "author", "published" )]
613
public class Book
714
{
815
/// <summary>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.