I know that this is most likley a stupid question. But in the sense of having the repository only return what is needed, why not return IEnumerable rather tan IQueryable. I am sure it is actually because we need IQueryable for something, but unless I am
wrong can't the pipes and filters and everything else be done if the repository was returning an IEnumerable.
i am not sure in the gains one way or the other. I guess that I thought I read somwhere that IEnumerable was somhow lighter or better for performance. I am just trying to get a handle on why one would be picked over the other. Why choose one over the
other, etc.
I was just thinking id the goal of the repository was to return the simplist collection wouldn't that be IEnumerable. As far as deleyed execution, I would have to say I don't know how the 2 differ.
This is something I've thought about a lot and ultimately went with IQueryable. The main reason is to be sure I provide a rich query surface to the logic classes for people who want to customize. That said I should probably look into this more :).
jwscuba
Member
134 Points
108 Posts
repository question
Jul 08, 2008 03:03 PM|LINK
I know that this is most likley a stupid question. But in the sense of having the repository only return what is needed, why not return IEnumerable rather tan IQueryable. I am sure it is actually because we need IQueryable for something, but unless I am wrong can't the pipes and filters and everything else be done if the repository was returning an IEnumerable.
robconery
Participant
852 Points
195 Posts
Re: repository question
Jul 11, 2008 12:47 AM|LINK
Will delayed execution work with IEnumerable? If so - what's the gain here?
jwscuba
Member
134 Points
108 Posts
Re: repository question
Jul 11, 2008 04:02 AM|LINK
i am not sure in the gains one way or the other. I guess that I thought I read somwhere that IEnumerable was somhow lighter or better for performance. I am just trying to get a handle on why one would be picked over the other. Why choose one over the other, etc.
I was just thinking id the goal of the repository was to return the simplist collection wouldn't that be IEnumerable. As far as deleyed execution, I would have to say I don't know how the 2 differ.
robconery
Participant
852 Points
195 Posts
Re: repository question
Aug 14, 2008 10:09 PM|LINK
This is something I've thought about a lot and ultimately went with IQueryable. The main reason is to be sure I provide a rich query surface to the logic classes for people who want to customize. That said I should probably look into this more :).
Thanks...