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

Fix computed abstract property decompilation #180

Merged
merged 10 commits into from
Dec 14, 2021
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DelegateDecompiler.EntityFramework.Tests.EfItems.Abstracts
{
#if EF_CORE
public class AtlanticCod : Fish<int>
{
public override string Species => "Gadus morhua";
}
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace DelegateDecompiler.EntityFramework.Tests.EfItems.Abstracts
{
#if EF_CORE
public abstract class Fish : LivingBeeing
{
[Computed]
public abstract string Group { get; }
}

public abstract class Fish<T> : Fish
{
public override string Group => "Fish";
}
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace DelegateDecompiler.EntityFramework.Tests.EfItems.Abstracts
{
#if EF_CORE
public class WhiteShark : Fish<string>
{
public override string Species => "Carcharodon carcharias";
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ private static ICollection<LivingBeeing> InitializeLivingBeeings()
animal2,
new HoneyBee(),
new HoneyBee(),
#if EF_CORE
new AtlanticCod() { Age = 4 },
new WhiteShark() { Age = 1 },
#endif
new Person {Age = 1, Birthdate = new DateTime(1900, 1, 1), Name = "Joseph"},
new Person {Age = 2, Birthdate = new DateTime(1900, 1, 2), Name = "Maria"},
new Person
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder)
modelBuilder.Entity<Dog>();
modelBuilder.Entity<HoneyBee>();
modelBuilder.Entity<Person>();
#if EF_CORE
modelBuilder.Entity<Fish>();
modelBuilder.Entity<Fish<string>>().HasBaseType<Fish>();
modelBuilder.Entity<Fish<int>>().HasBaseType<Fish>();
modelBuilder.Entity<WhiteShark>().HasBaseType<Fish<string>>();
modelBuilder.Entity<AtlanticCod>().HasBaseType<Fish<int>>();
#endif
base.OnModelCreating(modelBuilder);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework v6.1](http://msdn.microsoft.com/en-us/data/aa937723) (EF).
Expand Down Expand Up @@ -32,7 +32,7 @@ More will appear as we move forward.*
* Select Method Without Computed Attribute (line 104)
* Select Abstract Member Over Tph Hierarchy (line 121)
* Select Abstract Member Over Tph Hierarchy After Restricting To Subtype (line 138)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)

#### [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs):
- Supported
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail With Sql of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework v6.1](http://msdn.microsoft.com/en-us/data/aa937723) (EF).
Expand Down Expand Up @@ -90,7 +90,7 @@ SELECT
WHERE ([Extent1].[Discriminator] IN (N'Dog',N'HoneyBee',N'Person')) AND ([Extent1].[Discriminator] IN (N'Dog',N'HoneyBee'))
```

* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)
* T-Sql executed is

```SQL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework v6.1](http://msdn.microsoft.com/en-us/data/aa937723) (EF).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,50 @@ public void TestSelectAbstractMemberOverTphHierarchyAfterRestrictingToSubtype()
}
}

#if EF_CORE
[Test]
public void TestSelectAbstractMemberOverTphHierarchyWithGenericClassesAfterRestrictingToSubtype()
{
using (var env = new MethodEnvironment(classEnv))
{
//SETUP
var linq = env.Db.LivingBeeing.OfType<Fish>().ToList().Select(p => new { p.Species, p.Group }).ToList();

//ATTEMPT
env.AboutToUseDelegateDecompiler();
var dd = env.Db.LivingBeeing.OfType<Fish>().Select(p => new { p.Species, p.Group }).Decompile().ToList();

//VERIFY
env.CompareAndLogList(linq, dd);
}
}

[Test]
public void TestSelectAbstractMemberWithConditionOnItOverTphHierarchyWithGenericClassesAfterRestrictingToSubtype()
{
using (var env = new MethodEnvironment(classEnv))
{
//SETUP
var linq = env.Db.LivingBeeing.OfType<Fish>().ToList()
.Select(p => new { p.Species, p.Group })
.Where(p => p.Species != null && p.Group != null)
.ToList();

//ATTEMPT
env.AboutToUseDelegateDecompiler();
var dd1 = env.Db.LivingBeeing.OfType<Fish>()
.Select(p => new { p.Species, p.Group })
.Where(p => p.Species != null && p.Group != null)
.Decompile();

var dd = dd1.ToList();

//VERIFY
env.CompareAndLogList(linq, dd);
}
}
#endif

[Test]
public void TestSelectMultipleLevelsOfAbstractMembersOverTphHierarchy()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand Down Expand Up @@ -32,7 +32,9 @@ More will appear as we move forward.*
* Select Method Without Computed Attribute (line 104)
* Select Abstract Member Over Tph Hierarchy (line 121)
* Select Abstract Member Over Tph Hierarchy After Restricting To Subtype (line 138)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Abstract Member Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 156)
* Select Abstract Member With Condition On It Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 181)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)

#### [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs):
- Supported
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail With Sql of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand Down Expand Up @@ -74,7 +74,21 @@ More will appear as we move forward.*

```

* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Abstract Member Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 156)
* T-Sql executed is

```SQL

```

* Select Abstract Member With Condition On It Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 181)
* T-Sql executed is

```SQL

```

* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)
* T-Sql executed is

```SQL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:16
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand All @@ -24,7 +24,7 @@ More will appear as we move forward.*

### Group: Basic Features
- Supported
* [Select](../TestGroup05BasicFeatures/Test01Select.cs) (8 tests)
* [Select](../TestGroup05BasicFeatures/Test01Select.cs) (10 tests)
* [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs) (5 tests)
* [Equals And Not Equals](../TestGroup05BasicFeatures/Test03EqualsAndNotEquals.cs) (4 tests)
* [Nullable](../TestGroup05BasicFeatures/Test04Nullable.cs) (5 tests)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.0 on Thursday, 04 February 2021 16:05
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand Down Expand Up @@ -32,15 +32,17 @@ More will appear as we move forward.*
* Select Method Without Computed Attribute (line 104)
* Select Abstract Member Over Tph Hierarchy (line 121)
* Select Abstract Member Over Tph Hierarchy After Restricting To Subtype (line 138)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Abstract Member Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 156)
* Select Abstract Member With Condition On It Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 181)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)

#### [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs):
- Supported
* Async (line 39)
* Bool Equals Constant Async (line 56)
* Decompile Upfront Bool Equals Constant Async (line 73)
* Bool Equals Static Variable To Array Async (line 92)
* Int Equals Constant (line 109)
* Bool Equals Constant Async (line 75)
* Decompile Upfront Bool Equals Constant Async (line 92)
* Bool Equals Static Variable To Array Async (line 111)
* Int Equals Constant (line 128)

#### [Equals And Not Equals](../TestGroup05BasicFeatures/Test03EqualsAndNotEquals.cs):
- Supported
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail With Sql of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.0 on Thursday, 04 February 2021 16:05
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand Down Expand Up @@ -74,7 +74,21 @@ More will appear as we move forward.*

```

* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Abstract Member Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 156)
* T-Sql executed is

```SQL

```

* Select Abstract Member With Condition On It Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 181)
* T-Sql executed is

```SQL

```

* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)
* T-Sql executed is

```SQL
Expand All @@ -91,28 +105,28 @@ More will appear as we move forward.*

```

* Bool Equals Constant Async (line 56)
* Bool Equals Constant Async (line 75)
* T-Sql executed is

```SQL

```

* Decompile Upfront Bool Equals Constant Async (line 73)
* Decompile Upfront Bool Equals Constant Async (line 92)
* T-Sql executed is

```SQL

```

* Bool Equals Static Variable To Array Async (line 92)
* Bool Equals Static Variable To Array Async (line 111)
* T-Sql executed is

```SQL

```

* Int Equals Constant (line 109)
* Int Equals Constant (line 128)
* T-Sql executed is

```SQL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.0 on Thursday, 04 February 2021 16:05
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand All @@ -24,7 +24,7 @@ More will appear as we move forward.*

### Group: Basic Features
- Supported
* [Select](../TestGroup05BasicFeatures/Test01Select.cs) (8 tests)
* [Select](../TestGroup05BasicFeatures/Test01Select.cs) (10 tests)
* [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs) (5 tests)
* [Equals And Not Equals](../TestGroup05BasicFeatures/Test03EqualsAndNotEquals.cs) (4 tests)
* [Nullable](../TestGroup05BasicFeatures/Test04Nullable.cs) (5 tests)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Detail of supported commands
============
## Documentation produced for DelegateDecompiler, version 0.29.1 on Friday, 03 December 2021 13:20
## Documentation produced for DelegateDecompiler, version 0.29.1 on Wednesday, 08 December 2021 12:44

This file documents what linq commands **DelegateDecompiler** supports when
working with [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) (EF).
Expand Down Expand Up @@ -32,7 +32,9 @@ More will appear as we move forward.*
* Select Method Without Computed Attribute (line 104)
* Select Abstract Member Over Tph Hierarchy (line 121)
* Select Abstract Member Over Tph Hierarchy After Restricting To Subtype (line 138)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 155)
* Select Abstract Member Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 156)
* Select Abstract Member With Condition On It Over Tph Hierarchy With Generic Classes After Restricting To Subtype (line 181)
* Select Multiple Levels Of Abstract Members Over Tph Hierarchy (line 199)

#### [Select Async](../TestGroup05BasicFeatures/Test02SelectAsync.cs):
- Supported
Expand Down
Loading