Skip to content
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

Capabilities registered by interfaces #1129

Merged
merged 7 commits into from
Sep 5, 2021
Merged

Capabilities registered by interfaces #1129

merged 7 commits into from
Sep 5, 2021

Conversation

exyi
Copy link
Member

@exyi exyi commented Sep 2, 2021

This PR adds a IObjectWithCapability<T> interface which can be used to register capabilities very simply. It will also mark controls implementing specific capability, which could be used for helper functions (to set html attributes, for example). The interface is only a marker.

Plus, there are few general improvements which I needed while testing this:

  • Properties respect attributes on the attributeProvider AND on the declaring property. This means you can choose to put the attribute on the property or the backing field, whichever you like.
    • while it will prevent strange behavior "the attribute is here and does nothing", this is a breaking change. If you have put your attribute on the field and relied on the fact of being ignored, you'll get burnt.
    • I need this because the attributes should be respected through the capability hierarchy (most importantly data context changes)
  • private GetContents method is allowed
  • added ToString to ValueOrBinding. Debugging is pain without it.
  • few checks

@exyi exyi force-pushed the capabilities-interface branch 2 times, most recently from 51f92d2 to bd98fb0 Compare September 2, 2021 18:45
@quigamdev quigamdev self-requested a review September 4, 2021 19:22
@quigamdev quigamdev added this to the Version 4.0 milestone Sep 4, 2021
}
public interface IObjectWithCapability<TCapability>: IDotvvmObjectLike
{
}
public interface IDotvvmControl: IRenderable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public interface IDotvvmControl: IRenderable
public interface IDotvvmControl: IRenderable, IDotvvmObjectLike

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doccoment here

Copy link
Contributor

@quigamdev quigamdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have reviewed this PR on a call with @exyi.
Please merge it after you solve the notes.

@exyi exyi force-pushed the capabilities-interface branch 2 times, most recently from f1eb20c to 11fff82 Compare September 5, 2021 17:00
@exyi exyi merged commit df4100b into main Sep 5, 2021
@exyi exyi deleted the capabilities-interface branch September 5, 2021 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants