Skip to content

Commit

Permalink
Change internal usage from obsolete IDynamicLinkCustomTypeProvider to…
Browse files Browse the repository at this point in the history
… IDynamicLinqCustomTypeProvider (#879)
  • Loading branch information
StefH authored Jan 24, 2025
1 parent 78cda51 commit fca802e
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 26 deletions.
6 changes: 5 additions & 1 deletion src-console/ConsoleAppEF2.0.2_InMemory/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ public string GetDisplayName(bool a, bool b, bool c)
}
}

class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
public C() : base(new List<Type>())
{
}

public HashSet<Type> GetCustomTypes()
{
// https://stackoverflow.com/a/2384679/255966
Expand Down
6 changes: 5 additions & 1 deletion src-console/ConsoleAppEF2.0/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ namespace ConsoleAppEF2
{
class Program
{
class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
public C() : base(new List<Type>())
{
}

public HashSet<Type> GetCustomTypes()
{
// https://stackoverflow.com/a/2384679/255966
Expand Down
5 changes: 4 additions & 1 deletion src-console/ConsoleAppEF2.1.1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ namespace ConsoleAppEF211
{
class Program
{
class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
public C() : base(new List<Type>())
{
}
public HashSet<Type> GetCustomTypes()
{
// https://stackoverflow.com/a/2384679/255966
Expand Down
2 changes: 1 addition & 1 deletion src-console/ConsoleAppEF2.1/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ConsoleAppEF21
{
class Program
{
//class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
//class C : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
//{
// public HashSet<Type> GetCustomTypes()
// {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace System.Linq.Dynamic.Core.CustomTypeProviders;
///
/// This class is used as default for full .NET Framework and .NET Core App 2.x and higher.
/// </summary>
public class DefaultDynamicLinqCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
public class DefaultDynamicLinqCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
private readonly IAssemblyHelper _assemblyHelper;
private readonly bool _cacheCustomTypes;
Expand Down
6 changes: 3 additions & 3 deletions src/System.Linq.Dynamic.Core/ParsingConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace System.Linq.Dynamic.Core;
/// </summary>
public class ParsingConfig
{
private IDynamicLinkCustomTypeProvider? _customTypeProvider;
private IDynamicLinqCustomTypeProvider? _customTypeProvider;
private IExpressionPromoter? _expressionPromoter;
private IQueryableAnalyzer? _queryableAnalyzer;

Expand Down Expand Up @@ -52,9 +52,9 @@ public class ParsingConfig
public bool IsCaseSensitive { get; set; }

/// <summary>
/// Gets or sets the <see cref="IDynamicLinkCustomTypeProvider"/>.
/// Gets or sets the <see cref="IDynamicLinqCustomTypeProvider"/>.
/// </summary>
public IDynamicLinkCustomTypeProvider? CustomTypeProvider
public IDynamicLinqCustomTypeProvider? CustomTypeProvider
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace WindowsUniversalTestApp14393
{
class WindowsAppCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
class WindowsAppCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
public HashSet<Type> GetCustomTypes()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace WindowsUniversalTestApp16299
{
class WindowsAppCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
class WindowsAppCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
public HashSet<Type> GetCustomTypes()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ public void DynamicExpressionParser_ParseLambda_IQueryable()
public void DynamicExpressionParser_ParseLambda_Issue58()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns([typeof(MyClass)]);
var config = new ParsingConfig
{
Expand Down Expand Up @@ -1774,7 +1774,7 @@ public void DynamicExpressionParser_ParseLambda_StringEquals_WithMemberString()
public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_0_Arguments()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns([typeof(Foo)]);
var config = new ParsingConfig
{
Expand All @@ -1797,7 +1797,7 @@ public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_0
public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_1_Argument()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns([typeof(Foo)]);
var config = new ParsingConfig
{
Expand All @@ -1820,7 +1820,7 @@ public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_1
public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_2_Arguments()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns([typeof(Foo)]);
var config = new ParsingConfig
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class ExpressionTests
{
private static ParsingConfig CreateParsingConfigForMethodCallTests()
{
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(User), typeof(Methods), typeof(Foo) });
return new ParsingConfig
{
Expand Down
4 changes: 2 additions & 2 deletions test/System.Linq.Dynamic.Core.Tests/ExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void ExpressionTests_Cast_To_FullTypeNullableEnum_Using_DynamicLinqType()
public void ExpressionTests_Cast_To_Enum_Using_CustomTypeProvider()
{
// Arrange
var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>();
var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinqCustomTypeProvider>();
dynamicLinqCustomTypeProviderMock.Setup(d => d.GetCustomTypes()).Returns(new HashSet<Type> { typeof(SimpleValuesModelEnum) });
var config = new ParsingConfig
{
Expand Down Expand Up @@ -380,7 +380,7 @@ public void ExpressionTests_Cast_To_NullableEnum_Using_DynamicLinqType()
public void ExpressionTests_Cast_To_NullableEnum_Using_CustomTypeProvider()
{
// Arrange
var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>();
var dynamicLinqCustomTypeProviderMock = new Mock<IDynamicLinqCustomTypeProvider>();
dynamicLinqCustomTypeProviderMock.Setup(d => d.GetCustomTypes()).Returns(new HashSet<Type>
{
typeof(SimpleValuesModelEnum),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace System.Linq.Dynamic.Core.Tests.Parser;

public partial class ExpressionParserTests
{
private readonly Mock<IDynamicLinkCustomTypeProvider> _dynamicTypeProviderMock;
private readonly Mock<IDynamicLinqCustomTypeProvider> _dynamicTypeProviderMock;

private readonly ParsingConfig _parsingConfig;

Expand All @@ -34,7 +34,7 @@ public class MyView

public ExpressionParserTests()
{
_dynamicTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>();
_dynamicTypeProviderMock = new Mock<IDynamicLinqCustomTypeProvider>();
_dynamicTypeProviderMock.Setup(dt => dt.GetCustomTypes()).Returns(new HashSet<Type>() { typeof(Company), typeof(MainCompany) });
_dynamicTypeProviderMock.Setup(dt => dt.ResolveType(typeof(Company).FullName!)).Returns(typeof(Company));
_dynamicTypeProviderMock.Setup(dt => dt.ResolveType(typeof(MainCompany).FullName!)).Returns(typeof(MainCompany));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public class SampleDto
}

private readonly Mock<IExpressionPromoter> _expressionPromoterMock;
private readonly Mock<IDynamicLinkCustomTypeProvider> _dynamicLinkCustomTypeProviderMock;
private readonly Mock<IDynamicLinqCustomTypeProvider> _dynamicLinkCustomTypeProviderMock;

public ExpressionPromoterTests()
{
_dynamicLinkCustomTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>();
_dynamicLinkCustomTypeProviderMock = new Mock<IDynamicLinqCustomTypeProvider>();
_dynamicLinkCustomTypeProviderMock.Setup(d => d.GetCustomTypes()).Returns(new HashSet<Type>());
_dynamicLinkCustomTypeProviderMock.Setup(d => d.ResolveType(It.IsAny<string>())).Returns(typeof(SampleDto));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class TypeFinderTests

public TypeFinderTests()
{
var dynamicTypeProviderMock = new Mock<IDynamicLinkCustomTypeProvider>();
var dynamicTypeProviderMock = new Mock<IDynamicLinqCustomTypeProvider>();
dynamicTypeProviderMock.Setup(dt => dt.ResolveType(typeof(BaseEmployee).FullName!)).Returns(typeof(BaseEmployee));
dynamicTypeProviderMock.Setup(dt => dt.ResolveType(typeof(Boss).FullName!)).Returns(typeof(Boss));
dynamicTypeProviderMock.Setup(dt => dt.ResolveType(typeof(Worker).FullName!)).Returns(typeof(Worker));
Expand Down
6 changes: 3 additions & 3 deletions test/System.Linq.Dynamic.Core.Tests/QueryableTests.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class QueryableTests
public void CallMethod()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Test) });
var config = new ParsingConfig
{
Expand All @@ -30,7 +30,7 @@ public void CallMethod()
public void CallMethodWhichReturnsNullable()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Test) });
var config = new ParsingConfig
{
Expand All @@ -49,7 +49,7 @@ public void CallMethodWhichReturnsNullable()
public void CallMethodWhichReturnsNullable_WithValue()
{
// Arrange
var customTypeProvider = new Mock<IDynamicLinkCustomTypeProvider>();
var customTypeProvider = new Mock<IDynamicLinqCustomTypeProvider>();
customTypeProvider.Setup(c => c.GetCustomTypes()).Returns(new HashSet<Type> { typeof(Test) });
var config = new ParsingConfig
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace System.Linq.Dynamic.Core.Tests
{
public class TestCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinkCustomTypeProvider
public class TestCustomTypeProvider : AbstractDynamicLinqCustomTypeProvider, IDynamicLinqCustomTypeProvider
{
private HashSet<Type>? _customTypes;

Expand Down

0 comments on commit fca802e

Please sign in to comment.