From 138173398f3d9bcc64cd2ec0f8bdc747fb4ba4da Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Wed, 15 Jan 2025 09:48:37 +0800 Subject: [PATCH] Expose public APIs for Azure plugin to generate ResourceData (#5544) Expose more public APIs: - MrwSerializationtypeDefinition to manipulate serialization in sub-plugin - TypeFacotry.CreateModelCore to create ResourceData in Azure plugin The corresponding Azure plugin PR: https://github.com/Azure/azure-sdk-for-net/pull/47730 --- .../src/Providers/MrwSerializationTypeDefinition.cs | 3 +-- .../generator/Microsoft.Generator.CSharp/src/TypeFactory.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs index 80b55075be..b4e794f93a 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; using System.Diagnostics; @@ -26,7 +25,7 @@ namespace Microsoft.Generator.CSharp.ClientModel.Providers /// /// This class provides the set of serialization models, methods, and interfaces for a given model. /// - internal class MrwSerializationTypeDefinition : TypeProvider + public class MrwSerializationTypeDefinition : TypeProvider { private const string JsonModelWriteCoreMethodName = "JsonModelWriteCore"; private const string JsonModelCreateCoreMethodName = "JsonModelCreateCore"; diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/TypeFactory.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/TypeFactory.cs index 5dbaecfa82..e6f4f10277 100644 --- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/TypeFactory.cs +++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/TypeFactory.cs @@ -151,7 +151,7 @@ protected internal TypeFactory() return modelProvider; } - private ModelProvider? CreateModelCore(InputModelType model) + protected virtual ModelProvider? CreateModelCore(InputModelType model) { ModelProvider? type = new ModelProvider(model); if (Visitors.Count == 0)