November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Joe!
Yes, this is due to a bug in DDS in that doesnt handle Enum values correctyl if they are
selected in new anonymous types.
This can be worked around by casting the Enum temporarily into an Int and then perform
a postprocess step to convert it back into the Enum, something like below:
var query = store.Items<ProductImage>()
.GroupBy(image => new { MyBrand = image.Brand, MyProduct = image.Product })
.Select(grouped => new { MyBrand = (int)grouped.Key.MyBrand, MyProduct = grouped.Key.MyProduct });
var result = query.ToList()
.Select(a => new { MyBrand = (BrandEnum)a.MyBrand, MyProduct = a.MyProduct })
.ToList();
return result;
Regards,
Johan
Hmm seems like a good solution, sadly our DDS Item contains an object which in turn contains quite many properties, some of them enum, quite alot to set and reset.
I solved this by creating an EnumTypeHandler. Blog post:
http://talk.alfnilsson.se/2011/06/27/using-propertydropdownlist-with-episerver-dynamic-properties/
I have created a bug for this, with bug id: 74270.
This will be fixed to next version of the CMS.
Invalid cast from 'System.Int32' to 'MyProject.Enums.Brand'.
on the line "return query.ToList();" I get that error. Would you know what's wrong with my query? Thanks.