Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Loading different version of strongly typed assembly side by side.

$
0
0

Hello,

I have a dot net core console application which acts as base framework provides some services to client plugin developers. For simplicity lets assume base program exposes a interface called IPlugin, client developer implement this IPlugin. Base framework console application loads different client assemblies using reflection. The client and base framework exposes a rest endpoint with swagger. Rest service developed in ASP .net core Web API project.  

Current Startup.cs

public void ConfigureServices(IServiceCollection services)

{

 services.AddMvc( ).AddControllerAsServices();

}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)

{

  app.UseOpenApi();

  app.UseSwaggerUi3();

app.UseMvc();

}

In Base application Asp .net core Web API is hosted using following code,

public IWebHostBuilder CreateWebHostBuilder(string[] args) =>  WebHost.CreateDefaultBuilder(args).ConfigureAppConfiguration((context,config) => 

{

}).ConfigureServices( s => s.AddSingletion(service1)).

.ConfigureServices( s => s.AddSingletion(service2)).

.UseStartup<Startup>( );

So far good. 

Say IPlugin hosts rest service in port P1, 

Now client would like to run different version of IPlugin implementation side by side. New assembly in port P2. 

When we load another version of same IPlugin ( strongly typed) and host rest end point in another port P2. We see both the endpoints ( P1, P2) has duplicated methods from assembly 1 and assembly 2. 

Could anyone please help how to fix this problem?.

Thanks,


Viewing all articles
Browse latest Browse all 9386

Trending Articles