Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1444

LinqToMongo.Inject throws InvalidOperationException

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 2.0.1
    • Component/s: Linq
    • Environment:
      Window 8 64 bit

      The attached code throws an InvalidOperationException() The LinqToMongo.Inject method is only intended to be used in LINQ Where clauses.

      var point = new GeoJsonPoint<GeoJson2DGeographicCoordinates>(new GeoJson2DGeographicCoordinates(10, 10));
      IMongoQuery query = Query<TestClass>.GeoIntersects(o => o.Coord, point);
      var result = objectsCollection.AsQueryable().Where(x => query.Inject()).ToList(); // exception thrown here

      In version 1.9.2 of c# driver this code was worked. I use LINQ Where. Why exception was thrown?

        1. Program.cs
          4 kB
          Ilya

            Assignee:
            Unassigned Unassigned
            Reporter:
            IlyaK Ilya
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: