dazinator / Dotnettency

Mutlitenancy for dotnet applications
MIT License
111 stars 23 forks source link

Idea - Modules. #14

Closed dazinator closed 7 years ago

dazinator commented 7 years ago

I want a nice Module story for dotnettency.

I'm thinking of adding another project something like

Dotnettency.Modules.

When you pull this nuget package in, you will get some new extensions methods to use, in the fluent configuration of dotnettency, in startup.cs.

The idea of Modules is to provide an extensibility point, where consumers can implement some functionality to be included in a dotnettency application. The module itself remains unaware of whether it is being included at an application level (i.e enabled for all tenants) or at a per tenant level (only enabled for particular tenants).

The two types of modules are:

  1. Shared / Library Modules (delivers middleware, or service)
  2. Routed Modules (delivers endpoints that handle a request and return a response)

Shared / library Modules

These are modules that can:

Services added by these modules, are available for consumption by all Routed Modules derived from the container to which they are added. For example, a library module included at the application level means any services it provides will be available for injection globally. If the library module is only included for a particular tenant, then only components within that tenants DI container will be able to leverage the modules services.

Routed Modules

These are modules that have their own container (derived from the parent Application or Tenant container) under which they register their own services. They must also register the routes under which the module will be activated. When a request comes in, dotnettency restores the appropriate module container based on routing to the module with an appropriate route.