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 2078 karma points
    Jun 06, 2021 @ 09:01
    David Armitage
    0

    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

    David

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

    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
    100

    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.

    https://github.com/umbraco-community/umbraco-graphql/blob/v9/dev/src/Our.Umbraco.GraphQL/Compose/GraphQLComposer.cs

Please Sign in or register to post replies

Write your reply to:

Draft