Skip to content

Commit

Permalink
🐛 Add HostEnvironment implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
koeeenig committed Jan 21, 2024
1 parent 264fed4 commit e9dfbfa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/BlazeKit.Static/BKitHostEnvironment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;

namespace BlazeKit.Static;

public class BKitHostEnvironment : IHostEnvironment
{
public BKitHostEnvironment(string environmentName)
{
EnvironmentName = environmentName;
}
public string ApplicationName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public IFileProvider ContentRootFileProvider { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string ContentRootPath { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string EnvironmentName { get;set;}
}
1 change: 1 addition & 0 deletions src/BlazeKit.Static/BlazeKit.Static.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/BlazeKit.Static/StaticSiteGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.JSInterop;

Expand Down Expand Up @@ -77,6 +78,7 @@ public async void Build(Type rootComponent)

var routeManager = new StaticNavigationManager();
serviceCollection.AddLogging();
serviceCollection.AddSingleton<IHostEnvironment>(new BKitHostEnvironment("Production"));
serviceCollection.AddSingleton<NavigationManager>(routeManager);
serviceCollection.AddSingleton<IJSRuntime>(new FkJsRuntime());
serviceCollection.AddSingleton<INavigationInterception>(new FkNavigationInterception());
Expand Down

0 comments on commit e9dfbfa

Please sign in to comment.