I'm still unclear how to call ContentService from, say, a Partial View Macro, where I'd previously had just:
var cs = new ContentService();
I've tried the full ApplicationContext.Current.Services.ContentService line but that throws errors also (cannot be accessed with an Instance reference).
Testing 7.3 - ContentService c = new ContentService();
I am currently testing Umbraco 7.3
The following line causes an error which didnt happen in previous versions:
The error is:
'Umbraco.Core.Services.ContentService' does not contain a constructor that takes 0 arguments
Anyone know why this no longer works in 7.3.
Cheers,
Marc
Hi
the Public empty constructor for ContentService appears to have gone in 7.3 the only constructor is now
which means you need a lot of other stuff to call it
However i think calling ContentService this way is really only used when runing through the tests.
if you want to get to a version of content service for the current umbraco instance you should call
You will then have an instance of content service you can do anything you need to with.
Thank you Kevin, all sorted now.
You the man!!!
Just came across this after moving a site to 7.3.0, thanks for the solution Kevin!
Thanks Kevin!
Spot on for me too; although I wish I had seen this about 4 hours ago!
Cheers, Jon
I'm still unclear how to call ContentService from, say, a Partial View Macro, where I'd previously had just:
I've tried the full ApplicationContext.Current.Services.ContentService line but that throws errors also (cannot be accessed with an Instance reference).
Erid,
Do you have the
@using Umbraco.Core
set?Take a look at how I've been using the CS in my instance here if that helps?
Jon
Hi Kevin,
Wow, it 's really worked on latest versions of Umbraco onward 7.3.X.
Thanks a lot Kevin.
Hi
I forund this it helped me if others having trouble http://harveywilliams.net/blog/making-umbraco-nodes-with-the-models-builder
is working on a reply...