Sean Lynch

February 6, 2008

I think I’m missing something

Filed under: .Net,Development — Sean Lynch @ 1:30 am

I finally found time to work on DevExamples.com again and thought I would check on the suggestion that Richard had left on Got my nice Urls working about using incremental LINQ.

Overall I found that I liked the following syntax much better

 var cats = this.Categories.Where(c => c.Name == navList.First().Value);
 foreach (var item in navList.Skip(1))
 {
  string name = item.Value;
  cats = cats.Where(c => c.Name == name);
 }
 cat = cats.First();

Unfortunately this only works for the first parent in the hierarchy. After the first parent, it continues to simply work off of the single join. The problem is that instead of generating

image

it is generating

image

I think I understand why I am getting this result, though it was not what I was hoping.

In the end I think I will stick with how I implemented it in Got my nice Urls working until I either think of, or run into, a way to do it with lambda expression. Plus I like the Sql  generated in the previous post a little better mostly for trace readability.

image

Technorati Tags:

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress