public ForumsDrop(IPortalLiquidContext portalLiquidContext, Adxstudio.Xrm.Forums.IDataAdapterDependencies dependencies) : base(portalLiquidContext) { if (dependencies == null) { throw new ArgumentException("dependencies"); } _dependencies = dependencies; var forumDataAdapter = new WebsiteForumDataAdapter(dependencies); _adapter = forumDataAdapter; _aggregation = forumDataAdapter; _forums = new Lazy <ForumDrop[]>(() => _adapter.SelectForums().Select(e => new ForumDrop(this, e, dependencies)).ToArray(), LazyThreadSafetyMode.None); }
public WebsiteDrop(IPortalLiquidContext portalLiquidContext, IPortalViewEntity viewEntity, IDataAdapterDependencies dependencies) : base(portalLiquidContext, viewEntity) { _dependencies = dependencies; _eventAggregationDataAdapter = new WebsiteEventDataAdapter(_dependencies); _events = new Lazy <EventDrop[]>(() => _eventAggregationDataAdapter.SelectEvents().Select(e => new EventDrop(this, _dependencies, new Event(e))).ToArray(), LazyThreadSafetyMode.None); var blogDependencies = new PortalConfigurationDataAdapterDependencies(); _blogAggregationDataAdapter = new WebsiteBlogAggregationDataAdapter(blogDependencies); var urlProvider = blogDependencies.GetUrlProvider(); var serviceContext = dependencies.GetServiceContext(); _blogs = new Lazy <BlogDrop[]>(() => _blogAggregationDataAdapter.SelectBlogs() .Select(e => new BlogDrop(this, blogDependencies, new Blog(e.Entity, urlProvider.GetApplicationPath(serviceContext, e.Entity)))) .ToArray(), LazyThreadSafetyMode.None); var contextLanguageInfo = portalLiquidContext.ContextLanguageInfo; if (!contextLanguageInfo.IsCrmMultiLanguageEnabled) { this._languages = new Lazy <LanguageDrop[]>(() => new LanguageDrop[0]); // Initialize _languages as an empty collection. } else { var previewPermission = new PreviewPermission(PortalContext.Current.ServiceContext, PortalContext.Current.Website); if (previewPermission.IsEnabledAndPermitted) { this._languages = new Lazy <LanguageDrop[]>(() => contextLanguageInfo.ActiveWebsiteLanguages.Select(websiteLanguage => new LanguageDrop(this, websiteLanguage)).ToArray()); } else { this._languages = new Lazy <LanguageDrop[]>(() => contextLanguageInfo.ActiveWebsiteLanguages.Where(lang => lang.IsPublished).Select(websiteLanguage => new LanguageDrop(this, websiteLanguage)).ToArray()); } this.SelectedLanguage = new LanguageDrop(this, contextLanguageInfo.ContextLanguage); } }