Skip to content

Commit

Permalink
Remove the unused RouteAttribute on EmployeesController in ODataCusto…
Browse files Browse the repository at this point in the history
…mizedSample
  • Loading branch information
xuzhg committed Jan 26, 2022
1 parent dc6452d commit 4f537fa
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 49 deletions.
12 changes: 5 additions & 7 deletions sample/ODataCustomizedSample/Controllers/EnumsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

namespace ODataCustomizedSample.Controller
{
[Route("convention")]
[Route("explicit")]
public class EmployeesController : ODataController
{
public EmployeesController()
Expand Down Expand Up @@ -120,7 +118,7 @@ public IActionResult GetFavoriteSportsFromEmployee(int key)
return Ok(employee.FavoriteSports);
}

[HttpGet("Employees({key})/FavoriteSports/LikeMost")]
[HttpGet("Employees({key})/FavoriteSports/LikeMost")] // non-OData routing
public IActionResult GetFavoriteSportLikeMost(int key)
{
var firstOrDefault = Employees.FirstOrDefault(e => e.ID == key);
Expand All @@ -135,7 +133,7 @@ public IActionResult Post([FromBody] Employee employee)
return Created(employee);
}

[HttpPost("Employees({key})/FavoriteSports/LikeMost")]
[HttpPost("Employees({key})/FavoriteSports/LikeMost")] // non-OData routing
public IActionResult PostToSkillSet(int key, [FromBody] Skill newSkill)
{
Employee employee = Employees.FirstOrDefault(e => e.ID == key);
Expand Down Expand Up @@ -218,14 +216,14 @@ public IActionResult AddSkill([FromODataUri] int key, [FromBody] ODataActionPara
return Ok(employee.SkillSet);
}

[HttpPost("ResetDataSource")]
[HttpPost("ResetDataSource")] // Non-OData Routing
public IActionResult ResetDataSource()
{
this.InitEmployees();
return this.StatusCode(StatusCodes.Status204NoContent);
}

[HttpPost("SetAccessLevel")]
[HttpPost("SetAccessLevel")] // Non-OData Routing
public IActionResult SetAccessLevel([FromBody] ODataActionParameters parameters)
{
if (!ModelState.IsValid)
Expand Down Expand Up @@ -260,7 +258,7 @@ public IActionResult GetAccessLevel([FromODataUri] int key)
return Ok(employee.AccessLevel);
}

[HttpGet("HasAccessLevel(ID={id},AccessLevel={accessLevel})")]
[HttpGet("HasAccessLevel(ID={id},AccessLevel={accessLevel})")] // non-odata routing
public IActionResult HasAccessLevel([FromODataUri] int id, [FromODataUri] AccessLevel accessLevel)
{
if (!ModelState.IsValid)
Expand Down
82 changes: 40 additions & 42 deletions src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5659,17 +5659,7 @@
<summary>
Gets the value of the property with the given name.
</summary>
<param name="propertyName">The name of the property to get.</param>
<param name="value">When this method returns, contains the value of the property with the given name, if the property is found;
otherwise, null. The parameter is passed uninitialized.</param>
<returns><c>true</c> if the instance contains the property with the given name; otherwise, <c>false</c>.</returns>
</member>
<member name="T:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject">
<summary>
Represents an <see cref="T:Microsoft.AspNetCore.OData.Formatter.Value.IEdmComplexObject"/> that is null.
</summary>
</member>
<member name="M:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject.#ctor(Microsoft.OData.Edm.IEdmComplexTypeReference)">
ft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject.#ctor(Microsoft.OData.Edm.IEdmComplexTypeReference)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Formatter.Value.NullEdmComplexObject"/> class.
</summary>
Expand Down Expand Up @@ -6478,6 +6468,18 @@
Looks up a localized string similar to Cannot find key &apos;{0}&apos; in the &apos;{1}&apos; type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindParameterInOperation">
<summary>
Looks up a localize.AspNetCore.OData.SRResources.CannotDeserializeUnknownProperty">
<summary>
Looks up a localized string similar to The property &apos;{0}&apos; does not exist on type &apos;{1}&apos;. Make sure to only use property names that are defined by the type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindKeyInEntityType">
<summary>
Looks up a localized string similar to Cannot find key &apos;{0}&apos; in the &apos;{1}&apos; type..
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.SRResources.CannotFindParameterInOperation">
<summary>
Looks up a localized string similar to Cannot find parameter &apos;{0}&apos; is in the operation &apos;{1}&apos;..
Expand Down Expand Up @@ -10732,23 +10734,7 @@
Gets the raw $select query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Expand">
<summary>
Gets the raw $expand query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Count">
<summary>
Gets the raw $count query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.Format">
<summary>
Gets the raw $format query value from the incoming request Uri if exists.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQueryOptions.SkipToken">
<summary>
<member name="P:Microsoft.AspNetCore.OData.Query.ODataRawQuery <summary>
Gets the raw $skiptoken query value from the incoming request Uri if exists.
</summary>
</member>
Expand Down Expand Up @@ -11095,6 +11081,15 @@
<param name="queryOptions">Information about the other query options.</param>
<returns>The new <see cref="T:System.Linq.IQueryable"/> after the skiptoken query has been applied to.</returns>
</member>
<member name="M:Microsoft.AspNetCore.OData.Query.SkipTokenQueryOption.ApplyTo(System.Linq.IQueryable,Microsoft.AspNetCore.OData.Query.ODataQuerySettings,Microsoft.AspNetCore.OData.Query.ODataQueryOptions)">
<summary>
Apply the $skiptoken query to the given IQueryable.
</summary>
<param name="query">The original <see cref="T:System.Linq.IQueryable"/>.</param>
<param name="querySettings">The query settings to use while applyingn.</param>
<param name="queryOptions">Information about the other query options.</param>
<returns>The new <see cref="T:System.Linq.IQueryable"/> after the skiptoken query has been applied to.</returns>
</member>
<member name="M:Microsoft.AspNetCore.OData.Query.SkipTokenQueryOption.ApplyTo(System.Linq.IQueryable,Microsoft.AspNetCore.OData.Query.ODataQuerySettings,Microsoft.AspNetCore.OData.Query.ODataQueryOptions)">
<summary>
Apply the $skiptoken query to the given IQueryable.
Expand Down Expand Up @@ -13280,20 +13275,7 @@
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate" /> class.
</summary>
<param name="actionImport">The wrapper action import.</param>
<param name="navigationSource">The target navigation source. it could be null.</param>
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.#ctor(Microsoft.OData.UriParser.OperationImportSegment)">
<summary>
Initializes a new instance of the <see cref="T:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate" /> class.
</summary>
<param name="segment">The operation import segment.</param>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.ActionImport">
<summary>
Gets the wrapped action import.
</summary>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ActionImportSegmentTemplate.Segment">
<param name="navigationSource">The target navigation sNetCore.OData.Routing.Template.ActionImportSegmentTemplate.Segment">
<summary>
Gets the action import segment.
</summary>
Expand Down Expand Up @@ -14102,3 +14084,19 @@
</member>
</members>
</doc>
ummary>
<param name="segment">The value segment.</param>
</member>
<member name="P:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.Segment">
<summary>
Gets the value segment.
</summary>
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.GetTemplates(Microsoft.AspNetCore.OData.Routing.ODataRouteOptions)">
<inheritdoc />
</member>
<member name="M:Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.TryTranslate(Microsoft.AspNetCore.OData.Routing.Template.ODataTemplateTranslateContext)">
<inheritdoc />
</member>
</members>
</doc>

0 comments on commit 4f537fa

Please sign in to comment.