Sitecore Foundation - Helix Glass Project

When you add a nuget reference to "Glass.Mapper.Sc", a bunch of code and configuration files get added to your project automatically. These files are necessary to bootstrap glass into your Sitecore instance and make sure code that uses glass works. While this is manageable in the pre-helix days of one or few projects, when you have projects for every module and feature and they all need glass, you can't have every module bootstrapping glass into Sitecore.

The proper "helix way" of doing so is to create a "Foundation" layer module that is responsible for bootstrapping glass into Sitecore. This way none of the other modules will need to worry about it. You'll need to manually delete the App_Start and Include files that get added when you add references, but you end up with a cleaner solution.

I've taken this approach in Sitecore Foundation, adding a "Foundation.Glass" project that includes the standard bootstrapping code, wiring Glass into your instance.

I've also moved the Glass SxA Controller, Repositories and Models into this project, so you can remove this project if you're not using Glass at all.

I also included a folder with a set of Glass T4 Templates which can be used for code generation when using TDS. I've enhanced these templates to also include Template Id's and Field Id's in the generated classes, which can be used where needed. The glass item template, also auto generates a commented out bare bones view with all the template specific field rendered as editable with div's with classes specific to field names. This could be used to accelerate view scaffolding and can be extended as needed on your project. Remember to add them to your TDS through the "paste as link" method. 

 

 

 

 

Making Custom Components not editable in SxA Partials and Page Designs

Sitecore Foundation - Generate Dynamic PDF's based on Sitecore Content