More in this section

Forums / Developing with Sitefinity / New Rotator query

New Rotator query

1 posts, 0 answered
  1. Bobby
    Bobby avatar
    8 posts
    04 Feb 2012
    21 Mar 2012
    Link to this post

    I have created a Dynamic Module that I am using to display ads. I have adapted your NewsRotator example to fit my scenerio. Everything seems to work fine until I run the query to join my dynamic content and the image.

    Below is the query used for the NewsRotator example:
    var dataSource = App.WorkWith().NewsItems().Publihed()
                                                        .Where(i => i.Parent.Title == "Thumbnails"),
                                                            item => item.Title.Value,
                                                            image => image.Title.Value,
                                                            (item, image) => new { NewsItem = item, NewsImage = image }

    And here is my code,
    DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                Type businessPremiumListingType = TypeResolutionService.ResolveType(PremiumListingContentType);
                var imagesQuery = App.WorkWith().Images().Publihed()
                                                                .Where(i => i.Parent.Title == "Thumbnails");
                var datasource = dynamicModuleManager.GetDataItems(businessPremiumListingType)
                                                        .Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible == true)
                var ds = datasource.Join(imagesQuery,
                                          item => item.GetValue<Guid>("ad"),
                                          image => image.Id,
                                          (item, image) => new { BusinessItem = item, BusinessImage = image });

    My Dynamic module has a field called ad the holds the id of the image that I want to display. This query looks fine to me but when it executes, I get the following error:

    Incorrect number of parameters supplied for lambda declaration

    I do not see what the difference is between my code and the NewsRotator example. Can anyone shed some light on why this is happening and the correct implementation for what I am trying to accomplish?

1 posts, 0 answered