本文整理汇总了C#中Orchard.ContentManagement.VersionOptions类的典型用法代码示例。如果您正苦于以下问题:C# VersionOptions类的具体用法?C# VersionOptions怎么用?C# VersionOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VersionOptions类属于Orchard.ContentManagement命名空间,在下文中一共展示了VersionOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetForumsForCategory
public IEnumerable<ForumPart> GetForumsForCategory(ForumCategoryPart forumCategoryPart, int skip, int count, VersionOptions versionOptions)
{
var forums = _contentManager.Query<ForumPart, ForumPartRecord>(versionOptions)
.OrderBy(fp => fp.Weight)
.WithQueryHints(new QueryHints().ExpandRecords<CommonPartRecord, TitlePartRecord>())
.Join<CommonPartRecord>()
.Where(cpr => cpr.Container.Id == forumCategoryPart.Id).Slice(skip, count).ToList();
/*
* var forumIds = _categoryToForumMappingRepository.Table.Where(rec => rec.ForumCategoryPartRecord.Id == forumCategoryPart.Id).Select(rec => rec.ForumPartRecord.Id).ToList();
var forums = _contentManager.Query<ForumPart, ForumPartRecord>(versionOptions).OrderByDescending(fpr => fpr.Weight).Where(forum => forumIds.Contains(forumCategoryPart.Id)).Slice(skip, count).ToList();
*/
/*
return GetParentQuery(forumCategoryPart, versionOptions)
.Join<ThreadPartRecord>()
.OrderByDescending(o => o.IsSticky)
.Join<CommonPartRecord>()
.OrderByDescending(o => o.ModifiedUtc)
.ForPart<ThreadPart>()
.Slice(skip, count)
.ToList();
*/
return forums;
}
示例2: Get
public IEnumerable<ForumPart> Get(VersionOptions versionOptions)
{
return _contentManager.Query<ForumPart, ForumPartRecord>(versionOptions)
.Join<RoutePartRecord>()
.OrderBy(br => br.Title)
.List();
}
示例3: Get
public IEnumerable<HotelPart> Get(
DestinationPart destinationPart, int skip, int count, VersionOptions versionOptions)
{
return
GetHotelQuery(destinationPart, versionOptions).Slice(skip, count).ToList().Select(
ci => ci.As<HotelPart>());
}
示例4: Get
public PostPart Get(int id, VersionOptions versionOptions) {
return _contentManager.Query<PostPart, PostPartRecord>(versionOptions)
.WithQueryHints(new QueryHints().ExpandRecords<CommonPartRecord>())
.Where(x => x.Id == id)
.List()
.SingleOrDefault();
}
示例5: GetPositional
public PostPart GetPositional(ThreadPart threadPart, bool includeInappropriate, VersionOptions versionOptions,
ThreadPostPositional positional) {
var query = GetParentQuery(threadPart, versionOptions);
if (positional == ThreadPostPositional.First)
query = query.OrderBy(o => o.PublishedUtc);
if (positional == ThreadPostPositional.Latest)
query = query.OrderByDescending(o => o.PublishedUtc );
if (!includeInappropriate)
{
var postPart = query.Join<PostPartRecord>().Where(post => post.IsInappropriate == false);
return postPart
.ForPart<PostPart>()
.Slice(1)
.SingleOrDefault();
}
// else
return query.ForPart<PostPart>()
.Slice(1)
.SingleOrDefault();
}
示例6: Get
public IEnumerable<BlogPostPart> Get(BlogPart blogPart, int skip, int count, VersionOptions versionOptions)
{
return GetBlogQuery(blogPart, versionOptions)
.Slice(skip, count)
.ToList()
.Select(ci => ci.As<BlogPostPart>());
}
示例7: Get
public BlogPostPart Get(BlogPart blogPart, string slug, VersionOptions versionOptions) {
var postPath = blogPart.As<IRoutableAspect>().GetChildPath(slug);
return
_contentManager.Query(versionOptions, "BlogPost").Join<RoutePartRecord>().Where(rr => rr.Path == postPath).
Join<CommonPartRecord>().Where(cr => cr.Container == blogPart.Record.ContentItemRecord).List().
SingleOrDefault().As<BlogPostPart>();
}
示例8: Get
public IEnumerable<ForumPart> Get(VersionOptions versionOptions) {
return _contentManager.Query<ForumPart, ForumPartRecord>(versionOptions)
.WithQueryHints(new QueryHints().ExpandRecords<AutoroutePartRecord, TitlePartRecord, CommonPartRecord>())
.OrderBy(o => o.Weight)
.List()
.ToList();
}
示例9: Get
public TimetableAppointmentPart Get(TimetablePart TimetablePart, string slug, VersionOptions versionOptions) {
var postSlug = TimetablePart.As<IRoutableAspect>().GetChildPath(slug);
return
_contentManager.Query(versionOptions, "TimetableAppointment").Join<RoutePartRecord>().Where(rr => rr.Path == postSlug).
Join<CommonPartRecord>().Where(cr => cr.Container == TimetablePart.Record.ContentItemRecord).List().
SingleOrDefault().As<TimetableAppointmentPart>();
}
示例10: Get
public IEnumerable<SeasonPart> Get(VersionOptions versionOptions)
{
return _contentManager.Query<SeasonPart, SeasonPartRecord>(versionOptions)
.Join<TitlePartRecord>()
.OrderBy(br => br.Title)
.List();
}
示例11: Get
public IEnumerable<ThreadPart> Get(ForumPart forumPart, VersionOptions versionOptions)
{
return GetForumQuery(forumPart, versionOptions)
.OrderByDescending(cr => cr.CreatedUtc)
.ForPart<ThreadPart>()
.List();
}
示例12:
IEnumerable<LocalizationPart> ILocalizationService.GetLocalizations(IContent content, VersionOptions versionOptions) {
if (content.ContentItem.Id == 0)
return Enumerable.Empty<LocalizationPart>();
var localized = content.As<LocalizationPart>();
var query = versionOptions == null
? _contentManager.Query<LocalizationPart>(localized.ContentItem.ContentType)
: _contentManager.Query<LocalizationPart>(versionOptions, localized.ContentItem.ContentType);
int contentItemId = localized.ContentItem.Id;
if (localized.HasTranslationGroup) {
int masterContentItemId = localized.MasterContentItem.ContentItem.Id;
query = query.Where<LocalizationPartRecord>(l =>
l.Id != contentItemId // Exclude the content
&& (l.Id == masterContentItemId || l.MasterContentItemId == masterContentItemId));
}
else {
query = query.Where<LocalizationPartRecord>(l =>
l.MasterContentItemId == contentItemId);
}
// Warning: May contain more than one localization of the same culture.
return query.List().ToList();
}
示例13: GetFormPartByName
public OFormPart GetFormPartByName(string name, VersionOptions options)
{
return _contentManager.Query<OFormPart, OFormPartRecord>(options)
.Where(f => f.Name == name)
.List()
.FirstOrDefault();
}
示例14: GetWidgets
public IEnumerable<WidgetExPart> GetWidgets(int hostId, VersionOptions versionOptions = null) {
versionOptions = versionOptions ?? VersionOptions.Published;
return _contentManager
.Query<WidgetExPart, WidgetExPartRecord>()
.ForVersion(versionOptions)
.Where(x => x.HostId == hostId)
.List();
}
示例15: GetTaggedContentItemCount
public int GetTaggedContentItemCount(int tagId, VersionOptions options)
{
return _orchardServices.ContentManager
.Query<TagsPart, TagsPartRecord>()
.Where(tpr => tpr.Tags.Any(tr => tr.TagRecord.Id == tagId))
.Join<MediaPartRecord>()
.Count();
}