question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move interfaces to its own assembly

See original GitHub issue

It would be nice to have all the interfaces and base classes (such as Unit) moved to it’s own assembly, called MediatR.Abstractions or something like that, so we could use it in class libraries without having a dependency on the concrete implementation.

For example I have a shared projet, called Domain.Shared where I share commonly used interfaces and classes (such as IEntity<T> etc.) that I’d like to share accross multiple microservices, each implementing it’s own Requests and Notifications.

This is a small problem, as if I want to use a newer versions of MediatR in one of the microservices, I’d have to update all the services, when I update Domain.Shared project.

Since the interfaces rarely change, it would make sense to extract them, so our class libraries only depend on the abstractions and we only have to reference the MediatR package in the application projects (ASP.NET 5, MVC, Console Application) and not in our class libraries. Then we could use individual verisons in our microservices, like having MediatR 2.0 on OrderService and having maybe 2.0.2 on ShippingService for example

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
jbogardcommented, Sep 6, 2018

Early on I considered moving the contracts out, but a few reasons why I didn’t:

  • It’s really annoying to version the interface separately
  • It’s really annoying to deploy through NuGet
  • Two packages could mean versioning hell
  • Minimal value added
2reactions
buvinghausencommented, Oct 6, 2020

@iuribrindeiro I don’t mean to speak for Mr. Bogard here but I don’t think MediatR should ever seep up into the browser. I get where you’re coming from because it’s nice to write a single request schema and share it between the client and the server. Given that the IRequest interfaces are all just marker interfaces you are far better off defining the request object in your Blazor client assembly and since your server has a reference to it simply inheriting from the client request class on the server and having the sever version implement the marker interface. Your controller then just takes the server version which is structurally the same and passes it off to MediatR and you get the benefits you’re looking for while keeping the browser footprint as small as possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Move interfaces to its own assembly · Issue #61
It would be nice to have all the interfaces and base classes (such as Unit) moved to it's own assembly, called MediatR.
Read more >
Should I have a separate assembly for interfaces?
Xml, it suggests first to have interfaces contained in their own assemblies with all relevant and required code held together and second and ......
Read more >
Move type to matching file refactoring - Visual Studio
Move a type to a separate file with the same name. Right-click the type, select Quick Actions and Refactorings, and select Move Type...
Read more >
Assembly User Interface Overview in SOLIDWORKS
Discover our tips and tricks for creating an assembly from scratch in SOLIDWORKS, as well as help with icons and subassemblies.
Read more >
Forming a New Assembly from Existing Components - 2023
You can form a subassembly from components (individual parts or subassemblies) that are already in the assembly, which move the components down one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found