rebus-org / Rebus.SignalR

:bus: Rebus-based SignalR backplane
Other
29 stars 6 forks source link

Update to the latest version of Rebus and .net #13

Closed bencz closed 2 years ago

bencz commented 2 years ago

I'm studying the project, I would like to know about the project update to the latest Rebus releases

I did a test here, I just changed the .net version from 3.1 to 6 and did a complete nuget update on all projects. I just got a error on this line:

app.ApplicationServices.UseRebus(); Startup.cs(60, 37): [CS1061] 'IServiceProvider' does not contain a definition for 'UseRebus' and no accessible extension method 'UseRebus' accepting a first argument of type 'IServiceProvider' could be found (are you missing a using directive or an assembly reference?)

What would be the fix?

mookid8000 commented 2 years ago

Since you're using Microsoft's generic host(*), you should simply remove the line

app.ApplicationServices.UseRebus();

because it's no longer necessary – the bus will start/stop at the right times, using an IHostedService to manage the bus' lifecycle.

Rebus.ServiceProvider has had even tighter integration with Microsoft DI and the generic host since version 8, which made the UseRebus(..) thing unnecessary.


(*) I got that from the looks of the line app.ApplicationServices.UseRebus(), where I assume app is your IApplicationBuilder