-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add datamodificationexception class #914
Draft
ElizabethOkerio
wants to merge
3
commits into
OData:release-8.x
Choose a base branch
from
ElizabethOkerio:feature/add_data_modification_class
base: release-8.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I don't like this interface and the methods defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you suggest it be replaced with? |
||
{ | ||
/// <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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where and how can customer set this interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when they are creating the response. If there are operations in the
DeltaSet
that failed then you need to create DataModificationExceptions. This is the time customers will need this interface.