Created
March 25, 2013 20:34
-
-
Save DotTech/5240460 to your computer and use it in GitHub Desktop.
Explanation of a feature request for Glass Mapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Let's say I have a template an overview page - a page that shows an overview of child items - and I need a Glass Mapper model of that. | |
| This overview page can be used to display different type of child items. | |
| Child items also have Glass Mapper models. | |
| So I have: | |
| - News items, with the model NewsItemModel | |
| - Blog items, with the model BlogItemModel | |
| - Overview items, with the model OverviewPageModel | |
| Now I would like the OverviewPageModel to be of a generic type: OverviewPageModel<T> | |
| The type can be any of the item models that can be displayed in the overview. | |
| So I would get: OverviewPageModel<NewsItemModel> | |
| At the moment, this is impossible with Glass Mapper. | |
| When you try to create a generic model, an exception will be thrown in Glass.Sitecore.Mapper.Context.CreateConstructorDelegates by the DynamicMethod() constructor. | |
| That happens because DynamicMethod() does not support generic classes, as far as I can see now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have added a task to Trello https://trello.com/card/generic-type-support/512b22e43537057a63004573/33.