I've got a site running uSiteBuilder 1.2 that utilises ICustomTypeConvertor quite heavily. After installing this package (thus now using the forked version of uSiteBuilder) these are no longer working. I'm getting exceptions trying to convert from strings to my custom types.
Is ICustomTypeConvertor not supported in this version of uSiteBuilder?
Have you got an example of the error you're getting?
I have changed the way the CustomTypeConvertors were working, they used to be held in a dictionary that was keyed on the return type but I sometimes had different convertors returning the same type (like List<string> say) so this approach wouldn't work.
I now allow them to be configured on the doc type property itself, like below.
I can have a look into the error you are getting as you should still be able to do both ways I guess.
[DocumentTypeProperty(
UmbracoPropertyType.Other,
OtherTypeName = "Energy Item Selector",
Name = "Energy Features Third Row",
Description = "Select the featured items for the third Energy feature row",
Tab = "Energy",
CustomTypeConverter = typeof(MultiNodeTreePickerConverter),
Mandatory = false)]
public List EnergyFeatureSet3 { get; set; }
Specifying the CustomTypeConvertor seems to fix the issue.
For info the error is:
Server Error in '/' Application.
Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.
Source Error:
Line 79: StringBuilder sb = new StringBuilder();
Line 80:
Line 81: sb.AppendFormat("<title>{0} | Graham</title>", !String.IsNullOrEmpty(CurrentContent.MetaTitle) ? CurrentContent.MetaTitle : CurrentContent.Name); Line 82:
Line 83: if (!String.IsNullOrEmpty(CurrentContent.MetaDescription))
ICustomTypeConvertor not supported?
Hi
I've got a site running uSiteBuilder 1.2 that utilises ICustomTypeConvertor quite heavily. After installing this package (thus now using the forked version of uSiteBuilder) these are no longer working. I'm getting exceptions trying to convert from strings to my custom types.
Is ICustomTypeConvertor not supported in this version of uSiteBuilder?
Have you got an example of the error you're getting?
I have changed the way the CustomTypeConvertors were working, they used to be held in a dictionary that was keyed on the return type but I sometimes had different convertors returning the same type (like List<string> say) so this approach wouldn't work.
I now allow them to be configured on the doc type property itself, like below.
I can have a look into the error you are getting as you should still be able to do both ways I guess.
Stephen
Specifying the CustomTypeConvertor seems to fix the issue.
For info the error is:
Server Error in '/' Application.
Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Cannot set the value of a document type property StandardContentPage.Image (document type: GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker) to value: '' (value type: System.String). Error: Object of type 'System.String' cannot be converted to type 'GrahamWebsite.Core.DataTypes.ImagePicker.ImagePicker'.
Source Error:
Line 79: StringBuilder sb = new StringBuilder(); Line 80: Line 81: sb.AppendFormat("<title>{0} | Graham</title>", !String.IsNullOrEmpty(CurrentContent.MetaTitle) ? CurrentContent.MetaTitle : CurrentContent.Name); Line 82: Line 83: if (!String.IsNullOrEmpty(CurrentContent.MetaDescription))
Source File: c:\tfs\GrahamWebsite\New Website\Dev\Solution\GrahamWebsite.Web\masterpages\DefaultMasterPage.Master.cs Line: 81
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
Oh dear, we've just added the Admin package to our 4.11 project and found the problem.
We've got a handful of converters and would hate to refactor them.
I hope there's a solution?
Regards,
Matt
Ah, I should have read the replies more closely although a resolved marker would have been helpful.
I'll give the fix a go. :-)
is working on a reply...