INNER CODE UNIT · C#

efReview

mongodb/mongo-efcore-provider · benchmarks/MongoDB.EntityFrameworkCore.Benchmarks/HeadlineBenchmarks.cs:59

        var efReview = ef.Reviews.AsNoTracking().Include(r => r.Product).ToList().Count(r => r.Product != null);

        if (driverAll != N || efAll != N)
            throw new InvalidOperationException($"FlatItem count mismatch: driver={driverAll}, ef={efAll}, expected {N}.");
        if (driverWhere != efWhere)
            throw new InvalidOperationException($"Where count mismatch: driver={driverWhere}, ef={efWhere}.");
        if (driverReview != N || efReview != N)
            throw new InvalidOperationException($"Review+Product mismatch: driver={driverReview}, ef={efReview}, expected {N}.");
    }

    // Hand-written $lookup + $unwind equivalent of Reviews.Include(r => r.Product).
    private int DriverReviewInclude()
    {
        var joined = _reviewColl
            .Aggregate()
            .Lookup<Review, Product, ReviewWithProduct>(
                foreignCollection: _productColl,
                localField: r => r.ProductId,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…