Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • David Armitage 508 posts 2076 karma points
    Jun 06, 2021 @ 09:01
    David Armitage

    Umbraco 9 Dependency Injection

    Hi All,

    I am just getting started with Umbraco 9. Has anyone got any example code and documentation to get up and running with dependency injection.

    I want to inject my own helpers and services in a similar way to like we did with Umbraco 8 Composers and Components.

    I didn't manage to figure it out yet for V9

    Kind Regards


  • Stuart Mullinger 79 posts 422 karma points
    Jun 06, 2021 @ 15:53
    Stuart Mullinger

    I found the YouTube videos that Warren did (Part01 and Part02 in the Other section) really useful for doing this for a package. I think it's simpler if you are just doing it for a website, as you can update Startup.cs directly.

  • Benjamin Carleski 33 posts 294 karma points MVP c-trib
    Jun 07, 2021 @ 15:28
    Benjamin Carleski

    You can also see an example in the Our.Umbraco.GraphQL package's composer. Take a look at the first few lines of the Compose method to see it registering some singletons, for example.

Please Sign in or register to post replies

Write your reply to: