Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
2.2.3, 2.4.3
-
Windows 10, MSSQL 16, .NET 4.6.1, EntityFramework 6.1.3
Description
1. Create empty console application
2. Install EntityFramework package (6.1.3)
3. Install MongoDB.Driver package (2.4.3)
namespace App
|
{
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Data.Entity;
|
using MongoDB.Driver;
|
|
|
class Program |
{
|
static void Main(string[] args) |
{
|
var context = new SampleContext(); |
|
var ids = context.Customers.Select(e => e.CustomerId);
|
var arr = ids.ToArray();
|
|
var mongoQuery = new MongoClient("mongodb://localhost:27017") |
.GetDatabase("MyShop") |
.GetCollection<MongoCustomer>("MongoCustomer") |
.AsQueryable();
|
|
|
// OK |
mongoQuery.Where(e => arr.Contains(e.CustomerId)).ToArray();
|
|
|
// StackOverflow |
mongoQuery.Where(e => ids.Contains(e.CustomerId)).ToArray();
|
}
|
}
|
|
|
public class MongoCustomer |
{
|
public int CustomerId { get; set; } |
public string Name { get; set; } |
}
|
|
|
public class Customer |
{
|
public int CustomerId { get; set; } |
public string Name { get; set; } |
}
|
|
|
public class SampleContext : DbContext |
{
|
public SampleContext() : base("MyShop") |
{
|
}
|
|
|
public DbSet<Customer> Customers { get; set; } |
}
|
}
|