Hello,

I have a problem with a specific query that do not return as much results as expected. The problem is when I use where clause combined with a select on an EntitySet and FirstAndDefault (sample code below)

DataObjects.Net version: 4.6.4.1123

Model:

  [HierarchyRoot]
  public class MyEntity : Entity
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field]
    [Association(PairTo = "Owner")]
    public EntitySet<MyItem> Items { get; set; }
  }

  [HierarchyRoot]
  public class MyItem : Entity
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field]
    public MyEnum MyEnum { get; set; }

    [Field]
    public MyEntity Owner { get; set; }
  }

  public enum MyEnum
  {
    None,
    Value1
  }

Code:

new MyEntity();
var queryWhere = session.Query.All<MyEntity>().Where(e => e.Items.Select(i => i.MyEnum).FirstOrDefault() == MyEnum.None);

Returns 0 result, where 1 was expected.

asked Apr 30 '13 at 02:18

olorin's gravatar image

olorin
356838489

Hello olorin, we've confirmed your problem. Please wait for the fix

(May 01 '13 at 03:33) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Hello Denis, any news on this issue?

(May 14 '13 at 04:07) olorin olorin's gravatar image

Hello olorin, unfortunately fix is not ready yet. Our current internal representation of queries only allows null result of scalar subqueries. First try was to add implicit call to coalesce() on the result however this is proven not to work because it makes scalar subquery to produce more than one column (i.e. original result of subquery and actual correct result).

(May 14 '13 at 04:30) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Were you able to find a solution to this problem?

(Jun 03 '13 at 03:25) olorin olorin's gravatar image

Not yet, unfortunately

(Jun 06 '13 at 02:55) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Any news? Do you plan to fix this issue? Any idea on how to write the query diffrently to work around this issue?

(Jul 05 '13 at 09:04) olorin olorin's gravatar image

Hello Olorin. I really apologize for such delay. Our current estimate is to fix this bug within a week.

(Jul 06 '13 at 11:17) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

One Answer:

Hello olorin,

finally we've made a fix for that.

Let us know if you need a nightly build.

answered Jul 16 '13 at 02:58

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×569
×7

Asked: Apr 30 '13 at 02:18

Seen: 4,368 times

Last updated: Jul 16 '13 at 02:58

powered by OSQA