Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 266 additions & 14 deletions src/Microsoft.AspNetCore.OData/Microsoft.AspNetCore.OData.xml

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/Microsoft.AspNetCore.OData/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@ const Microsoft.AspNetCore.OData.Routing.ODataSegmentKinds.UnboundAction = "unbo
const Microsoft.AspNetCore.OData.Routing.ODataSegmentKinds.UnboundFunction = "unboundfunction" -> string
const Microsoft.AspNetCore.OData.Routing.ODataSegmentKinds.Unresolved = "unresolved" -> string
const Microsoft.AspNetCore.OData.Routing.ODataSegmentKinds.Value = "$value" -> string
Microsoft.AspNet.OData.Results.BadRequestODataResult
Microsoft.AspNet.OData.Results.BadRequestODataResult.BadRequestODataResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.BadRequestODataResult.BadRequestODataResult(string message) -> void
Microsoft.AspNet.OData.Results.BadRequestODataResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.ConflictODataResult
Microsoft.AspNet.OData.Results.ConflictODataResult.ConflictODataResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.ConflictODataResult.ConflictODataResult(string message) -> void
Microsoft.AspNet.OData.Results.ConflictODataResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.NotFoundODataResult
Microsoft.AspNet.OData.Results.NotFoundODataResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.NotFoundODataResult.NotFoundODataResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.NotFoundODataResult.NotFoundODataResult(string message) -> void
Microsoft.AspNet.OData.Results.ODataErrorResult
Microsoft.AspNet.OData.Results.ODataErrorResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.ODataErrorResult.ODataErrorResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.ODataErrorResult.ODataErrorResult(string errorCode, string message) -> void
Microsoft.AspNet.OData.Results.UnauthorizedODataResult
Microsoft.AspNet.OData.Results.UnauthorizedODataResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.UnauthorizedODataResult.UnauthorizedODataResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.UnauthorizedODataResult.UnauthorizedODataResult(string message) -> void
Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult
Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult.Error.get -> Microsoft.OData.ODataError
Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult.UnprocessableEntityODataResult(Microsoft.OData.ODataError odataError) -> void
Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult.UnprocessableEntityODataResult(string message) -> void
Microsoft.AspNetCore.OData.Abstracts.ETagActionFilterAttribute
Microsoft.AspNetCore.OData.Abstracts.ETagActionFilterAttribute.ETagActionFilterAttribute() -> void
Microsoft.AspNetCore.OData.Abstracts.HttpRequestScope
Expand Down Expand Up @@ -1359,6 +1383,12 @@ Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate
Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.Segment.get -> Microsoft.OData.UriParser.ValueSegment
Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.ValueSegmentTemplate(Microsoft.OData.Edm.IEdmType previousType) -> void
Microsoft.AspNetCore.OData.Routing.Template.ValueSegmentTemplate.ValueSegmentTemplate(Microsoft.OData.UriParser.ValueSegment segment) -> void
override Microsoft.AspNet.OData.Results.BadRequestODataResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNet.OData.Results.ConflictODataResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNet.OData.Results.NotFoundODataResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNet.OData.Results.ODataErrorResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNet.OData.Results.UnauthorizedODataResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult.ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext context) -> System.Threading.Tasks.Task
override Microsoft.AspNetCore.OData.Abstracts.ETagActionFilterAttribute.OnActionExecuted(Microsoft.AspNetCore.Mvc.Filters.ActionExecutedContext actionExecutedContext) -> void
override Microsoft.AspNetCore.OData.Abstracts.NonValidatingParameterBindingAttribute.BindingSource.get -> Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource
override Microsoft.AspNetCore.OData.Batch.ChangeSetRequestItem.SendRequestAsync(Microsoft.AspNetCore.Http.RequestDelegate handler) -> System.Threading.Tasks.Task<Microsoft.AspNetCore.OData.Batch.ODataBatchResponseItem>
Expand Down Expand Up @@ -1822,7 +1852,19 @@ virtual Microsoft.AspNetCore.OData.Query.Validator.SkipTokenQueryValidator.Valid
virtual Microsoft.AspNetCore.OData.Query.Validator.TopQueryValidator.Validate(Microsoft.AspNetCore.OData.Query.TopQueryOption topQueryOption, Microsoft.AspNetCore.OData.Query.Validator.ODataValidationSettings validationSettings) -> void
virtual Microsoft.AspNetCore.OData.Results.CreatedODataResult<T>.Entity.get -> T
virtual Microsoft.AspNetCore.OData.Results.UpdatedODataResult<T>.Entity.get -> T
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.BadRequest(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.BadRequestODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.BadRequest(string message) -> Microsoft.AspNet.OData.Results.BadRequestODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Conflict(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.ConflictODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Conflict(string message) -> Microsoft.AspNet.OData.Results.ConflictODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Created<TEntity>(TEntity entity) -> Microsoft.AspNetCore.OData.Results.CreatedODataResult<TEntity>
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.NotFound(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.NotFoundODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.NotFound(string message) -> Microsoft.AspNet.OData.Results.NotFoundODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.ODataErrorResult(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.ODataErrorResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.ODataErrorResult(string errorCode, string message) -> Microsoft.AspNet.OData.Results.ODataErrorResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Unauthorized(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.UnauthorizedODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Unauthorized(string message) -> Microsoft.AspNet.OData.Results.UnauthorizedODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.UnprocessableEntity(Microsoft.OData.ODataError odataError) -> Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.UnprocessableEntity(string message) -> Microsoft.AspNet.OData.Results.UnprocessableEntityODataResult
virtual Microsoft.AspNetCore.OData.Routing.Controllers.ODataController.Updated<TEntity>(TEntity entity) -> Microsoft.AspNetCore.OData.Results.UpdatedODataResult<TEntity>
virtual Microsoft.AspNetCore.OData.Routing.Conventions.AttributeRoutingConvention.AppliesToAction(Microsoft.AspNetCore.OData.Routing.Conventions.ODataControllerActionContext context) -> bool
virtual Microsoft.AspNetCore.OData.Routing.Conventions.AttributeRoutingConvention.AppliesToController(Microsoft.AspNetCore.OData.Routing.Conventions.ODataControllerActionContext context) -> bool
Expand Down
70 changes: 70 additions & 0 deletions src/Microsoft.AspNetCore.OData/Results/BadRequestODataResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//-----------------------------------------------------------------------------
// <copyright file="BadRequestODataResult.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OData;
using ErrorUtils = Microsoft.AspNetCore.OData.Error;

namespace Microsoft.AspNet.OData.Results
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
{
/// <summary>
/// Represents a result that when executed will produce a Bad Request (400) response.
/// </summary>
/// <remarks>This result creates an <see cref="ODataError"/> with status code: 400.</remarks>
public class BadRequestODataResult : BadRequestResult, IODataErrorResult
{
/// <summary>
/// OData Error.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
public ODataError Error { get; }

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="message">Error Message</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public BadRequestODataResult(string message)
{
if (message == null)
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
{
throw ErrorUtils.ArgumentNull("message");
}

Error = new ODataError
{
Message = message,
ErrorCode = "400"
};
}

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="odataError">OData Error.</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public BadRequestODataResult(ODataError odataError)
{
if (odataError == null)
{
throw ErrorUtils.ArgumentNull("odataError");
}

Error = odataError;
Comment thread
corranrogue9 marked this conversation as resolved.
}

/// <inheritdoc/>
public async override Task ExecuteResultAsync(ActionContext context)
{
Comment thread
corranrogue9 marked this conversation as resolved.
ObjectResult objectResult = new ObjectResult(Error)
{
StatusCode = StatusCodes.Status400BadRequest
};

await objectResult.ExecuteResultAsync(context).ConfigureAwait(false);
}
}
}
70 changes: 70 additions & 0 deletions src/Microsoft.AspNetCore.OData/Results/ConflictODataResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//-----------------------------------------------------------------------------
// <copyright file="ConflictODataResult.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OData;
using ErrorUtils = Microsoft.AspNetCore.OData.Error;

namespace Microsoft.AspNet.OData.Results
{
/// <summary>
/// Represents a result that when executed will produce a Conflict (409) response.
/// </summary>
/// <remarks>This result creates an <see cref="ODataError"/> with status code: 409.</remarks>
public class ConflictODataResult : ConflictResult, IODataErrorResult
{
/// <summary>
/// OData Error.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
public ODataError Error { get; }

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="message">Error Message</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public ConflictODataResult(string message)
{
if (message == null)
{
throw ErrorUtils.ArgumentNull("message");
}

Error = new ODataError
{
Message = message,
ErrorCode = "409"
};
}

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="odataError">OData Error.</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public ConflictODataResult(ODataError odataError)
{
if (odataError == null)
{
throw ErrorUtils.ArgumentNull("odataError");
}

Error = odataError;
}

/// <inheritdoc/>
public async override Task ExecuteResultAsync(ActionContext context)
{
ObjectResult objectResult = new ObjectResult(Error)
{
StatusCode = StatusCodes.Status409Conflict
};

await objectResult.ExecuteResultAsync(context).ConfigureAwait(false);
}
}
}
22 changes: 22 additions & 0 deletions src/Microsoft.AspNetCore.OData/Results/IODataErrorResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//-----------------------------------------------------------------------------
// <copyright file="IODataErrorResult.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using Microsoft.OData;

namespace Microsoft.AspNet.OData.Results
{
/// <summary>
/// Provide the interface for the details of a given OData Error result.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
public interface IODataErrorResult
{
/// <summary>
/// OData Error.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
ODataError Error { get; }
}
}
70 changes: 70 additions & 0 deletions src/Microsoft.AspNetCore.OData/Results/NotFoundODataResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//-----------------------------------------------------------------------------
// <copyright file="NotFoundODataResult.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OData;
using ErrorUtils = Microsoft.AspNetCore.OData.Error;

namespace Microsoft.AspNet.OData.Results
{
/// <summary>
/// Represents a result that when executed will produce a Not Found (404) response.
/// </summary>
/// <remarks>This result creates an <see cref="ODataError"/> with status code: 404.</remarks>
public class NotFoundODataResult : NotFoundResult, IODataErrorResult
{
/// <summary>
/// OData Error.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
public ODataError Error { get; }

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="message">Error Message</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public NotFoundODataResult(string message)
{
if (message == null)
{
throw ErrorUtils.ArgumentNull("message");
}

Error = new ODataError
{
Message = message,
ErrorCode = "404"
};
}

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="odataError">OData Error.</param>
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
public NotFoundODataResult(ODataError odataError)
{
if (odataError == null)
{
throw ErrorUtils.ArgumentNull("odataError");
}

Error = odataError;
}

/// <inheritdoc/>
public async override Task ExecuteResultAsync(ActionContext context)
{
ObjectResult objectResult = new ObjectResult(Error)
{
StatusCode = StatusCodes.Status404NotFound
};

await objectResult.ExecuteResultAsync(context).ConfigureAwait(false);
}
}
}
74 changes: 74 additions & 0 deletions src/Microsoft.AspNetCore.OData/Results/ODataErrorResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//-----------------------------------------------------------------------------
// <copyright file="ODataErrorResult.cs" company=".NET Foundation">
// Copyright (c) .NET Foundation and Contributors. All rights reserved.
// See License.txt in the project root for license information.
// </copyright>
//------------------------------------------------------------------------------

using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OData;
using ErrorUtils = Microsoft.AspNetCore.OData.Error;

namespace Microsoft.AspNet.OData.Results
{
/// <summary>
/// Represents a result that when executed will produce an <see cref="ActionResult"/>.
/// </summary>
/// <remarks>This result creates an <see cref="ODataError"/> response.</remarks>
public class ODataErrorResult : ActionResult, IODataErrorResult
{
/// <summary>
/// OData Error.
Comment thread
KenitoInc marked this conversation as resolved.
Outdated
/// </summary>
public ODataError Error { get; }

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public ODataErrorResult(string errorCode, string message)
Comment thread
gathogojr marked this conversation as resolved.
{
if (errorCode == null)
Comment thread
corranrogue9 marked this conversation as resolved.
Outdated
{
throw ErrorUtils.ArgumentNull("errorCode");
}

if (message == null)
{
throw ErrorUtils.ArgumentNull("message");
}

Error = new ODataError
{
ErrorCode = errorCode,
Message = message
};
}

/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public ODataErrorResult(ODataError odataError)
Comment thread
KenitoInc marked this conversation as resolved.
{
if (odataError == null)
{
throw ErrorUtils.ArgumentNull("odataError");
}

Error = odataError;
}

/// <inheritdoc/>
public async override Task ExecuteResultAsync(ActionContext context)
{
ObjectResult objectResult = new ObjectResult(Error)
{
StatusCode = Convert.ToInt32(Error.ErrorCode, CultureInfo.InvariantCulture)
};

await objectResult.ExecuteResultAsync(context).ConfigureAwait(false);
}
}
}
Loading