var category = Query<BlogCategory>.SingleOrDefault(id);  // returns NULL

var allCategories = Query<Video>.All.Where(p => p.Category == p.Category).Select(p => p.Category).Distinct().ToArray();  // it is a trick from another forum post

if (category == null)
    category =  Query<BlogCategory>.SingleOrDefault(id);  // oops, it is NOT NULL

Btw, .ToArray() is important in this sample.

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by buck.

asked Oct 28 '09 at 14:24

Editor's gravatar image


One Answer:

The developers said that this issue is strongly interconnected with that one: viewtopic.php?f=29&t=5660&p=13500

So they claim that this issue has been fixed also. Please, check the nightly build.

answered Oct 28 '09 at 14:42

Dmitri%20Maximov's gravatar image

Dmitri Maximov

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