So That is What the Custom Data Property is for. #Sitecore #Hedgehog #TDS and Glass Mapper Model Generation.

Glass and TDS makes our development life easier so we should try and use every feature we can. Right? One of my favorite features is generating a list of Glass models instead of GUIDS. A lot of you probably know this, but there is always times where someone does not. I wanted to document this so this can help others.

Select the field that is a Treelist or whatever multi list field.

In the properties under Code Generation you need to specify the type of list you want returned with model.

In my case:

type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink>.

Now Glass will auto generate and you will get the actual Glass Item Model instead a list of GUIDS.

[SitecoreType(TemplateId=ISectionLinksConstants.TemplateIdString)]

public partial class
SectionLinks  : GlassBase, ISectionLinks

       {

///
<summary>

 /// The Section List field.

            ///
<para></para>

                           ///
<para>Field Type: Treelist</para>          

                           ///
<para>Field ID: e09af999-37fa-42a3-98b7-1ffb802413c2</para>

                           ///
<para>Custom Data: type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink></para>

                           ///
</summary>

                           [global::System.CodeDom.Compiler.GeneratedCodeAttribute(“Team Development for Sitecore – GlassItem.tt”, “1.0”)]

                           [SitecoreField(ISectionLinksConstants.Section_ListsFieldName)]

                           public
virtual
IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink> Section_Lists  {get; set;}

       }

In my controller I just call it this way and I have my list to run through the ForEach:

viewModel = sitecoreservice.Cast<ISectionLinks>(Sitecore.Context.Item,inferType:true).Section_Lists.ToList();

So that is it. Let me know if there is something else we can do with this property. I would like to know.

Unicorn vs Hedgehog TDS for Sitecore. Hmm what to choose.

So let me just start out by doing #Sitecore updates with packages only can lead to a lot of issues. My first site using Sitecore I had to do that. It was with a company that was new to Sitecore and I had to learn it at night with a certified Sitecore developer they contracted to help. Some very long nights, but many years later it was all worth it. While creating packages and installing them it always seemed something was missing especially the bigger changes. It was also not always easy to reverse the changes if something went wrong. (I know now there are ways to do that.)

My next company I was introduced to Hedgehog’s TDS product and never looked back. Sure at first there are some learning curves. There were sync issues when working with other developers especially when working on the same things. It seems those issues have been worked out and I don’t see many of the issues I had when I first used it. Most Sitecore developers are familiar with TDS. In case you are not it allows you to sync Sitecore items (templates, content etc…), integrates well with Visual Studio, Glass Mapper and also has settings that make it easy to deploy your site. It does many other things.You can check out their site here.

Recently I was introduced to Unicorn. It is an open source utility used to sync Sitecore changes. Quoted from GitHub: “Unicorn is a utility for Sitecore that solves the issue of moving templates, renderings, and other database items between Sitecore instances.”  You can find Unicorn on GitHub here. I have wrote some blog posts on my experience with it. I think it a great product and it keeps getting better. It syncs Sitecore changes and helps integrating changes between team members much easier and safer than packages. I like the control panel page that is part of Unicorn. It explains step by step what you need to do to sync changes. It does not do everything TDS does, but it is still evolving and may do some additional things TDS does.

So which one do you choose? Either option in my opinion will be better than using just packages for everything. TDS is supported by a major software company and does a lot of things that make it convenient setting up a Sitecore environment. Unicorn is great if you want something simple and clean to do your Sitecore updates with other developers. Unicorn sums up the main differences below from their GitHub site:

Unicorn solves some of the same issues as Hedgehog’s TDS. The major difference in approach is that because Unicorn forces all of the merging to be done on the disk, you never have to manually select what to update when you’re running a sync operation or remember to write changed items to disk. Unless you have actual collisions, this saves a lot of time because you can take advantage of Git, SVN, TFS, etc to do automerges for you. That said, TDS and Unicorn have different feature sets and goals. TDS is a monolithic product with commercial support and marketing that does a lot more than just serialization. Unicorn is relatively simple, free and open source, and does one thing well. Use whatever makes you happy 🙂

So what do you prefer and why?