Skip to content
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

Deprecated public calls with unused parameters #848

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions src/Simple.OData.Client.Core/Adapter/ResponseReaderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ public async Task AssignBatchActionResultsAsync(IODataClient client,

protected abstract void ConvertEntry(ResponseNode entryNode, object entry);

[Obsolete("The feed annotations are ignored. Use the method StartFeed(Stack<ResponseNode> nodeStack) instead.")]
protected void StartFeed(Stack<ResponseNode> nodeStack, ODataFeedAnnotations feedAnnotations)
{
StartFeed(nodeStack);
}

protected void StartFeed(Stack<ResponseNode> nodeStack)
{
nodeStack.Push(new ResponseNode
{
Expand Down
11 changes: 10 additions & 1 deletion src/Simple.OData.Client.Core/Cache/ITypeCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,23 @@ public interface ITypeCache
/// <returns></returns>
IEnumerable<FieldInfo> GetAllFields(Type type);

/// <summary>
/// Get a field for a type
/// </summary>
/// <param name="type"></param>
/// <param name="fieldName"></param>
/// <returns></returns>
[Obsolete("The includeNonPublic field is ignored. Use the method GetAnyField(Type type, string fieldName) instead.")]
FieldInfo GetAnyField(Type type, string fieldName, bool includeNonPublic);

/// <summary>
/// Get a field for a type
/// </summary>
/// <param name="type"></param>
/// <param name="fieldName"></param>
/// <param name="includeNonPublic"></param>
/// <returns></returns>
FieldInfo GetAnyField(Type type, string fieldName, bool includeNonPublic = false);
FieldInfo GetAnyField(Type type, string fieldName);

/// <summary>
/// Get declared fields for a type
Expand Down
12 changes: 10 additions & 2 deletions src/Simple.OData.Client.Core/Cache/TypeCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,17 @@ public IEnumerable<FieldInfo> GetAllFields(Type type)
}

/// <copydoc cref="ITypeCache.GetAnyField" />
public FieldInfo GetAnyField(Type type, string fieldName, bool includeNonPublic = false)

[Obsolete("The includeNonPublic field is ignored. Use the method GetAnyField(Type type, string fieldName) instead.")]
public FieldInfo GetAnyField(Type type, string fieldName, bool includeNonPublic)
{
return GetAnyField(type, fieldName);
}

/// <copydoc cref="ITypeCache.GetAnyField" />
public FieldInfo GetAnyField(Type type, string fieldName)
{
return Resolver(type).GetAnyField(fieldName, includeNonPublic);
return Resolver(type).GetAnyField(fieldName);
}

/// <copydoc cref="ITypeCache.GetDeclaredFields" />
Expand Down
8 changes: 7 additions & 1 deletion src/Simple.OData.Client.Core/Cache/TypeCacheResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ public PropertyInfo GetDeclaredProperty(string propertyName)
return TypeInfo.GetDeclaredProperty(propertyName);
}

public FieldInfo GetAnyField(string fieldName, bool includeNonPublic = false)
[Obsolete("The includeNonPublic field is ignored. Use the method GetAnyField(string fieldName) instead.")]
public FieldInfo GetAnyField(string fieldName, bool includeNonPublic)
{
return GetAnyField(fieldName);
}

public FieldInfo GetAnyField(string fieldName)
{
var currentType = Type;
while (currentType != null && currentType != typeof(object))
Expand Down
8 changes: 7 additions & 1 deletion src/Simple.OData.Client.Core/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ public static IEnumerable<FieldInfo> GetAllFields(this Type type)
return fields.ToArray();
}

public static FieldInfo GetAnyField(this Type type, string fieldName, bool includeNonPublic = false)
[Obsolete("The includeNonPublic field is ignored. Use the method GetAnyField(Type type, string fieldName) instead.")]
public static FieldInfo GetAnyField(this Type type, string fieldName, bool includeNonPublic)
{
return GetAnyField(type, fieldName);
}

public static FieldInfo GetAnyField(this Type type, string fieldName)
{
var currentType = type;
while (currentType != null && currentType != typeof(object))
Expand Down
22 changes: 20 additions & 2 deletions src/Simple.OData.Client.Core/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,33 @@
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage(
"Style", "IDE0060:Remove unused parameter",
"Style",
"IDE0060:Remove unused parameter",
Justification = "Required signature",
Scope = "member",
Target = "~M:Simple.OData.Client.ODataExpression.op_True(Simple.OData.Client.ODataExpression)~System.Boolean")
]

[assembly: SuppressMessage(
"Style", "IDE0060:Remove unused parameter",
"Style",
"IDE0060:Remove unused parameter",
Justification = "Required signature",
Scope = "member",
Target = "~M:Simple.OData.Client.ODataExpression`1.op_True(Simple.OData.Client.ODataExpression`1)~System.Boolean")
]

[assembly: SuppressMessage(
"Style",
"IDE0060:Remove unused parameter",
Justification = "Required signature",
Scope = "member",
Target = "~M:Simple.OData.Client.ODataExpression.op_False(Simple.OData.Client.ODataExpression)~System.Boolean")
]

[assembly: SuppressMessage(
"Style",
"IDE0060:Remove unused parameter",
Justification = "Required signature",
Scope = "member",
Target = "~M:Simple.OData.Client.ODataExpression`1.op_False(Simple.OData.Client.ODataExpression`1)~System.Boolean")
]
4 changes: 2 additions & 2 deletions src/Simple.OData.Client.Core/SimplePluralizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private class Word
{
public readonly string Singular;
public readonly string Plural;
public Word(string singular, string plural, string plural2)
public Word(string singular, string plural)
{
Singular = singular;
Plural = plural;
Expand Down Expand Up @@ -231,7 +231,7 @@ private static void PopulateLookupTables()
p = s;
}

var w = new Word(s, p, p2);
var w = new Word(s, p);
_specialSingulars.Add(s, w);
_specialPlurals.Add(p, w);
if (!string.IsNullOrEmpty(p2))
Expand Down
8 changes: 4 additions & 4 deletions src/Simple.OData.Client.V3.Adapter/ResponseReader.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Microsoft.Data.Edm;
using Microsoft.Data.OData;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Data.Edm;
using Microsoft.Data.OData;

namespace Simple.OData.Client.V3.Adapter
{
Expand Down Expand Up @@ -174,7 +174,7 @@ private ODataResponse ReadResponse(ODataReader odataReader, IODataResponseMessag
switch (odataReader.State)
{
case ODataReaderState.FeedStart:
StartFeed(nodeStack, CreateAnnotations(odataReader.Item as ODataFeed));
StartFeed(nodeStack);
break;

case ODataReaderState.FeedEnd:
Expand Down
2 changes: 1 addition & 1 deletion src/Simple.OData.Client.V4.Adapter/ResponseReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private ODataResponse ReadResponse(ODataReader odataReader, IODataResponseMessag
{
case ODataReaderState.ResourceSetStart:
case ODataReaderState.DeltaResourceSetStart:
StartFeed(nodeStack, CreateAnnotations(odataReader.Item as ODataResourceSetBase));
StartFeed(nodeStack);
break;

case ODataReaderState.ResourceSetEnd:
Expand Down