public ForumDataAdapter(EntityReference forum, IDataAdapterDependencies dependencies, Func <OrganizationServiceContext, IQueryable <Entity> > selectThreadEntities) { if (forum == null) { throw new ArgumentNullException("forum"); } if (forum.LogicalName != "adx_communityforum") { throw new ArgumentException(string.Format("Value must have logical name {0}.", forum.LogicalName), "forum"); } if (dependencies == null) { throw new ArgumentNullException("dependencies"); } Forum = forum; Dependencies = dependencies; _helperDataAdapter = new ForumThreadAggregationDataAdapter( dependencies, false, serviceContext => SelectForumCounts(serviceContext, Forum), selectThreadEntities, serviceContext => serviceContext.FetchForumThreadTagInfo(Forum.Id), new ForumThreadAggregationDataAdapter.SingleForumThreadUrlProvider(dependencies.GetUrlProvider(), new Lazy <string>(() => { var serviceContext = dependencies.GetServiceContext(); var forumEntity = SelectForumEntity(serviceContext, forum); if (forumEntity == null) { return(null); } var urlProvider = dependencies.GetUrlProvider(); return(urlProvider.GetUrl(serviceContext, forumEntity)); }, LazyThreadSafetyMode.None))); }
public WebsiteForumDataAdapter(IDataAdapterDependencies dependencies) : base(dependencies) { var website = dependencies.GetWebsite(); _helperDataAdapter = new ForumThreadAggregationDataAdapter( dependencies, true, serviceContext => serviceContext.FetchForumCountsForWebsite(website.Id), serviceContext => CreateThreadEntityQuery(serviceContext, website), serviceContext => serviceContext.FetchForumThreadTagInfoForWebsite(website.Id), new ForumThreadAggregationDataAdapter.ForumThreadUrlProvider(dependencies.GetUrlProvider())); }
public WebsiteForumDataAdapter(IDataAdapterDependencies dependencies, Func <OrganizationServiceContext, IQueryable <Entity> > selectThreadEntities) : base(dependencies) { var website = dependencies.GetWebsite(); _helperDataAdapter = new ForumThreadAggregationDataAdapter( dependencies, true, serviceContext => serviceContext.FetchForumCountsForWebsite(website.Id), selectThreadEntities, serviceContext => serviceContext.FetchForumThreadTagInfoForWebsite(website.Id), new ForumThreadAggregationDataAdapter.ForumThreadUrlProvider(dependencies.GetUrlProvider())); }
protected EntityDirectoryFileSystem(IDataAdapterDependencies dependencies) { if (dependencies == null) { throw new ArgumentNullException("dependencies"); } Dependencies = dependencies; SecurityProvider = Dependencies.GetSecurityProvider(); ServiceContext = Dependencies.GetServiceContext(); UrlProvider = Dependencies.GetUrlProvider(); Website = Dependencies.GetWebsite(); }
public TagWebsiteForumThreadDataAdapter(string tag, IDataAdapterDependencies dependencies) { if (string.IsNullOrWhiteSpace(tag)) { throw new ArgumentException("Value can't be null or whitespace.", "tag"); } if (dependencies == null) { throw new ArgumentNullException("dependencies"); } Dependencies = dependencies; var website = dependencies.GetWebsite(); _helperDataAdapter = new ForumThreadAggregationDataAdapter( dependencies, true, serviceContext => serviceContext.FetchForumCountsForWebsiteWithTag(website.Id, tag), serviceContext => CreateThreadEntityQuery(serviceContext, website, tag), serviceContext => serviceContext.FetchForumThreadTagInfoForWebsite(website.Id), new ForumThreadAggregationDataAdapter.ForumThreadUrlProvider(dependencies.GetUrlProvider())); }