-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Create extension methods to easily append to CollectionBuilders #11691
Create extension methods to easily append to CollectionBuilders #11691
Conversation
Add an extension method to register content apps to make it possible to register content apps in the startup.cs class.
Hi there @erikjanwestendorp, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
After I made this PR, I thought maybe this could be done in a nicer way. Is the below an option that has a chance? Rename the file Add extensions methods for other collections, like: public static partial class UmbracoBuilderExtensions
{
public static IUmbracoBuilder AddContentApp<T>(this IUmbracoBuilder builder)
where T : class, IContentAppFactory
{
builder.ContentApps().Append<T>();
return builder;
}
public static IUmbracoBuilder AddDashboard<T>(this IUmbracoBuilder builder)
where T : class, IDashboard
{
builder.Dashboards().Add<T>();
return builder;
}
public static IUmbracoBuilder AddComponents<T>(this IUmbracoBuilder builder)
where T : class, IComponent
{
builder.Components().Append<T>();
return builder;
}
} |
Thanks for this PR! 👍 I think it's a great idea because it not only makes things more ".Net Core like", it also encapsulates the actual implementation, so if for some reason we change it later on, we can just adapt the extensions methods and people that used them won't need to change anything in their code 😁🎉 I don't see any problems in following your second suggestion and having the extensions for the different collections. Cheers! |
Hi @mikecp Thanks for your review! 😄 I just updated the PR and added the methods below:
Would you like to review this? |
Hey @erikjanwestendorp , I just reviewed it and tested locally, it all works fine 👍 If you could make that small change, then it will be ready to be merged! |
Hi @mikecp Thanks for your review again! 👍 It wasn't actually a typo. I have followed the naming convention of, for example:
|
Hi @erikjanwestendorp , Woopsie, I totally missed the fact that the Umbraco collection itself was also called OEmbedProviders 🤦♂️ Then I guess it's best to follow the current naming convention the whole way, the O probably stands for "Object" or something. Would you mind getting back to your previous naming? Sorry about that😬 |
@mikecp Follow the current naming convention sounds good to me 😄! No problem of course! 👍 I renamed it again 😄 |
Thanks @erikjanwestendorp 👍😀 |
Most (if not all) of these providers use OEmbed to retrieve the HTML to embed, so it's actually using an implementation specific name. But then the actual implementation base class I would recommend changing the following (in a new PR, which needs to be merged before releasing 9.2.0):
|
Thanks @ronaldbarendse for the feedback, I think @erikjanwestendorp is gonna have nightmares about this renaming 😂 @erikjanwestendorp feeling like taking this into a new PR 😁? |
@ronaldbarendse Thanks for your feedback! 😄. @mikecp nightmares indeed about renaiming this 😂. @ronaldbarendse @mikecp working on it #11703 |
What was the conclusion for the naming? I think the O stands for Open as OEmbed is described as an open standard. I think some of the purpose is lost when switching to It's specifically providers for and following the OEmbed standard, so I think it would be wrong to rename the method to just |
@erikjanwestendorp Awesome work and thanks for getting it done this fast! @abjerner True, the current |
Description
Add an extension method to register content apps to make it possible to register content apps in the startup.cs class.
No idea if this is desirable. But to me it seems like a nice addition to easily register content apps. Maybe also an idea to do the same for Components?
Method can be used like: