Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
after upgraded to 6.2 version, my code doesn't work anymore.
The problem is with this where condition:
DynamicPublishedContent node = Umbraco.Content(1212); DynamicPublishedContent nodeT = node.Children.Where(x => x.DocumentTypeAlias == "Indice").FirstOrDefault() as DynamicPublishedContent;
Cannot convert lambda expression to type 'string' because it is not a delegate type
if i try to change this code into this:
DynamicPublishedContent node = Umbraco.Content(1212); var nodeT = node.Children.Where("DocumentTypeAlias == Indice");
the error became:
Can only unbox from an object or interface type to a value type.
any suggestion?
Hi Alessandro,
You have a mixture of Typed and Dynamic Models, could you try these:
Typed:
var node = Umbraco.TypedContent(1212); var nodeT = node.Children.Where(x => x.DocumentTypeAlias == "Indice").FirstOrDefault();
Dynamic:
var node = Umbraco.Content(1212); var nodeT = node.Children.Where("DocumentTypeAlias == @0","Indice").FirstOrDefault();
And see if either work?
Jeavon
The second method works...
thanks
Cool, first one doesn't?
The first one too. why the old code works with version previous to 6.2?
Great, Im not sure exactly but you can't use a lamda expression with dynamics so it's strange that it worked previously.
A lot has been changed to IPublishedContent between v6.1.6 and v6.2.0 so something must have been "corrected".
Was your code in v6.1.6 exactly the same as this?
The old code
works like a charm with version 6.1.6.
Can you point me to the docs with the changes to IPublishedContent between v6.1.6 and v6.2.0 so i can refactor my other code?
Yes, I have just tested to confirm myself. All changes in v6.2 are listed here, however I think this is possibly a unintended breaking change as the result of something else being changed.
You should raise a issue here and assign to Stephan
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco 6.2 and lambda expression
Hi
after upgraded to 6.2 version, my code doesn't work anymore.
The problem is with this where condition:
Cannot convert lambda expression to type 'string' because it is not a delegate type
if i try to change this code into this:
the error became:
Can only unbox from an object or interface type to a value type.
any suggestion?
Hi Alessandro,
You have a mixture of Typed and Dynamic Models, could you try these:
Typed:
Dynamic:
And see if either work?
Jeavon
The second method works...
thanks
Cool, first one doesn't?
The first one too. why the old code works with version previous to 6.2?
Great, Im not sure exactly but you can't use a lamda expression with dynamics so it's strange that it worked previously.
A lot has been changed to IPublishedContent between v6.1.6 and v6.2.0 so something must have been "corrected".
Was your code in v6.1.6 exactly the same as this?
The old code
works like a charm with version 6.1.6.
Can you point me to the docs with the changes to IPublishedContent between v6.1.6 and v6.2.0 so i can refactor my other code?
thanks
Yes, I have just tested to confirm myself. All changes in v6.2 are listed here, however I think this is possibly a unintended breaking change as the result of something else being changed.
You should raise a issue here and assign to Stephan
is working on a reply...