November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You need an entity corresponding to the page. Previously there was the open source PageEntity, and now Relate 2 R2 seems to have it (or something similar) built-in, see "Social Pages" in this article: http://world.episerver.com/Articles/Items/EPiServer-Relate-2-R2/
Have you looked at this yet Jonas?
http://world.episerver.com/Blogs/Patrick-Iberts-blog/Dates/2011/8/Implement-a-comment-system-using-EPiServers-datastore-by-using-Paul-Smiths-DynamicDataStoreSession-class/
I looked at the Pageentity-project, the code i found seemed te only support the Wiki and not CMS-Pages. Maybe i didn't look hard enought :). Creating an Entity sounds like the best way... building a comment system in CMS isn't that hard, but i want to use Relate+.
Does anybody know of a good article describing how to implement PageEntity with CMS pages?
I'm not sure if things are going forward or backwards for me right now, but i'm sure struggling.... I created a PageEntity called CMSPageEntity and tried to add a Tag to it using this code:
CMSPageEntity x = (CMSPageEntity)new CMSPageEntity(CurrentPage.PageGuid).Clone();
UserAuthor user = new UserAuthor(CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser);
Tag tag = new Tag("Testtagg");
ICategory cat = new Category("testcat");
x.EntityTags.Add(new EntityTag(tag, cat, user));
PageEntityHandler.UpdatePageEntity(x);
It results in this exception, what do i miss here?
You have to use PageEntityHandler.AddPageEntity when you're creating a new entity.
Ok, so finally i got this to work. First i created a custom PageEntity, constructed som logic to handle the creation (or use) of it and som other basic stuff. The creation of comments works fine, but now i struggle getting the comments instead... i need to get all comments for a specific PageEntity, so i have two options: GetComments or GetQueryResult. GetComments should be the way, but it takes an IAuthor as parameter. I don't want to filter by author, is there a way to do this? GetQueryResult is more flexibel, but i cannot find any parameter to filter by "Commented Entity"...
Which would be the best way to add comment functionallity on CMS page types? I have found so many different answers i don't really know which to use. I can't get a grip on the CommentHandler-class and how to reference a Entity for a page...