DataObjects.Net v.4.3.5 build 6015.

My model:

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

    [Field]
    public ItemState State { get; set; }
}

Failing query #1:

var query = from item in Query.All<Item>()
            where item.State.In(new [] {ItemState.Registering} )
            select item;

Exception for query #1:

Unable to translate 'Query.All().Where(item => item.State.In(new ItemState[] {$<ItemState>(Registering)}))' expression. See inner exception for details.

Unable to materialize back local collection item 'new [] {Registering}'.

Failing query #2:

var itemStates = Query.Store(new [] {ItemState.Registering});

var query = from item in Query.All<Item>()
            where item.State.In(itemStates)
            select item;

Exception for query #2:

Unable to translate 'Query.All().Where(item => item.State.In(@.itemStates))' expression. See inner exception for details.

Unable to materialize back local collection item  'value(DO4.Test03.Model.ItemState[])'.

Failing query #3:

var itemStates = Query.Store(new [] {ItemState.Registering});

var query = from item in Query.All<Item>()
            where itemStates.Contains(item.State)
            select item;

Exception for query #3:

Unable to translate 'Query.All().Where(item => @.itemStates.Contains(item.State))' expression. See inner exception for details.

Unable to materialize back local collection item 'value(DO4.Test03.Model.ItemState[])'.

Is this expected? All i want is to select "items" with has state which falls into defined list of item states. How can i do that?

asked Sep 21 '10 at 06:35

Peter%20%C5%A0ulek's gravatar image

Peter Ĺ ulek
492313236

edited Sep 21 '10 at 06:37

Is ItemState an Enum? Likely, there is a bug related to Enum type support in local collections.

(Sep 21 '10 at 06:58) Alex Yakunin Alex%20Yakunin's gravatar image
1

Yep (got this reply via Skype). So I'm creating an issue for this.

(Sep 21 '10 at 07:00) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Issue 817 is created.

answered Sep 21 '10 at 07:01

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

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

powered by OSQA