Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 6df566a

Browse files
committed
Ported changes from version 5. Updated linq2db to 3.4.5. Bump version.
1 parent 91a2ef5 commit 6df566a

File tree

8 files changed

+47
-7
lines changed

8 files changed

+47
-7
lines changed

Build/linq2db.Default.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.1.0</Version>
3+
<Version>2.2.0</Version>
44

55
<Authors>Svyatoslav Danyliv, Igor Tkachev, Dmitry Lukashenko, Ilya Chudin</Authors>
66
<Product>Linq to DB</Product>

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<PackageVersion Include="NUnit" Version="3.13.2" />
66
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
77

8-
<PackageVersion Include="linq2db" Version="3.4.4" />
9-
<PackageVersion Include="linq2db.Tools" Version="3.4.4" />
8+
<PackageVersion Include="linq2db" Version="3.4.5" />
9+
<PackageVersion Include="linq2db.Tools" Version="3.4.5" />
1010

1111
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
1212
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />

NuGet/linq2db.EntityFrameworkCore.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependencies>
1717
<group targetFramework=".NETStandard2.0">
1818
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="2.2.6" />
19-
<dependency id="linq2db" version="3.4.4" />
19+
<dependency id="linq2db" version="3.4.5" />
2020
</group>
2121
</dependencies>
2222
</metadata>

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,23 @@ public override int GetHashCode()
484484
return found;
485485
}
486486

487+
private static PropertyInfo GetPropertyInfoForType(Type type, PropertyInfo propInfo)
488+
{
489+
if (propInfo.DeclaringType == type)
490+
return propInfo;
491+
492+
var found = type.GetProperties()
493+
.FirstOrDefault(x => x.Module == propInfo.Module && x.MetadataToken == propInfo.MetadataToken);
494+
495+
return found ?? propInfo;
496+
}
497+
487498
private Sql.ExpressionAttribute? GetDbFunctionFromProperty(Type type, PropertyInfo propInfo)
488499
{
489500
if (_dependencies == null || _model == null)
490501
return null;
491502

492-
propInfo = (PropertyInfo?) type.GetMemberEx(propInfo) ?? propInfo;
503+
propInfo = GetPropertyInfoForType(type, propInfo);
493504

494505
var found = _calculatedExtensions.GetOrAdd(propInfo, mi =>
495506
{

Tests/LinqToDB.EntityFrameworkCore.BaseTests/ForMappingTestsBase.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,14 @@ public virtual async Task TestUIntTable()
108108
var item = await context.UIntTable.FirstOrDefaultAsyncLinqToDB(e => e.Field64 == field64);
109109
}
110110

111+
[Test]
112+
public virtual void TestAmbiguousProperties()
113+
{
114+
using var context = CreateContext();
115+
116+
FluentActions.Awaiting(() => context.WithDuplicateProperties.Where(x => x.Value == 1)
117+
.ToArrayAsyncLinqToDB()).Should().NotThrow();
118+
}
119+
111120
}
112121
}

Tests/LinqToDB.EntityFrameworkCore.BaseTests/Models/ForMapping/ForMappingContextBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ protected ForMappingContextBase(DbContextOptions options) : base(options)
1212
public DbSet<NoIdentity> NoIdentity { get; set; } = null!;
1313
public DbSet<UIntTable> UIntTable { get; set; } = null!;
1414
public DbSet<StringTypes> StringTypes { get; set; } = null!;
15+
16+
public DbSet<WithDuplicateProperties> WithDuplicateProperties { get; set; } = null!;
1517
}
1618
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace LinqToDB.EntityFrameworkCore.BaseTests.Models.ForMapping
4+
{
5+
6+
public class WithDuplicatePropertiesBase
7+
{
8+
[Key]
9+
public int Id { get; set; }
10+
11+
public virtual string? Value { get; set; }
12+
}
13+
14+
public class WithDuplicateProperties : WithDuplicatePropertiesBase
15+
{
16+
public new int? Value { get; set; }
17+
}
18+
}

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
variables:
22
solution: 'linq2db.EFCore.sln'
33
build_configuration: 'Release'
4-
assemblyVersion: 2.1.0
5-
nugetVersion: 2.1.0
4+
assemblyVersion: 2.2.0
5+
nugetVersion: 2.2.0
66
artifact_nugets: 'nugets'
77

88
# build on commits to important branches (master + release branches):

0 commit comments

Comments
 (0)