Skip to content

Commit

Permalink
Merge pull request #56 from Cysharp/feature/net8.0
Browse files Browse the repository at this point in the history
Adopt to .NET 8
  • Loading branch information
neuecc authored Aug 1, 2024
2 parents bfef7fe + fca73e7 commit 87d1e03
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/DFrame.Controller/Controller/DFrameControllerLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DFrameControllerLogger(DFrameControllerLogBuffer router)
this.router = router;
}

public IDisposable BeginScope<TState>(TState state)
IDisposable ILogger.BeginScope<TState>(TState state)
{
return NilDisposable.Instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DFrame.Controller/DFrame.Controller.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
<RootNamespace>DFrame</RootNamespace>
Expand Down
57 changes: 28 additions & 29 deletions src/DFrame.Controller/RunDFrameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,38 @@ public static Task RunDFrameControllerAsync(this WebApplicationBuilder appBuilde

static async Task RunDFrameControllerAsync(WebApplicationBuilder appBuilder, DFrameControllerOptions options, Action<WebHostBuilderContext, DFrameControllerOptions> configureOptions)
{
appBuilder.WebHost.ConfigureServices((WebHostBuilderContext ctx, IServiceCollection services) =>
appBuilder.Services.AddGrpc();
appBuilder.Services.AddMagicOnion(x =>
{
services.AddGrpc();
services.AddMagicOnion(x =>
// Should use same options between DFrame.Controller(this) and DFrame.Worker
x.MessageSerializer = MessagePackMagicOnionSerializerProvider.Default;
});

appBuilder.Services.AddRazorPages()
.ConfigureApplicationPartManager(manager =>
{
// Should use same options between DFrame.Controller(this) and DFrame.Worker
x.MessageSerializer = MessagePackMagicOnionSerializerProvider.Default;
// import libraries razor pages
var assembly = typeof(DFrameControllerWebApplicationBuilderExtensions).Assembly;
var assemblyPart = new CompiledRazorAssemblyPart(assembly);
manager.ApplicationParts.Add(assemblyPart);
});

services.AddRazorPages()
.ConfigureApplicationPartManager(manager =>
{
// import libraries razor pages
var assembly = typeof(DFrameControllerWebApplicationBuilderExtensions).Assembly;
var assemblyPart = new CompiledRazorAssemblyPart(assembly);
manager.ApplicationParts.Add(assemblyPart);
});

services.AddServerSideBlazor();

// DFrame Options
services.TryAddSingleton<DFrameControllerExecutionEngine>();
services.TryAddSingleton<DFrameControllerLogBuffer>();
services.AddSingleton<ILoggerProvider, DFrameControllerLoggerProvider>();
services.AddScoped<LocalStorageAccessor>();
configureOptions(ctx, options);
services.AddSingleton(options);

// If user sets custom provdier, use it.
services.TryAddSingleton<IExecutionResultHistoryProvider, InMemoryExecutionResultHistoryProvider>();

services.AddMessagePipe();
});
appBuilder.Services.AddServerSideBlazor();

// DFrame Options
appBuilder.Services.TryAddSingleton<DFrameControllerExecutionEngine>();
appBuilder.Services.TryAddSingleton<DFrameControllerLogBuffer>();
appBuilder.Services.AddSingleton<ILoggerProvider, DFrameControllerLoggerProvider>();
appBuilder.Services.AddScoped<LocalStorageAccessor>();
#pragma warning disable ASP0012 // Suggest using builder.Services over Host.ConfigureServices or WebHost.ConfigureServices
appBuilder.WebHost.ConfigureServices((ctx, services) => configureOptions(ctx, options));
#pragma warning restore ASP0012 // Suggest using builder.Services over Host.ConfigureServices or WebHost.ConfigureServices
appBuilder.Services.AddSingleton(options);

// If user sets custom provider, use it.
appBuilder.Services.TryAddSingleton<IExecutionResultHistoryProvider, InMemoryExecutionResultHistoryProvider>();

appBuilder.Services.AddMessagePipe();

var app = appBuilder.Build();

Expand Down
2 changes: 1 addition & 1 deletion src/DFrame.RestSdk/DFrame.RestSdk.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down
2 changes: 1 addition & 1 deletion src/DFrame.Worker/DFrame.Worker.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<!-- for share with Unity, disable. -->
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion src/DFrame/DFrame.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>DFrame</RootNamespace>
Expand Down
4 changes: 4 additions & 0 deletions src/DFrame/DFrameApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public static DFrameAppBuilder CreateBuilder(int portWeb, int portListenWorker,
}
}

#pragma warning disable ASP0011 // Suggest using builder.Logging instead of ConfigureLogging (https://aka.ms/aspnet/analyzers)
#pragma warning disable ASP0012 // Suggest using builder.Services instead of ConfigureServices (https://aka.ms/aspnet/analyzers)
#pragma warning disable ASP0013 // Suggest using WebApplicationBuilder.Configuration instead of ConfigureAppConfiguration (https://aka.ms/aspnet/analyzers)

public class DFrameAppBuilder
{
Action<WebHostBuilderContext, DFrameControllerOptions> configureController;
Expand Down

0 comments on commit 87d1e03

Please sign in to comment.