Skip to content

Commit

Permalink
Fix/aspnet build failure issues (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
KenitoInc authored Mar 8, 2023
1 parent 8976d24 commit 6c541f2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1006,4 +1006,7 @@
<data name="DeltaLinkNotSupported" xml:space="preserve">
<value>DeltaLinks are not supported</value>
</data>
<data name="ObjectToDeleteNotFound" xml:space="preserve">
<value>Object to delete not found.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ private void CopyChangedDynamicValues(TStructuralType targetEntity)
/// <param name="original">The structural object</param>
/// <param name="apiHandler">API Handler for the entity.</param>
/// <param name="apiHandlerFactory">API Handler Factory</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
private void CopyChangedNestedProperties(TStructuralType original, ODataAPIHandler<TStructuralType> apiHandler = null, ODataAPIHandlerFactory apiHandlerFactory = null)
{
// For nested resources.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNet.OData.Shared/DeltaSetOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ internal DeltaSet<TStructuralType> CopyChangedValues(IODataAPIHandler apiHandler
// Handle Failed Operation - Delete when the object doesn't exist.
IDeltaSetItem deltaSetItem = changedObj;
DataModificationExceptionType dataModificationExceptionType = new DataModificationExceptionType(operation);
dataModificationExceptionType.MessageType = new MessageType { Message = "Object to delete not found." };
dataModificationExceptionType.MessageType = new MessageType { Message = SRResources.ObjectToDeleteNotFound };

deltaSetItem.TransientInstanceAnnotationContainer.AddResourceAnnotation(SRResources.DataModificationException, dataModificationExceptionType);
deltaSet.Add(deltaSetItem);
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.AspNet.OData.Shared/IODataAPIHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Microsoft.AspNet.OData
/// This is being implemented by ODataAPIHandler{TStructuralType} which has a method returning nested ODataApiHandler.
/// A generic empty interface is needed since the nested patch handler will be of different type.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
public interface IODataAPIHandler
{

Expand Down
6 changes: 5 additions & 1 deletion src/Microsoft.AspNet.OData.Shared/ODataAPIHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public abstract class ODataAPIHandler<TStructuralType>: IODataAPIHandler where T
/// <param name="originalObject">Object to return.</param>
/// <param name="errorMessage">Any error message in case of an exception.</param>
/// <returns>The status of the TryGet method <see cref="ODataAPIResponseStatus"/>.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")]
public abstract ODataAPIResponseStatus TryGet(IDictionary<string, object> keyValues, out TStructuralType originalObject, out string errorMessage);

/// <summary>
Expand All @@ -47,6 +49,7 @@ public abstract class ODataAPIHandler<TStructuralType>: IODataAPIHandler where T
/// <param name="keyValues">Key-value pair for the entity keys.</param>
/// <param name="errorMessage">Any error message in case of an exception.</param>
/// <returns>The status of the TryGet method <see cref="ODataAPIResponseStatus"/>.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")]
public abstract ODataAPIResponseStatus TryDelete(IDictionary<string, object> keyValues, out string errorMessage);

/// <summary>
Expand All @@ -55,6 +58,7 @@ public abstract class ODataAPIHandler<TStructuralType>: IODataAPIHandler where T
/// <param name="resource">The object to be added.</param>
/// <param name="errorMessage">Any error message in case of an exception.</param>
/// <returns>The status of the AddRelatedObject method <see cref="ODataAPIResponseStatus"/>.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")]
public abstract ODataAPIResponseStatus TryAddRelatedObject(TStructuralType resource, out string errorMessage);

/// <summary>
Expand Down Expand Up @@ -84,7 +88,7 @@ internal virtual void UpdateLinkedObjects(TStructuralType resource, IEdmModel mo
}
}

private ODataPath GetODataPath(string path, IEdmModel model)
private static ODataPath GetODataPath(string path, IEdmModel model)
{
ODataUriParser parser = new ODataUriParser(model, new Uri(path, UriKind.Relative));
ODataPath odataPath = parser.ParsePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ protected ODataAPIHandlerFactory(IEdmModel model)
/// </summary>
/// <param name="odataPath">OData path corresponding to an @odata.id.</param>
/// <returns>ODataAPIHandler for the specified OData path.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "1#")]
public abstract IODataAPIHandler GetHandler(ODataPath odataPath);

/// <summary>
Expand Down

0 comments on commit 6c541f2

Please sign in to comment.