-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea4e79c
commit d73d3af
Showing
10 changed files
with
651 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
src/Microsoft.AspNetCore.OData/DataModificationExceptionType.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,118 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="DataModificationExceptionType.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; | ||
|
||
namespace Org.OData.Core.V1 | ||
{ | ||
/// <summary> | ||
/// Represents a message type. | ||
/// </summary> | ||
public class MessageType | ||
{ | ||
/// <summary> | ||
/// Code of message. | ||
/// </summary> | ||
public string Code { get; set; } | ||
|
||
/// <summary> | ||
/// Actual message. | ||
/// </summary> | ||
public string Message { get; set; } | ||
|
||
/// <summary> | ||
/// Severity of message. | ||
/// </summary> | ||
public string Severity { get; set; } | ||
|
||
/// <summary> | ||
/// Target of message. | ||
/// </summary> | ||
public string Target { get; set; } | ||
|
||
/// <summary> | ||
/// Details of message. | ||
/// </summary> | ||
public string Details { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Represents an exception type. | ||
/// </summary> | ||
public abstract class ExceptionType | ||
{ | ||
/// <summary> | ||
/// Represents a message type. | ||
/// </summary> | ||
public MessageType MessageType { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Represents the type of exception thrown during a data modification operation. | ||
/// </summary> | ||
public class DataModificationExceptionType : ExceptionType | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="DataModificationExceptionType"/> class. | ||
/// </summary> | ||
public DataModificationExceptionType(DataModificationOperationKind failedOperation) | ||
{ | ||
this.FailedOperation = failedOperation; | ||
} | ||
|
||
/// <summary> | ||
/// Represents the kind of data modification operation. | ||
/// </summary> | ||
public DataModificationOperationKind FailedOperation { get; } | ||
|
||
/// <summary> | ||
/// Represents the response code. | ||
/// </summary> | ||
public Int16 ResponseCode { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Enumerates the kind of data modification operations. | ||
/// </summary> | ||
public enum DataModificationOperationKind | ||
{ | ||
/// <summary> | ||
/// Represents an insert operation. | ||
/// </summary> | ||
Insert, | ||
|
||
/// <summary> | ||
/// Represents an update operation. | ||
/// </summary> | ||
Update, | ||
|
||
/// <summary> | ||
/// Represents an insert or update operation if item already exists. | ||
/// </summary> | ||
Upsert, | ||
|
||
/// <summary> | ||
/// Represents a delete data modification operation. | ||
/// </summary> | ||
Delete, | ||
|
||
/// <summary> | ||
/// Represents an action or function invocation. | ||
/// </summary> | ||
Invoke, | ||
|
||
/// <summary> | ||
/// Represents adding a link between entities. | ||
/// </summary> | ||
Link, | ||
|
||
/// <summary> | ||
/// Represents removing a link between entities. | ||
/// </summary> | ||
Unlink | ||
} | ||
} |
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
61 changes: 61 additions & 0 deletions
61
src/Microsoft.AspNetCore.OData/IODataInstanceAnnotationContainer.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,61 @@ | ||
//----------------------------------------------------------------------------- | ||
// <copyright file="IODataInstanceAnnotationContainer.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.Collections.Generic; | ||
|
||
namespace Microsoft.AspNetCore.OData | ||
{ | ||
/// <summary> | ||
/// Identifies a container for holding instance annotations. A default implementation is provided. | ||
/// Customers can have their own implementation. | ||
/// </summary> | ||
public interface IODataInstanceAnnotationContainer | ||
{ | ||
/// <summary> | ||
/// Method to Add an Instance Annotation to the CLR type | ||
/// </summary> | ||
/// <param name="annotationName">Name of Annotation</param> | ||
/// <param name="value">Value of Annotation</param> | ||
void AddResourceAnnotation(string annotationName, object value); | ||
|
||
/// <summary> | ||
/// Method to Add an Instance Annotation to a property | ||
/// </summary> | ||
/// <param name="propertyName">Name of the property</param> | ||
/// <param name="annotationName">Name of Annotation</param> | ||
/// <param name="value">Value of Annotation</param> | ||
void AddPropertyAnnotation(string propertyName, string annotationName, object value); | ||
|
||
/// <summary> | ||
/// Get an Instance Annotation from CLR Type | ||
/// </summary> | ||
/// <param name="annotationName">Name of Annotation</param> | ||
/// <returns>Get Annotation value for the given annotation</returns> | ||
object GetResourceAnnotation(string annotationName); | ||
|
||
/// <summary> | ||
/// Get an Instance Annotation from the Property | ||
/// </summary> | ||
/// <param name="propertyName">Name of the Property</param> | ||
/// <param name="annotationName">Name of the Annotation</param> | ||
/// <returns>Get Annotation value for the given annotation and property</returns> | ||
object GetPropertyAnnotation(string propertyName, string annotationName); | ||
|
||
/// <summary> | ||
/// Get All Annotations from CLR Type | ||
/// </summary> | ||
/// <returns>Dictionary of string(annotation name) and object value(annotation value)</returns> | ||
IDictionary<string, object> GetResourceAnnotations(); | ||
|
||
/// <summary> | ||
/// Get all Annotations for a Property | ||
/// </summary> | ||
/// <param name="propertyName">Name of Property</param> | ||
/// <returns>Dictionary of string(annotation name) and object value(annotation value)</returns> | ||
IDictionary<string, object> GetPropertyAnnotations(string propertyName); | ||
} | ||
} |
Oops, something went wrong.