jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
10.91k stars 1.16k forks source link

Missing Using after migrating to v12 #931

Closed eestein closed 1 year ago

eestein commented 1 year ago

Hi, I'm sorry if this is already written somewhere, I read the migration guides and the readme, but couldn't find my actual issue.

This is my current code:

var assemblies = Assembly
            .GetEntryAssembly()!
            .GetReferencedAssemblies()
            .Select(Assembly.Load)
            .Append(Assembly.GetCallingAssembly())
            .ToArray();
services.AddMediatR(config => config.Using<Mediator>(), assemblies);

From what I understood, this is how it should be done on v12:

var assemblies = Assembly
            .GetEntryAssembly()!
            .GetReferencedAssemblies()
            .Select(Assembly.Load)
            .Append(Assembly.GetCallingAssembly())
            .ToArray();
services.AddMediatR(config => config.RegisterServicesFromAssemblies(assemblies));

Is that correct? config => config.Using<Mediator>() is no longer required?

Thanks!

jbogard commented 1 year ago

Is the Mediator class your custom one? If not, then no it's not required and never was required if you wanted to use the built-in version.

eestein commented 1 year ago

Thanks!