Skip to content

NH-3522 - Results returned by two similar Linq queries depends on order in which they were executed against the ISessionFactory #1315

Open
@nhibernate-bot

Description

@nhibernate-bot

amsk1982 created an issue — 29th August 2013, 8:45:46:

We've got two classes with similar queries in our .NET 4.0 project. These queries are run against a SQL 2008 database.

The main query is the same in both classes

var query = from entity in session.Query<Entity>()
                        where entity.Condition1 == ExpectedCondition1Value
                        group entity by entity.Name into entityByName
                        let name = entityByName.Key
                        let items = FilterEntities(entityByName)
                        select new UnMappedObject(name, items);

The FilterEntities method is different between the two classes and uses linq-to-objects

private static IList<string> FilterEntities(IEnumerable<Entity> entities)
{
     // Two, different, implementations of this method. 
}

The first query to run against the ISessionFactory will return the correct results. The second query to run against the ISessionFactory will return no results for the entire lifetime of the ISessionFactory.

Ideally both queries should return the correct results. If this isn't possible a suitable exception should be thrown.


amsk1982 added a comment — 29th August 2013, 8:52:21:

This is the test case

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions