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

Do not implement props in ViewExtensionBase #11350

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

mmisol
Copy link
Collaborator

@mmisol mmisol commented Dec 9, 2020

Purpose

This changes the definition of ViewExtensionBase to use abstract rather
than virtual for the definition of required properties like Name and
UniqueId. The use of virtual was creating a backing field which was not
used in ViewExtensionBase and could not be assigned in the inheriting
class, making it pretty much useless.

Also the Dispose method is declared as abstract, as it was already
required to implement and having a default empty implementation could
lead developers to oversight the need to dispose resources in their
extension.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

This changes the definition of ViewExtensionBase to use abstract rather
than virtual for the definition of required properties like Name and
UniqueId. The use of virtual was creating a backing field which was not
used in ViewExtensionBase and could not be assigned in the inheriting
class, making it pretty much useless.

Also the Dispose method is declared as abstract, as it was already
required to implement and having a default empty implementation could
lead developers to oversight the need to dispose resources in their
extension.
@mmisol
Copy link
Collaborator Author

mmisol commented Dec 9, 2020

While I was making this PR @QilongTang told me the release of 2.10 is already done. Releasing this in 2.11 would make this a technically a breaking change with respect to 2.10. However, that breaking change will actually reveal issues in the extension developed, so it could be argued whether this is actually beneficial.

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

While this looks like a good move in the right direction, it could be a breaking change, right? Ok, just saw your comment above.

@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Dec 9, 2020

I actually am confused about the purpose of ViewExtensionBase as opposed to the interface, IViewExtension. Not all view extensions derive from ViewExtensionBase.

@mmisol
Copy link
Collaborator Author

mmisol commented Dec 9, 2020

I guess the discussion for the need of ViewExtensionBase came from the discussions here and here. As a summary, it is used as a way to extend the view extension API without adding a new member in the IViewExtension interface. Extension developers can implement these members by inheriting from the ViewExtensionBase class. Dynamo dynamically checks whether the extension actually implements the base class and, if that case, it calls them. For now this is used for the Closed function that was recently added.

@aparajit-pratap
Copy link
Contributor

I guess the discussion for the need of ViewExtensionBase came from the discussions here and here. As a summary, it is used as a way to extend the view extension API without adding a new member in the IViewExtension interface. Extension developers can implement these members by inheriting from the ViewExtensionBase class. Dynamo dynamically checks whether the extension actually implements the base class and, if that case, it calls them. For now this is used for the Closed function that was recently added.

Ah, now I remember. Thanks for the context. In that case, it seems less risky to break this at this stage.

@mjkkirschner
Copy link
Member

mjkkirschner commented Dec 9, 2020 via email

@mjkkirschner mjkkirschner added this to the 2.10.0 milestone Dec 9, 2020
@mmisol mmisol merged commit e024592 into DynamoDS:master Dec 9, 2020
mmisol added a commit to mmisol/Dynamo that referenced this pull request Dec 9, 2020
This changes the definition of ViewExtensionBase to use abstract rather
than virtual for the definition of required properties like Name and
UniqueId. The use of virtual was creating a backing field which was not
used in ViewExtensionBase and could not be assigned in the inheriting
class, making it pretty much useless.

Also the Dispose method is declared as abstract, as it was already
required to implement and having a default empty implementation could
lead developers to oversight the need to dispose resources in their
extension.
mjkkirschner pushed a commit that referenced this pull request Dec 9, 2020
This changes the definition of ViewExtensionBase to use abstract rather
than virtual for the definition of required properties like Name and
UniqueId. The use of virtual was creating a backing field which was not
used in ViewExtensionBase and could not be assigned in the inheriting
class, making it pretty much useless.

Also the Dispose method is declared as abstract, as it was already
required to implement and having a default empty implementation could
lead developers to oversight the need to dispose resources in their
extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants