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 guys
Migrating my site to from v7 > v8
Having some trouble with the following:
var kunderSection = Umbraco.TypedContentAtRoot().FirstOrDefault(x => x.DocumentTypeAlias == "kunder");
I cant seem to find any documentation on this (maybe not Googling it right).
I tried changing Umbraco.TypedContentAtRoot() to Model.Content.Root()
Umbraco.TypedContentAtRoot()
Model.Content.Root()
but it tells my IPublishedContent doesn't contain a difinition for FirstOrDefault, which I haven't been able to find a v8 replacement for.
Hope you guys can help
Best
henrik
Umbraco.ContentAtRoot() I think. I've seen a few consistent changes where methods that were TypedContent* are now just Content*.
Umbraco.ContentAtRoot()
TypedContent*
Content*
Andy
If you use ModelsBuilder (which you definitely should)
Umbraco.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == Kunder.ModelTypeAlias);
if, for some reason, not
Umbraco.ContentAtRoot().FirstOrDefault(x => x.ContentType.Alias == "kunder");
For getting the top most ancestor in a template, usually the frontpage, you can do
Model.Root()
Thanks Andy and Michael!
I went with Michaels suggestion, using the ModelsBuilder, but both answers worked great :)
Have a great day
Henrik
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting ContentAtRoot in v8
Hi guys
Migrating my site to from v7 > v8
Having some trouble with the following:
I cant seem to find any documentation on this (maybe not Googling it right).
I tried changing
Umbraco.TypedContentAtRoot()
toModel.Content.Root()
but it tells my IPublishedContent doesn't contain a difinition for FirstOrDefault, which I haven't been able to find a v8 replacement for.
Hope you guys can help
Best
henrik
Umbraco.ContentAtRoot()
I think. I've seen a few consistent changes where methods that wereTypedContent*
are now justContent*
.Andy
If you use ModelsBuilder (which you definitely should)
if, for some reason, not
For getting the top most ancestor in a template, usually the frontpage, you can do
Thanks Andy and Michael!
I went with Michaels suggestion, using the ModelsBuilder, but both answers worked great :)
Have a great day
Henrik
is working on a reply...