I have a class library referencing Umbraco.Core (8.6.3). How can I access IPublishedContent by id from that project?
Both IUmbracoContextFactory and UmbracoContext.Content are a part of Umbraco.Web. I would like to avoid adding a reference to that package in my class library, since it's not web-related.
What I'm after is to access content with or without the preview flag, like UmbracoContext.Content.GetById(preview, id)
The IPublishedContent you're after will come from the cache/context of a running Umbraco web-site. Whether or not what you're doing is "web related", you want to work with part of Umbraco that is.
In the case of Umbraco ".Web" isn't an allusion to the UI/Presentation Layer.
Yeah, I thought I had to pull the "UmbracoCms" package to access .Web, but was happy to see that "UmbracoCms.Web" was a separate package. Didn't want to bloat the class lib with views and files from the UmbracoCms package.
Get IPublishedContent by id from class library
I have a class library referencing Umbraco.Core (8.6.3). How can I access IPublishedContent by id from that project?
Both
IUmbracoContextFactory
andUmbracoContext.Content
are a part ofUmbraco.Web
. I would like to avoid adding a reference to that package in my class library, since it's not web-related.What I'm after is to access content with or without the preview flag, like
UmbracoContext.Content.GetById(preview, id)
You'll need to reference
Umbraco.Web
The IPublishedContent you're after will come from the cache/context of a running Umbraco web-site. Whether or not what you're doing is "web related", you want to work with part of Umbraco that is.
In the case of Umbraco ".Web" isn't an allusion to the UI/Presentation Layer.
Yeah, I thought I had to pull the "UmbracoCms" package to access .Web, but was happy to see that "UmbracoCms.Web" was a separate package. Didn't want to bloat the class lib with views and files from the UmbracoCms package.
is working on a reply...