Skip to content

Query on relationship IDs causes unexpected exception #83

@zeitlerc

Description

@zeitlerc

When trying to query on a HasManyIds field, Argo throws an unexpected exception. If this is not supported, then Argo should throw a more appropriate exception. If it should be supported, then this should succeed.

[Model]
public class Person
{
    [HasManyIds("addresses")]
    public IEnumerable<Guid> AddressIds { get; }
    [HasMany]
    public ICollection<Address> Addresses { get; set; }
}

// This throws the exception below
session.CreateQuery<Person>()
    .Where(p => p.AddressIds.Contains(addressId))
    .ToList();
System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at RedArrow.Argo.Client.Linq.RemoteQueryable`1.GetJsonName(MemberInfo member)
   at RedArrow.Argo.Client.Linq.Queryables.WhereQueryable`1.TranslateMemberExpression(Expression expression)
   at RedArrow.Argo.Client.Linq.Queryables.WhereQueryable`1.TranslateExpression(Expression expression)
   at RedArrow.Argo.Client.Linq.Queryables.WhereQueryable`1.TranslateMethodCallExpression(Expression expression)
   at RedArrow.Argo.Client.Linq.Queryables.WhereQueryable`1.TranslateExpression(Expression expression)
   at RedArrow.Argo.Client.Linq.Queryables.WhereQueryable`1.BuildQuery()
   at RedArrow.Argo.Client.Linq.RemoteQueryable`1.GetEnumerator()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   ***censored***

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions