I see plenty of 'GetById' and what not's, but I don't see a current. The idea here is I need the currently executing Content because I don't know the ID.
The various services (ie. ContentService) doesn't have a context of what is 'current'. You need the UmbracoContext for that. And if you just want the Id of the current page in order to 'get' something from the ContentService you should be able to use Umbraco.Web.UmbracoContext.Current.PageId (there are a few other ways to go about this but it depends on what you want to do, and since you explicitly mention the ContentService I wouldn't throw IPublishedContent/IPublishedContentRequest into the mix).
Remember that the ContentService is something we want to be able to use from various contexts ie. the backoffice, a controller, web service etc. for doing crud type operations for stuff like content and media, so it wouldn't make sense to have these services aware of a 'current context'.
Topic author was deleted
V6 how to get 'current' node (when not on a View)?
Getting the current node on the Views is easy.
But how would one get the 'current' node from the ApplicationContext in v6 while not on a view?
v4 has this:
Comment author was deleted
I see plenty of 'GetById' and what not's, but I don't see a current. The idea here is I need the currently executing Content because I don't know the ID.
The various services (ie. ContentService) doesn't have a context of what is 'current'. You need the UmbracoContext for that. And if you just want the Id of the current page in order to 'get' something from the ContentService you should be able to use Umbraco.Web.UmbracoContext.Current.PageId (there are a few other ways to go about this but it depends on what you want to do, and since you explicitly mention the ContentService I wouldn't throw IPublishedContent/IPublishedContentRequest into the mix).
Remember that the ContentService is something we want to be able to use from various contexts ie. the backoffice, a controller, web service etc. for doing crud type operations for stuff like content and media, so it wouldn't make sense to have these services aware of a 'current context'.
Hope that makes sense.
/ Morten
Comment author was deleted
Thanks Morten. V6 is a bit fuzzier for me than v4 was. #h5yr
Also there is the Umbraco.AssignedContentItem property that you can use if you have the UmbracoContext.
(hope i spelled it right)
is working on a reply...