Skip to content

Commit

Permalink
👾 Fix Bug: Fixed an issue where the ImportFromCurrentAssembly loaded …
Browse files Browse the repository at this point in the history
…DataResourceServices from the wrong assmbly.
  • Loading branch information
XuanchenLin committed Mar 8, 2024
1 parent 3a6235d commit 758a78c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
14 changes: 8 additions & 6 deletions examples/MinimalWinFormiumApp/MyApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,10 @@ protected override void ConfigurationChromiumEmbedded(ChromiumEnvironmentBuiler

// 启用子进程的示例。
// Example of enabling sub-process.
cef.ConfigureSubprocess(sub =>
{
sub.SubprocessFilePath = "WinFormiumSubProcess.exe";


});
//cef.ConfigureSubprocess(sub =>
//{
// sub.SubprocessFilePath = "WinFormiumSubProcess.exe";
//});

}

Expand All @@ -90,6 +88,10 @@ protected override void ConfigureServices(IServiceCollection services)
PhysicalFilePath = Path.Combine(AppContext.BaseDirectory, "wwwroot"),
});

services.AddDataResource("http", "data.app.local", provider => {
provider.ImportFromCurrentAssembly();
});


// 注册 JavaScript Window Binding Object
// Register JavaScript Window Binding Object
Expand Down
28 changes: 28 additions & 0 deletions examples/MinimalWinFormiumApp/TestService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// THIS FILE IS PART OF WinFormium PROJECT
// THE WinFormium PROJECT IS AN OPENSOURCE LIBRARY LICENSED UNDER THE MIT License.
// COPYRIGHTS (C) Xuanchen Lin. ALL RIGHTS RESERVED.
// GITHUB: https://github.com/XuanchenLin/NanUI

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using WinFormium.WebResource;

namespace MinimalWinFormiumApp;

[RoutePath("/config")]
public class TestService : DataResourceService
{
public TestService()
{
}

[HttpGetMethod("hi")]
public IResourceResult TestMethod()
{
return Text("OK");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public void ImportFromFile(string fileName)

public void ImportFromCurrentAssembly()
{
var assembly = Assembly.GetExecutingAssembly();
var assembly = Assembly.GetEntryAssembly();

if(assembly == null) throw new InvalidOperationException("Entry assembly is null.");

ImportFromAssembly(assembly);
}
Expand Down

0 comments on commit 758a78c

Please sign in to comment.