From your example about using EntitySet<t> as query root, I tried:

var subTopic = (from topic in Query.All<Topic>() where topic.Name == topicName select topic).SingleOrDefault<Topic>();

EntitySet<Subscription> subscriptions = subTopic.Subscriptions;
var subscription = from sub in subscriptions where sub.ApplicationName == ApplicationName select sub;

but the where in the last line is highlighted with the following error:

"Delegate 'System.Func<nnet.broker.subscription,int,bool>' does not take '1' arguments"

[HierarchyRoot]
    [Index("Name")]
    public class Topic : Entity {
        [Field, Key]
        public long Id { get; private set; }

        [Field]
        public string Name { get; set; }

        [Field, Association(PairTo = "Topic", OnTargetRemove = OnRemoveAction.Clear)]
        public EntitySet<Event> Events { get; private set; }

        [Field, Association(OnTargetRemove = OnRemoveAction.Clear)]
        public EntitySet<Subscription> Subscriptions { get; private set; }
    }

    [HierarchyRoot]
    [Index("ApplicationName")]
    public class Subscription : Entity {
        [Field, Key]
        public long Id { get; private set; }

        [Field]
        public String ApplicationName { get; set; }

        [Field]
        public bool Persistent { get; set; }

        [Field, Key]
        public long LastEventId { get; private set; }
    }

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

asked Dec 23 '09 at 13:15

Tony's gravatar image

Tony
53262628


One Answer:

Dmitri Maximov (Xtensive) wrote:

Hello Tony,

We are sorry, but we've failed to reproduce the issue. We took model and query specified by you. Frankly speaking, the original model was not valid as there were 2 Key fields in Subscription class (Id, LastEventId), so we were to fix this. Could the fix influence somehow?


Alex (Xtensive) wrote:

Most likely you have another .Where extension method in one of imported namespaces. I.e. C# tried to translate your LINQ construction involving another .Where (C# actually just require a .Where with appropriate arguments is available), because System.Linq namespace was not imported.

answered Dec 23 '09 at 14:27

Editor's gravatar image

Editor
46156156157

Tony wrote: thanks, my mistake, cut and paste error. that fixed it

(Dec 23 '09 at 14:27) Editor Editor's gravatar image

OK then.

(Dec 23 '09 at 14:27) Dmitri Maximov Dmitri%20Maximov's gravatar image
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