🇺🇸
ModularBr Framework for Delphi
Portugues(PT)TelegramGitHub
  • Welcome to ModularBr
  • Getting to know
    • Introduction
      • Benefits
      • Requirements
      • Installing
  • Module
    • Exporting Binds
    • Importing Binds
  • Routes
    • Route Guard
    • Middlewares
  • Pipes
  • Dependency injection
  • Route Handlers
  • Usability
    • Horse and ModularBr
    • Desktop and ModularBr
  • CLI
  • Frequently Asked Questions
    • FAQs
      • How to contribute?
      • How to download and install?
      • What is InjectorBr?
      • What is ResultPairBr?
      • What is ECLBr?
  • Usage policy
    • License
Powered by GitBook
On this page
  1. Module

Importing Binds

Importing Binds from Modules in ModularBr.

Importing Binds

When importing a bind from another module, the developer gains access to the same instance of the resource registered in the exporting module. This allows for greater modularity and code reuse across different parts of the application.

unit nfe.module;

interface

uses
  dmfbr.module,
  nfe.repository,
  nfe.provider;

type
  TNFeModule = class(TModule)
  public
    function Binds: TBinds; override;
    function Imports: TImports; override;
  end;

implementation

uses
  export.module;

{ TNFeModule }

function TNFeModule.Binds: TBinds;
begin
  // Dependency Injection
  Result := [Bind<TRepositoryServer>.SingletonLazy,
             Bind<TProviderORMBr>.Factory];
end;

function TNFeModule.Imports: TImports;
begin
  Result := [TExportModule];
end;

end.

WARNING

Module import is only for Binds. Routes will not be imported.

PreviousExporting BindsNextRoutes

Last updated 2 years ago