Class EmbeddedExtensionAsset
- Namespace
- Kuestenlogik.Bowire.Semantics.Extensions
- Assembly
- Kuestenlogik.Bowire.dll
Helpers for loading bundle / stylesheet assets that an IBowireUiExtension ships as embedded resources of its declaring assembly.
public static class EmbeddedExtensionAsset
- Inheritance
-
EmbeddedExtensionAsset
- Inherited Members
Remarks
Centralises the resource-name resolution rules so each extension does
not have to hand-roll the same fallback ladder (full logical name
→ dotted form → on-disk fallback). The on-disk fallback matters in
development: the Razor SDK does not always pack wwwroot/** as an
embedded resource until the next build, so a freshly-edited file would
otherwise 404 against the dev host.
Methods
GuessContentType(string)
Best-effort MIME-type lookup for a small set of static-asset
extensions the workbench serves: JS, CSS, JSON, PNG, SVG, WASM.
Anything else falls back to application/octet-stream.
public static string GuessContentType(string resourceName)
Parameters
resourceNamestring
Returns
OpenRead(Assembly, IBowireUiExtension, string)
Open a read-only stream for the named asset attached to
extension. The lookup tries, in order:
- The literal
resourceNameagainstassembly. - The dotted form
{AssemblyDefaultNamespace}.{path.with.dots}— matches the standard MSBuild<EmbeddedResource>naming rule for slash-pathed includes. - A literal file lookup next to the assembly (development scenario).
Returns null when none of the strategies finds the asset.
public static Stream? OpenRead(Assembly assembly, IBowireUiExtension extension, string resourceName)
Parameters
assemblyAssemblyextensionIBowireUiExtensionresourceNamestring