2009-11-29 06:08:46 +00:00
|
|
|
using System.Collections.Generic;
|
2009-11-24 02:03:13 +00:00
|
|
|
using Orchard.Core.Common.Models;
|
2009-11-20 23:31:49 +00:00
|
|
|
using Orchard.Data;
|
2009-11-24 02:03:13 +00:00
|
|
|
using Orchard.Models;
|
2009-11-20 23:31:49 +00:00
|
|
|
using Orchard.Models.Driver;
|
|
|
|
|
|
|
|
|
|
namespace Orchard.Blogs.Models {
|
2009-11-21 09:17:22 +00:00
|
|
|
public class BlogPostProvider : ContentProvider {
|
2009-11-29 06:08:46 +00:00
|
|
|
public override IEnumerable<ContentType> GetContentTypes() {
|
|
|
|
|
return new[] { BlogPost.ContentType };
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-24 02:03:13 +00:00
|
|
|
public BlogPostProvider(IRepository<BlogPostRecord> repository, IContentManager contentManager) {
|
2009-11-20 23:31:49 +00:00
|
|
|
Filters.Add(new ActivatingFilter<BlogPost>("blogpost"));
|
2009-11-24 02:03:13 +00:00
|
|
|
Filters.Add(new ActivatingFilter<CommonAspect>("blogpost"));
|
|
|
|
|
Filters.Add(new ActivatingFilter<RoutableAspect>("blogpost"));
|
|
|
|
|
Filters.Add(new ActivatingFilter<BodyAspect>("blogpost"));
|
2009-11-21 09:47:18 +00:00
|
|
|
Filters.Add(new StorageFilter<BlogPostRecord>(repository));
|
2009-11-30 20:15:52 +00:00
|
|
|
OnLoaded<BlogPost>((context, bp) => bp.Blog = contentManager.Get<Blog>(bp.Record.Blog.Id));
|
2009-11-20 23:31:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|