Copied to clipboard

Flag this post as spam?

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


  • MaartenVissers 32 posts 150 karma points
    Apr 01, 2020 @ 09:39
    MaartenVissers
    0

    LightInject MultiArchitecture Project

    I work in a solution with multiple projects split up using multilayer architecture. I manage to inject services from my BLL.Umbraco project using a registry compiler. But I also want to be able to inject my UnitOfWork (those in my DAL project) as my AccountService injects them. I can't handle DAL in BLL.Umbraco. What is the best way to do this? namespace BLL.Umbraco.Composing

    {
       internal class RegisterServicesComposer : IUserComposer
       {
          public void Compose(Composition composition)
          {
             composition.Register<IAccountService, AccountService();
          }
       }
    }
    

    enter image description here

  • Thomas Rydeen Skyldahl 47 posts 229 karma points
    Apr 01, 2020 @ 11:17
    Thomas Rydeen Skyldahl
    0

    I would place the Composer in the Website, as it has access to both areas, You can abstract the registrations easily as they are normally composed of

    1. Service Type
    2. Service Implementation
    3. Lifetime

    Then you can wrap the Composition and let your projects contain the registration logic without knowing anything about Umbraco, but the registration/execution happens in the website during boot

    The small composition abstraction interface could be placed in a shared library, and the actual implementation could be placed in BLL.Umbraco to be reusable across sites

Please Sign in or register to post replies

Write your reply to:

Draft