Generation of a Composite Model Using Reflection and Sitecore Serialization

Context

In my previous post, I’ve described the benefits of composition pattern over inheritance in code generation and mentioned that it simplifies restoration of models from reflection. From my point, this is a huge plus as it enables the creation of developer friendly modular architecture in Sitecore.

I do not think that someone still has problems with a creation of an update package with Sitecore config transforms, but it is not really possible to install an update package in your Visual Studio solution. Of cause, you can install it in Sitecore, grab all libraries from bin folder and copy to your source, then serialize installed items into your project, generate your models based on “everything” you have in Sitecore.

To me, it doesn’t sound like a good approach, moreover, there are many of solution like NuGet, npm, bower that drastically simplify package management and installation for development. Also, when referencing items from packages, you don’t expect to modify DLL coming with them, so I do not think that you should have to serialize Sitecore items to use them in your model generation.

Most likely you already have information about your templates in compiled into your module DLLs. Below you would see how you could use it.

Continue reading “Generation of a Composite Model Using Reflection and Sitecore Serialization”

Generation of a Composite Model Using Reflection and Sitecore Serialization

Composite Reuse Principle in Sitecore Code Generation

Context

If you do Sitecore projects and have never tried to create strongly typed models then most likely you are doing something wrong. 🙂 Why? As soon as your project grows a bit, the logic becomes more complex or you decide to refactor a few components, you will suffer from all magic things – strings, number, GUIDs. Of cause, there are a few things that you can do about that. Continue reading “Composite Reuse Principle in Sitecore Code Generation”

Composite Reuse Principle in Sitecore Code Generation