Conventions

Vote:
 

Is there a way to write this code simpler?

PageIndexer.Instance.Conventions
                                              .ForInstancesOf<SectionPage>()
                                              .ShouldIndex(x => false);

            PageIndexer.Instance.Conventions
                                              .ForInstancesOf<SlidePage>()
                                              .ShouldIndex(x => false);

            PageIndexer.Instance.Conventions
                                              .ForInstancesOf<SlidesContainerPage>()
                                              .ShouldIndex(x => false);

            PageIndexer.Instance.Conventions
                                              .ForInstancesOf<NewsContainerPage>()
                                              .ShouldIndex(x => false);

    

I would also like to propose to by default exclude container page types from the index.

Cheers

Frederik

#59284
May 29, 2012 14:03
Vote:
 

Let the page types implement a marker interface interface, ie IDontIndexMePlease, then this _should_ work:

 

PageIndexer.Instance.Conventions
  .ForInstancesOf<PageData>()
  .ShouldIndex(x => !(x is IDontIndexMePlease));

    

Of course an attribute could be used as well but then the ShouldIndex expression would be a bit more messy.

#59287
May 29, 2012 14:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.