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.

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

1.3 Namespaces<br />

1.3.1 StarSuite.Core<br />

The StarSuite.Core namespace contains important startup classes like Settings, Site and SiteHandler and takes care of<br />

loading modules in the correct order based on dependencies.<br />

1.3.2 StarSuite.Core.Cache<br />

The StarSuite.Core.Cache namespace contains the <strong>EPiServer</strong> Community Cache system. The cache is based on a treestructure<br />

with the ability to have dependencies between branches. Every cached object in products like <strong>EPiServer</strong><br />

Community implements the ICacheable interface, allowing an object to have a primary cache key. The cache then keeps<br />

track of changes to this cache key and released other caches that also contain this object. All these features in<br />

conjunction make the <strong>EPiServer</strong> Community cache a lot more precise than in previous versions.<br />

The new cache system also implements the policy of read-only objects in cache. This is a big change since previous<br />

versions, since now objects retrieved from methods needs to be cloned before any properties are updated. All<br />

<strong>EPiServer</strong> Community entities have a Clone() method that will return a writable copy of the object.<br />

1.3.3 StarSuite.Core.Data<br />

The StarSuite.Core.Data namespace contains the database communication layer. It is called by all Factory classes to<br />

open connections and transactions and makes it possible to run several method calls within one transaction.<br />

bool alreadyInTransaction = DatabaseHandler.InTransaction;<br />

if(!alreadyInTransaction)<br />

DatabaseHandler.BeginTransaction();<br />

try<br />

{<br />

// execute a series of methods,<br />

// they will all be in the same transaction<br />

AddUser();<br />

SetAccessRights();<br />

// we are only responsible for commiting the transaction<br />

// if we were the ones to start it<br />

if(!alreadyInTransaction)<br />

DatabaseHandler.Commit();<br />

} catch<br />

{<br />

if(!alreadyInTransaction)<br />

DatabaseHandler.Rollback();<br />

throw;<br />

}<br />

© <strong>EPiServer</strong> AB

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

Saved successfully!

Ooh no, something went wrong!