31.10.2014 Views

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

Developer's Guide - EPiServer World

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Extending <strong>EPiServer</strong> Community | 127<br />

In <strong>EPiServer</strong> Community there is a handler for every module, whichcontains the methods, which in turn does the<br />

database communication. In this example we create one for MyClass. It will be used in the entity provider (see 1.2.4) to<br />

get a MyClass instance from ID.This is necessary for <strong>EPiServer</strong> Community to handle this type properly. However, this<br />

particular method may be implemented in any way you wish, just as long as it returns and instance of MyClass based on<br />

ID.<br />

namespace MyCommunity<br />

{<br />

public class MyClassHandler<br />

{<br />

//In reality, this method would probably involve a database query to<br />

create<br />

//the object from database.<br />

public static GetMyClass(int id)<br />

{<br />

return new MyClass(id, "myclass name");<br />

}<br />

}<br />

}<br />

© <strong>EPiServer</strong> AB

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

Saved successfully!

Ooh no, something went wrong!