Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
- ABP Framework version: v4.2.2
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:
Is there an example of how to use the dynamic client with Winforms?
What do I do with the client Module class?
3 Answer(s)
-
0
hi @dwoodard
I think there is no problem if Winforms can use the module system of abp. There is no example for now.
-
0
hi @dwoodard
I think there is no problem if Winforms can use the module system of abp. There is no example for now.
Thanks. Perhaps I am just don't know what to do. Following the documentation, I did the following:
- I created a FooBarHttpApiClientModule
public class FooBarHttpApiClientModule : AbpModule
- I added the ConfigureServices method to it.
public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( typeof(FooBarApplicationContractsModule).Assembly, RemoteServiceName ); context.Services.Configure<AbpRemoteServiceOptions>(options => { options.RemoteServices.Default = new RemoteServiceConfiguration("https://localhost:44330"); }); }
- I created a FooBarService class
public class FooBarService : ITransientDependency
- Now what? Do I instantiate the FooBarHttpApiClientModule? I assume I need to initiate DI, which I can do.
-
1
Okay, I have at least got a somewhat working example.
static class Program { private static IHost _host; private static IAbpApplicationWithExternalServiceProvider _application; [STAThread] static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // // Create host and application // _host = Host .CreateDefaultBuilder(null) .UseAutofac() .UseSerilog() .ConfigureServices((hostContext, services) => { services.AddApplication<WmsHttpApiClientModule>(); services.AddScoped<Form1>(); }).Build(); _application = _host.Services.GetService<IAbpApplicationWithExternalServiceProvider>(); // // Startup // Log.Logger = new LoggerConfiguration() #if DEBUG .MinimumLevel.Debug() #else .MinimumLevel.Information() #endif .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) .CreateLogger(); try { Log.Information("Starting WinForms host."); _host.StartAsync(); _application.Initialize(_host.Services); var form1 = _host.Services.GetService<Form1>(); Application.Run(form1); } catch (Exception ex) { Log.Fatal(ex, "Host terminated unexpectedly!"); } finally { Log.CloseAndFlush(); } // // Clean up after main form closes // _application.Shutdown(); _host.StopAsync(); _host.Dispose(); } }