Hi all, I have an internal v8 package, which I cr...
# package-development
o
Hi all, I have an internal v8 package, which I created to migrate our Umbraco 8 sites to 10+, and I now need to downgrade it to work on Umbraco 7; and as I've never made a package for v7 before, I was wondering if anyone has any tips or know of any gotchas/things I should look out for whilst downgrading it? 😬
a
No dependency injection out of the box, so lots of
UmbracoContext.Current
for the content cache and
ApplicationContext.Services
for misc services.
If it helps anything, I created a package for U7 that exposes existing content and media through an API: https://github.com/limbo-works/Limbo.Umbraco.MigrationsApi/blob/v1/main/src/Limbo.Umbraco.MigrationsApi/MigrationsController.cs Since it's in a controller, I have acces to
UmbracoHelper
via the
Umbraco
property, but I have to acces a service like the content type service via
ApplicationContext.Services.ContentTypeService
o
Ah I'd forgotten how spoilt we are today with the lovely built in DI! I do remember using Autofac years ago, so I guess I'll have to re-learn that haha 😛 Thanks for the link to that package! That'll be a massive help!
Also, looking through the old v7 API docs, it seems like all of the services I used in v8 are present in v7, so if I wanted to use Autofac to inject them as I do in v8, would I need to manually register them in a
IApplicationEventHandler
? Or would that be a rabbit hole of a bad time? 😬
a
I don't think I've used Autofac, but most likely you have to set up things manually. I've set up LightInject for DI before in U7, so maybe that will work?
o
Cheers mate, I'll have a poke around and see what's what 🙂