31.10.2014 Views

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

22 | Developer’s <strong>Guide</strong> <strong>EPiServer</strong> Community 3.1<br />

Without any parameters, only the same set of criteria. This will remove the cache for all executed queries with the<br />

same set of criteria, no matter the values of the parameters.<br />

// Creating a new blog<br />

string name = "My Blog";<br />

Blog blog1 = new Blog(name);<br />

blog1 = BlogHandler.AddBlog(blog1);<br />

// New blog query using some parameters<br />

BlogQuery bq1 = new BlogQuery();<br />

bq1.Name = new StringCriterion();<br />

bq1.Name.Value = name;<br />

bq1.NumEntries = new IntegerCriterion();<br />

bq1.NumEntries.Value = 0;<br />

// fill up the cache with the query result<br />

BlogCollection bc1 = BlogHandler.GetQueryResult(bq1);<br />

// New blog query without parameters<br />

BlogQuery bqCache = new BlogQuery();<br />

bqCache.Name = new StringCriterion();<br />

bqCache.NumEntries = new IntegerCriterion();<br />

// Clear the cache with the created cache clearing query that contains no //<br />

parameters.<br />

// A query without parameters passed to RemoveQueryResultCache<br />

// clear all caches with the passed query's set of criteria<br />

// despite parameter values.<br />

QueryHandler.RemoveQueryResultCache(bqCache);<br />

2.7 Reporting<br />

The report system allows for visitors or members to report content they might find offensive in any way. The reports<br />

end up in the administration interface for further handling. The report system stores a snapshot copy of the reported<br />

content (including images and files) as well as a reference to the reported entity.<br />

First import the necessary namespaces:<br />

using StarCommunity.Core.Modules.Reporting;<br />

using StarCommunity.Core.Modules.Security;<br />

using StarCommunity.Modules.Blog; //only for this example.<br />

2.7.1 Add a report<br />

The first report on a specific object will create a ReportCase where all the following reports on the same object will be<br />

stored under, as long as the ReportCase itself have the status “new” (no admin action is taken).<br />

© <strong>EPiServer</strong> AB

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!