diff --git a/src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs b/src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs index 5d350ccf7c..6596fd4e34 100644 --- a/src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs +++ b/src/Microsoft.AspNet.OData.Shared/Common/SRResources.Designer.cs @@ -2280,6 +2280,17 @@ internal static string Object_NotYetInitialized } } + /// + /// Looks up a localized string similar to Object to delete not found.. + /// + internal static string ObjectToDeleteNotFound + { + get + { + return ResourceManager.GetString("ObjectToDeleteNotFound", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unknown function '{0}'.. /// diff --git a/src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx b/src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx index f94864ec2e..93ed987ced 100644 --- a/src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx +++ b/src/Microsoft.AspNet.OData.Shared/Common/SRResources.resx @@ -1006,4 +1006,7 @@ DeltaLinks are not supported + + Object to delete not found. + \ No newline at end of file diff --git a/src/Microsoft.AspNet.OData.Shared/DeltaOfTStructuralType.cs b/src/Microsoft.AspNet.OData.Shared/DeltaOfTStructuralType.cs index f60e4ec76b..c2433d939c 100644 --- a/src/Microsoft.AspNet.OData.Shared/DeltaOfTStructuralType.cs +++ b/src/Microsoft.AspNet.OData.Shared/DeltaOfTStructuralType.cs @@ -868,6 +868,7 @@ private void CopyChangedDynamicValues(TStructuralType targetEntity) /// The structural object /// API Handler for the entity. /// API Handler Factory + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] private void CopyChangedNestedProperties(TStructuralType original, ODataAPIHandler apiHandler = null, ODataAPIHandlerFactory apiHandlerFactory = null) { // For nested resources. diff --git a/src/Microsoft.AspNet.OData.Shared/DeltaSetOfT.cs b/src/Microsoft.AspNet.OData.Shared/DeltaSetOfT.cs index 4a095c53da..b0b410e29b 100644 --- a/src/Microsoft.AspNet.OData.Shared/DeltaSetOfT.cs +++ b/src/Microsoft.AspNet.OData.Shared/DeltaSetOfT.cs @@ -226,7 +226,7 @@ internal DeltaSet 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); diff --git a/src/Microsoft.AspNet.OData.Shared/IODataAPIHandler.cs b/src/Microsoft.AspNet.OData.Shared/IODataAPIHandler.cs index 2ef3a76597..1139f8f251 100644 --- a/src/Microsoft.AspNet.OData.Shared/IODataAPIHandler.cs +++ b/src/Microsoft.AspNet.OData.Shared/IODataAPIHandler.cs @@ -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. /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] public interface IODataAPIHandler { diff --git a/src/Microsoft.AspNet.OData.Shared/ODataAPIHandler.cs b/src/Microsoft.AspNet.OData.Shared/ODataAPIHandler.cs index 41cf609fc0..4ab8a0ec48 100644 --- a/src/Microsoft.AspNet.OData.Shared/ODataAPIHandler.cs +++ b/src/Microsoft.AspNet.OData.Shared/ODataAPIHandler.cs @@ -39,6 +39,8 @@ public abstract class ODataAPIHandler: IODataAPIHandler where T /// Object to return. /// Any error message in case of an exception. /// The status of the TryGet method . + [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 keyValues, out TStructuralType originalObject, out string errorMessage); /// @@ -47,6 +49,7 @@ public abstract class ODataAPIHandler: IODataAPIHandler where T /// Key-value pair for the entity keys. /// Any error message in case of an exception. /// The status of the TryGet method . + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")] public abstract ODataAPIResponseStatus TryDelete(IDictionary keyValues, out string errorMessage); /// @@ -55,6 +58,7 @@ public abstract class ODataAPIHandler: IODataAPIHandler where T /// The object to be added. /// Any error message in case of an exception. /// The status of the AddRelatedObject method . + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "1#")] public abstract ODataAPIResponseStatus TryAddRelatedObject(TStructuralType resource, out string errorMessage); /// @@ -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(); diff --git a/src/Microsoft.AspNet.OData.Shared/ODataAPIHandlerFactory.cs b/src/Microsoft.AspNet.OData.Shared/ODataAPIHandlerFactory.cs index 4c0a69fb0f..02fbe53286 100644 --- a/src/Microsoft.AspNet.OData.Shared/ODataAPIHandlerFactory.cs +++ b/src/Microsoft.AspNet.OData.Shared/ODataAPIHandlerFactory.cs @@ -35,6 +35,7 @@ protected ODataAPIHandlerFactory(IEdmModel model) /// /// OData path corresponding to an @odata.id. /// ODataAPIHandler for the specified OData path. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "1#")] public abstract IODataAPIHandler GetHandler(ODataPath odataPath); ///