ModelsGenerator to IModelsGenerator in BuildModelsBuilderController#16919
ModelsGenerator to IModelsGenerator in BuildModelsBuilderController#16919kjac merged 2 commits intoumbraco:contribfrom
Conversation
|
Hi there @kasparboelkjeldsen, 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 🤖 🙂 |
|
Thanks for your PR to fix #16918, to change One of the Core Collaborators team will review this as soon as possible. 👍 Best wishes Emma |
|
Sorry for the belated response on this one. And thanks for the PR 👍 Your fix works just fine, but we need it to be backwards compatible. This unfortunately entails adding a few more constructors with obsoletion. I think it goes something like this: [ActivatorUtilitiesConstructor]
public BuildModelsBuilderController(
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
ModelsGenerationError mbErrors,
IModelsGenerator modelGenerator)
{
_mbErrors = mbErrors;
_modelGenerator = modelGenerator;
_modelsBuilderSettings = modelsBuilderSettings.CurrentValue;
modelsBuilderSettings.OnChange(x => _modelsBuilderSettings = x);
}
[Obsolete("Please use the constructor that accepts IModelsGenerator only. Will be removed in V16.")]
public BuildModelsBuilderController(
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
ModelsGenerationError mbErrors,
ModelsGenerator modelGenerator)
: this(modelsBuilderSettings, mbErrors, (IModelsGenerator)modelGenerator)
{
}
// this constructor is required for the DI, otherwise it'll throw an "Ambiguous Constructor" errors at boot time.
[Obsolete("Please use the constructor that accepts IModelsGenerator only. Will be removed in V16.")]
public BuildModelsBuilderController(
IOptionsMonitor<ModelsBuilderSettings> modelsBuilderSettings,
ModelsGenerationError mbErrors,
IModelsGenerator modelGenerator,
ModelsGenerator notUsed)
: this(modelsBuilderSettings, mbErrors, modelGenerator)
{
}
|
|
@kjac noted - I've updated the pull request with the 2 obsolete constructors and the Activator attribute, as well as verified it still is working as intended locally. |
kjac
left a comment
There was a problem hiding this comment.
Good stuff, @kasparboelkjeldsen 💪
Prerequisites
This fixes #16918
Description
I have changed BuildModelsBuilderController to use IModelsGenerator so the functionality is the same as the SourceCodeAuto functionality.
It should have no impact on Umbraco out of the box, but allow easlier ModelsBuilder-replacement for developers.