I have a Sitecore template MyTemplate
and a corresponding Glass model MySite.Model.MyTemplate
.
In my page code, I retrieve a raw Sitecore.Data.Items.Item
object from a legacy data access class. This object represents an item of the template MyTemplate
, but it is still a generic item object, so I have to access its fields like this: item["FieldName"]
.
Is there a quick way to convert this Item
object into a strongly-typed Glass model of the class MySite.Model.MyTemplate
? I want to do this directly in my page code, without replacing the way in which I obtain the item object.