-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #17063
- Loading branch information
Showing
17 changed files
with
134 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
test/EFCore.InMemory.FunctionalTests/Query/NorthwindInMemoryContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Linq; | ||
using Microsoft.EntityFrameworkCore.TestModels.Northwind; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query | ||
{ | ||
public class NorthwindInMemoryContext : NorthwindContext | ||
{ | ||
public NorthwindInMemoryContext(DbContextOptions options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
base.OnModelCreating(modelBuilder); | ||
|
||
InMemoryEntityTypeBuilderExtensions.ToQuery( | ||
modelBuilder.Entity<CustomerQuery>(), | ||
() => Customers.Select( | ||
c => new CustomerQuery | ||
{ | ||
Address = c.Address, | ||
City = c.City, | ||
CompanyName = c.CompanyName, | ||
ContactName = c.ContactName, | ||
ContactTitle = c.ContactTitle | ||
})); | ||
|
||
InMemoryEntityTypeBuilderExtensions.ToQuery( | ||
modelBuilder.Entity<OrderQuery>(), | ||
() => Orders.Select(o => new OrderQuery { CustomerID = o.CustomerID })); | ||
|
||
InMemoryEntityTypeBuilderExtensions.ToQuery( | ||
modelBuilder.Entity<ProductQuery>(), | ||
() => Products.Where(p => !p.Discontinued) | ||
.Select( | ||
p => new ProductQuery | ||
{ | ||
ProductID = p.ProductID, | ||
ProductName = p.ProductName, | ||
CategoryName = "Food" | ||
})); | ||
|
||
InMemoryEntityTypeBuilderExtensions.ToQuery( | ||
modelBuilder.Entity<CustomerQueryWithQueryFilter>(), | ||
() => Customers.Select( | ||
c => new CustomerQueryWithQueryFilter | ||
{ | ||
CompanyName = c.CompanyName, | ||
OrderCount = c.Orders.Count(), | ||
SearchTerm = SearchTerm | ||
})); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.