Comments (7)
@YairHalberstadt I don't want to intrude, but deterministic ordering (whatevet it is) seems important, no?
from stronginject.
@dadhi how would you recommend we meaningfully order the decorators? I.e the ordering will happen to be deterministic, if only because StrongInject is deterministic, but should there be a specific order in which they should run, and which is simple for users to understand and reorder?
If not I would suggest to make sure your decorators do not depend on running in a particular order.
from stronginject.
I don't want to intrude
On the contrary, you're input is highly valued! It's great to have the opinion of someone whose spent far more time working on IOC containers than I have!
from stronginject.
Note that attributes are not considered to be ordered by the CLI spec, so I would prefer not to depend on the order of attributes.
from stronginject.
On the contrary, you're input is highly valued! It's great to have the opinion of someone whose spent far more time working on IOC containers than I have!
Thanks. I wanted to speak because you are formulating the feature similar to what I did and thought 3 years ago. Now I know more. And the most important thing that Decorators (in a wider sense) are super powerful and provide a user-driven customization without introducing ad-hoc features into containers. To name a few - custom initializing and disposing logic.
If not I would suggest to make sure your decorators do not depend on running in a particular order.
It is not always possible.
Note that attributes are not considered to be ordered by the CLI spec, so I would prefer not to depend on the order of attributes.
For attributed registrations you may consider adding int? RelativeOrder
(the name is just an example) attribute property to guarantee the order if orderA > orderB
and not guarantee the order if property is not set.
I did this myself for the attributed registrations in my lib (which are supported via MEF based extension).
from stronginject.
that Decorators (in a wider sense)
What I mean here and relating to the fact that you already have a support for factory methods:
- "Decorator" for
A
maybe a constructor of type implementingA
and accepting theA
as parameter. - "Decorator" for
A
maybe a factory method returningA
and accepting theA
as parameter. - "Decorator" constructor or factory method may accept other parameters which help to serve the decoration process (configs, services, etc.)
- "Decorator" of
A
does not support decoration of multipleA
parameters.
Thats it :)
Enabling the unified support for the factory method decorators provides a natural (user-customized) creation pipelines.
Again I don't want to drive your design, consider this just an info sharing.
from stronginject.
Thanks for the input @dadhi
I think there's definitely quite a few further things that need to be hashed out: for example how do we order decorators defined in seperate modules? Is this order parameter global? If so it becomes very unwieldy to pick it since you need to know the order of all other decorators to pick your order correctly.
Perhaps it will be enough to say that the order of decorators is only defined within a module. The order of decorators defined in different modules is arbitrary (but deterministic).
from stronginject.
Related Issues (20)
- Optionally generated service location API HOT 2
- Inject Func<Owned<T>> parameters HOT 1
- [Feature/Idea] Support for primary constructor generator HOT 2
- Innermost hasAwaitStarted catch block is a no-op and could be omitted HOT 3
- Update xamarin sample to maui
- 'registerAs' parameter for FactoryAttribute HOT 9
- IOwned<out T> HOT 4
- Convenience methods for creating Owned<T> instances HOT 3
- Permitting null instead of empty delegate for Owned<T> and AsyncOwned<T> HOT 2
- Add diagnostic if any registered method return types are by ref.
- Circular dependency check is too restrictive for delegates HOT 23
- SI1103 warning location forces suppression to be all or nothing HOT 6
- Separate Microsoft DI from Asp.Net Core HOT 2
- Convert to IIncrementalGenerator HOT 18
- Retrieving design-time info about registrations HOT 5
- StrongInject Source Generator API HOT 1
- Confusing use of the term 'delegate parameters' in the readme HOT 2
- Support decorator factories that aren't gratuitously generic HOT 4
- Misleading info in README HOT 2
- Generic interface registration 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 stronginject.