Thursday, September 24, 2015

GlassMapper v4

I am a big fan of making things as easy as possible for developers. That's when the original version of glassmapper came out I jumped on the bandwagon. At the time an ORM solution was badly needed. When Glass made the jump to support MVC patterns this made the GlassMapper library a requirement on every project.

One of the most painful things dealing with GlassMapper was the dependency on Castle Core IOC. The latest version 4 of GlassMapper does away with this dependency.

Some of the other big changes are;

New caching feature
An example of where you would use this is in rendering forms to a page. To use this feature just use

[SitecoreType(Cachable = true

Extending a class that inherits from ICacheManager allows you to override the cache manager or use your own alternative cache provider.

Change in syntax
Although I was a big fan of GlassMapper razor syntax; not a lot of people were. This has now been removed and you can simply use more familiar syntax of

@HTML.glass().Editable(x=>x.Title)