-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The code below demonstrates the issue with the data reader. It looks like in some cases underlying SQL data reader remains open after enumeration blocking attempts to commit a transaction.
The code below demonstrates the issue.
// The model
[HierarchyRoot]
[KeyGenerator(KeyGeneratorKind.None)]
public class Item: Entity
{
[Field, Key]
public Guid Id { get; private set; }
public Item(Session session, Guid id)
: base(session, id)
{ }
}
// The failing code
// NOTE: There are no Item records in the table
using (var session = Domain.OpenSession()) {
using (var tx = session.OpenTransaction()) {
var list = new List<Guid>();
var sequence = Enumerable.Empty<Guid>().Union(session.Query.All<Item>()
.Where(item => item.Id == Guid.Empty)
.Select(item => item.Id));
foreach (var guid in sequence) {
list.Add(guid);
}
Assert.AreEqual(0, list.Count);
tx.Complete();
}
}When executed, this code throws an exception on the attempt to complete the transaction using block.
Xtensive.Orm.StorageException : SQL error occured.
SQL error details 'Type: Unknown;'
Original message 'The transaction operation cannot be performed because there are pending requests working on this transaction.'
----> System.Data.SqlClient.SqlException : The transaction operation cannot be performed because there are pending requests working on this transaction.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working