Comments (8)
Ok, to this moment I have implemented MediatR ideas, but stripped to the core, to reveal the whole simplicity of it..
Now, after reading Jeremy's take on this I was thinking how to replace an ad-hoc middleware idea with more DI controllable way. And the answer is.. tadah.. Decorator. Middleware is just a special case of decorating the target handler. Then why don't just use a DryIoc decorators explicitly. The main benefit in addition to abstraction cut, would be controlling the order. I can just insert dercorator closer to handler, if I want. Then I have a decorator's condition, reuse, stateless implementation via factory methods, etc. etc.
from dryioc.
*gnoring dislikes..
An improved model for messages may look like this:
interface IMessage<TRequest, TResponse>
where TResponse : U<NoResponse, Unit, IResponse<TRequest>> {}
Hmm.. ;-)
from dryioc.
Is it possible to get only some plumbing in DI and retain some implementation in example? I am afraid there should be tests from different domains (enterprise ui, server, desktop console, mobile, games, web sites, value in multi language micro service design) to ensure that messages are good.
May be some code which makes replacing internals of MediatR and other eventing
(other case) items with DI easy one step process?
from dryioc.
Is it possible to get only some plumbing in DI and retain some implementation in example?
My example above was a bit of a joke :) I will be doing the simplest thing possible, so no pressing of Discriminated Unions. It also will be layers of abstraction as discussed in PR, so you can peek your thing.
from dryioc.
efdd045#diff-ecb85472b95ba475d6a564e8951d8baeR10461
from dryioc.
May be add this as md file in documentation instead of releasing? I recall when Unity had mediator as sample in the book or as contrib project. Events are complex beasts with many possibilities regarding threading, order, resource usage, broadcasting, error handling, integration with event loops. So it looks that simplest approach may work in specific set, so experimental namespace would also work.
from dryioc.
I still release it in separate namespace. Easy to point someone to it. Documentation PR is welcome.
from dryioc.
Namespace DryIoc.Messages
contains this thingy
from dryioc.
Related Issues (20)
- Consistent behavior of a faulty singleton HOT 2
- FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method HOT 1
- IDisposable dependencies does not get disposed when web request ends HOT 5
- Add the HotUsedInstance for fast access to skip all the resolution steps
- Conditional registrations
- MS DI AddKeyed... variant registration fails HOT 8
- Check for mismatch lifestyle scope between service and dependencies HOT 7
- troubleshooting sudden ArgumentException at TryInterpretSingletonAndUnwrapContainerException HOT 3
- [question/feature request] keyed services in delegate resolution HOT 8
- Use default constructor if no registration is found
- Add the global test option to run all tests with WithoutUseInterpretation option
- Feature Request: add global .WithDefaultServiceTypeCondition(Func<Type, bool> condition) method HOT 1
- System.NullReferenceException: Object reference not set to an instance of an object HOT 5
- 'WithConcreteTypeDynamicRegistrations' results in unintended instantiation HOT 3
- Exception: Window already exists HOT 4
- Resolve enforces passed arguments to be used (and fails because of it) HOT 4
- Type registered with Singleton instantiating multiple times
- [BUG] Resolve<> crashes with the misleading, casting-related Exception when class is also registered using RegisterInitializer HOT 5
- Virus Warning with DryIoc Version 5.4.3 on Some Antivirus Software HOT 1
- Resolving func-wrapper when having circular-dependency throws RecursiveDependencyDetected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dryioc.