-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata decorator Inheritability behaviour? #343
Comments
I think this is all about how you query the metadata. As @rbuckton has pointed out, we will likely need a standard library to query it in a way that respects inheritance, like Reflect.metadata does. The README also has an example of querying the metadata in a way that respects inheritance (in the |
In context of inheritance, its correct! it's all about the query. But in context of In the current decorator proposal, metadata decorator is "Creating the metadata", since in .Net framework "The decorator is the metadata itself". It's important because when the decorator is the metadata itself its easy to identify that a decorator is applied multiple time (easy to identify the uniqueness), so system can provide check automatically. The current decorator proposal will be possible but require more effort to do that. |
I'm having trouble understanding. Wouldn't the difference between inherited and allow-multiple be captured by the choice of query algorithm? |
The latest iteration of the proposal takes into account inheritance in metadata, and the inheritance is described in the README, so I'm closing this issue. If you feel like the README is not descriptive enough, feel free to reopen. |
Congrats for the new decorator proposal, look like it causing less breaking change than the previous one.
Anyway... Regarding below description from the current Readme.
I concern about its Inheritability behaviour. In an ORM framework it's a common use case to have an Entity inherited from a super class.
Giving code above, will the
Post[Symbol.metadata].instance.fields.deleted
work?Will we have more control to this behaviour such as enable/disable the inheritance behaviour? or even control the multiple behaviour like in .Net framework.
As a reference, In .Net framework, inheritability behaviour of metadata attribute is like below:
Inheritable
andAllowMultiple
.inheritable
and if there are the same attributes applied on derived class than if itsAllowMultiple
then multiple metadata applied, if not, only metadata from the derived class applied.The text was updated successfully, but these errors were encountered: