Skip to content

Multiple assemblies support#155

Open
EmaX093 wants to merge 3 commits intohydrostack:mainfrom
EmaX093:multiple-assemblies-support
Open

Multiple assemblies support#155
EmaX093 wants to merge 3 commits intohydrostack:mainfrom
EmaX093:multiple-assemblies-support

Conversation

@EmaX093
Copy link
Copy Markdown

@EmaX093 EmaX093 commented Apr 30, 2026

This pull request introduces a mechanism to uniquely identify Hydro components by prefixing their routes and HTML attributes with a short, consistent hash based on their assembly name, allowing Hydro to use different components from multiples assemblies at the same time.

To use multiples assemblies, call UseHydro with the second parameter as below:

app.UseHydro(app.Environment, [
    typeof(MyApp.MyClass).Assembly,
    typeof(MyApp.Modules.SuperAdminPanel.SuperAdminPanelModule).Assembly
]);

Assembly-based Prefixing and Routing

  • Updated UseHydro extension methods in ApplicationBuilderExtensions.cs to accept and iterate over multiple assemblies, passing a computed assembly hash as a prefix when mapping Hydro components.
  • Modified MapHydroComponent in HydroComponentsExtensions.cs to include the assembly hash prefix in the component route, ensuring endpoint uniqueness.

Component Identification

  • Added a hydro-prefix attribute to component root elements in HydroComponent.cs, and included the prefix in event subscription script paths. [1] [2]

Frontend Integration

  • Updated hydro.js to read and propagate the hydro-prefix attribute, and to include the prefix in all relevant URLs and event payloads, ensuring the frontend targets the correct component endpoints. [1] [2] [3] [4] [5]

Utility Addition

  • Added a new utility class SHA256Util for computing and caching short hashes of assembly names, used as prefixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant