DO 5.0.18
AsQueryable for Xtensive.Orm.Linq.Grouping lead to exception
Fixing would be preferable or at least more specific exception.
Example
internal class Program
{
private static void Main(string[] args)
{
var dc = new DomainConfiguration("sqlserver", "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;");
dc.Types.Register(typeof(TestEntity));
dc.UpgradeMode = DomainUpgradeMode.Recreate;
using (var d = Domain.Build(dc))
{
using (var s = d.OpenSession())
using (s.Activate())
using (s.OpenTransaction())
{
new TestEntity(s)
{
Name = "test"
};
var groups = Query.All<TestEntity>().GroupBy(it => it.Name);
foreach (var group in groups)
{
_ = group.Select(it => it.Id).ToArray();
_ = group.AsEnumerable().Select(it => it.Id).ToArray();
_ = group.AsQueryable().Select(it => it.Id).ToArray(); //Exception
}
}
}
}
[HierarchyRoot]
public class TestEntity : Entity
{
/// <summary>Initializes a new instance of this class.</summary>
/// <param name="session">The session.</param>
public TestEntity(Session session) : base(session)
{
}
[Key]
[Field(Nullable = false)]
public int Id { get; private set; }
[Field]
public string Name { get; set; }
}
}
Exception can be different
In test thrown 'Value for parameter 'groupingParameter' is not set.'
In other project thrown 'ArgumentException: must be reducible node'
asked
Feb 03 '20 at 07:54
Gushchin Anton
11●27●27●29