/// <summary> /// Returns the query that would be used to load this collection from the database. /// The returned query can be modified using LINQ to perform filtering or operations in the database, such /// as counting the number of entities in the collection in the database without actually loading them. /// </summary> /// <returns> A query for the collection. </returns> public IQueryable Query() { return(_internalCollectionEntry.Query()); }
/// <summary> /// Returns the query that would be used to load this collection from the database. /// The returned query can be modified using LINQ to perform filtering or operations in the database, such /// as counting the number of entities in the collection in the database without actually loading them. /// </summary> /// <returns> A query for the collection. </returns> public IQueryable <TElement> Query() { return((IQueryable <TElement>)_internalCollectionEntry.Query()); }
public void InternalCollectionEntry_Query_throws_if_used_with_Detached_entity() { var mockInternalEntry = MockHelper.CreateMockInternalEntityEntry( new FakeEntity(), isDetached: true); var internalEntry = new InternalCollectionEntry(mockInternalEntry.Object, FakeWithProps.CollectionMetadata); Assert.Equal( Strings.DbPropertyEntry_NotSupportedForDetached("Query", "Collection", "FakeEntity"), Assert.Throws<InvalidOperationException>(() => internalEntry.Query()).Message); }