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

Don't run Select_nested_projection without MARS #17119

Merged
merged 1 commit into from
Aug 13, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ FROM root c
WHERE ((c[""Discriminator""] = ""Customer"") AND (c[""City""] = ""London""))");
}

[ConditionalTheory(Skip = "Issue #16143")]
public override void Select_nested_projection()
{
base.Select_nested_projection();
}

public override async Task Select_nested_collection(bool isAsync)
{
await base.Select_nested_collection(isAsync);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,32 +408,6 @@ from c in cs
select c.City);
}

[ConditionalFact]
public virtual void Select_nested_projection()
{
using (var context = CreateContext())
{
var customers = context.Customers
.Where(c => c.CustomerID.StartsWith("A"))
.Select(c => new
{
Customer = c,
CustomerAgain = Get(context, c.CustomerID)
})
.ToList();

Assert.Equal(4, customers.Count);

foreach (var customer in customers)
{
Assert.Same(customer.Customer, customer.CustomerAgain);
}
}
}

private static Customer Get(NorthwindContext context, string id)
=> context.Customers.Single(c => c.CustomerID == id);

[ConditionalTheory(Skip = "Issue#16314")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Select_nested_collection(bool isAsync)
Expand Down
61 changes: 61 additions & 0 deletions test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6071,6 +6071,67 @@ public class Repo15518

#endregion

#region Bug8864

[ConditionalFact]
public virtual void Select_nested_projection()
{
using (CreateDatabase8864())
{
using (var context = new MyContext8864(_options))
{
var customers = context.Customers
.Select(c => new
{
Customer = c,
CustomerAgain = Get(context, c.Id)
})
.ToList();

Assert.Equal(2, customers.Count);

foreach (var customer in customers)
{
Assert.Same(customer.Customer, customer.CustomerAgain);
}
}
}
}

private static Customer8864 Get(MyContext8864 context, int id)
=> context.Customers.Single(c => c.Id == id);

private SqlServerTestStore CreateDatabase8864()
=> CreateTestStore(
() => new MyContext8864(_options),
context =>
{
context.AddRange(
new Customer8864 { Name = "Alan" },
new Customer8864 { Name = "Elon" });

context.SaveChanges();

ClearLog();
});

public class MyContext8864 : DbContext
{
public DbSet<Customer8864> Customers { get; set; }

public MyContext8864(DbContextOptions options) : base(options)
{
}
}

public class Customer8864
{
public int Id { get; set; }
public string Name { get; set; }
}

#endregion

private DbContextOptions _options;

private SqlServerTestStore CreateTestStore<TContext>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,5 @@ public override async Task SelectMany_without_result_selector_collection_navigat
FROM [Customers] AS [c]
INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]");
}

[ConditionalFact(Skip = "Issue#17117")]
public override void Select_nested_projection()
{
base.Select_nested_projection();
}
}
}