I am using glass mapper and TDS code generation templates to generate models for my sitecore templates.
All working Good. But, If i have a multi-list field TDS templates are creating IEnumerable<Guid>
. I want it to be IEnumerable<OtherSitecoreTemplate>
. Its working if i manually change it. But next time when code is regenerated, all my changes will be lost.
Is there a better way to do this?
You can set a custom type on your multi-list field that will be used during code generation by setting the "Custom Data" property of the field in TDS:
.
In your case, if you set this to "generic=Namespace.OtherSitecoreTemplate" the stock code generation templates for TDS will generate as IEnumerable<OtherSitecoreTemplate>
As an aside, this is where you'd set the type for Link fields. If you use the string "type=OtherSitecoreTemplate" it will strongly type the field to the value provided.