Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve logic to handle multiple ModelFactoryProvider instances
Co-authored-by: live1206 <[email protected]>
  • Loading branch information
Copilot and live1206 committed Dec 11, 2025
commit bc04ea71a3ccac81206fd2b39d5721499e9688e5
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ internal class ModelFactoryVisitor : ScmLibraryVisitor
protected override TypeProvider? PostVisitType(TypeProvider type)
{
// Process model factory after all models have been visited
if (type is ModelFactoryProvider modelFactory && !_modelTypesEnsured)
if (type is ModelFactoryProvider modelFactory)
{
// Ensure model types are built now that all flattening is complete
ManagementClientGenerator.Instance.OutputLibrary.EnsureModelTypesBuilt();
_modelTypesEnsured = true;
// Ensure model types are built once, now that all flattening is complete
if (!_modelTypesEnsured)
{
ManagementClientGenerator.Instance.OutputLibrary.EnsureModelTypesBuilt();
_modelTypesEnsured = true;
}

var updatedMethods = new List<MethodProvider>();
foreach (var method in modelFactory.Methods)
Expand Down