diff --git a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/NameUtils.cs b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/NameUtils.cs
index 7d7b3b88db0..66b929e2ac5 100644
--- a/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/NameUtils.cs
+++ b/src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/NameUtils.cs
@@ -71,6 +71,11 @@ public static string GetEnumValue(string enumValue)
if (enumValue[i] == '_')
{
upper = true;
+
+ if (i == 0)
+ {
+ value.Append('_');
+ }
}
else if (upper)
{
diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/SchemaGeneratorTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/SchemaGeneratorTests.cs
index 0fe915e6708..2b82daedf11 100644
--- a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/SchemaGeneratorTests.cs
+++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/SchemaGeneratorTests.cs
@@ -529,4 +529,32 @@ query GetPeopleByPk($id: uuid!) {
"extend schema @key(fields: \"id\")",
FileResource.Open("HasuraSchema.graphql"));
}
+
+ [Fact]
+ public void EnumWithUnderscorePrefixedValues()
+ {
+ AssertResult(
+ """
+ schema {
+ query: Query
+ }
+
+ type Query {
+ field1: Enum1
+ }
+
+ enum Enum1 {
+ _a # -> "_A"
+ _a_b # -> "_AB"
+ _1 # -> "_1"
+ _1_2 # -> "_12"
+ __2 # -> "_2"
+ }
+ """,
+ """
+ query GetField1 {
+ field1
+ }
+ """);
+ }
}
diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.EnumWithUnderscorePrefixedValues.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.EnumWithUnderscorePrefixedValues.snap
new file mode 100644
index 00000000000..904196a000f
--- /dev/null
+++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/SchemaGeneratorTests.EnumWithUnderscorePrefixedValues.snap
@@ -0,0 +1,474 @@
+// ReSharper disable BuiltInTypeReferenceStyle
+// ReSharper disable RedundantNameQualifier
+// ReSharper disable ArrangeObjectCreationWhenTypeEvident
+// ReSharper disable UnusedType.Global
+// ReSharper disable PartialTypeWithSinglePart
+// ReSharper disable UnusedMethodReturnValue.Local
+// ReSharper disable ConvertToAutoProperty
+// ReSharper disable UnusedMember.Global
+// ReSharper disable SuggestVarOrType_SimpleTypes
+// ReSharper disable InconsistentNaming
+
+// FooClient
+
+//
+#nullable enable annotations
+#nullable disable warnings
+
+namespace Foo.Bar
+{
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1Result : global::System.IEquatable, IGetField1Result
+ {
+ public GetField1Result(global::Foo.Bar.Enum1? field1)
+ {
+ Field1 = field1;
+ }
+
+ public global::Foo.Bar.Enum1? Field1 { get; }
+
+ public virtual global::System.Boolean Equals(GetField1Result? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (((Field1 is null && other.Field1 is null) || Field1 != null && Field1.Equals(other.Field1)));
+ }
+
+ public override global::System.Boolean Equals(global::System.Object? obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return Equals((GetField1Result)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ if (Field1 != null)
+ {
+ hash ^= 397 * Field1.GetHashCode();
+ }
+
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetField1Result
+ {
+ public global::Foo.Bar.Enum1? Field1 { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public enum Enum1
+ {
+ _A,
+ _AB,
+ _1,
+ _12,
+ _2
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumParserGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class Enum1Serializer : global::StrawberryShake.Serialization.IInputValueFormatter, global::StrawberryShake.Serialization.ILeafValueParser
+ {
+ public global::System.String TypeName => "Enum1";
+ public Enum1 Parse(global::System.String serializedValue)
+ {
+ return serializedValue switch
+ {
+ "_a" => Enum1._A,
+ "_a_b" => Enum1._AB,
+ "_1" => Enum1._1,
+ "_1_2" => Enum1._12,
+ "__2" => Enum1._2,
+ _ => throw new global::StrawberryShake.GraphQLClientException($"String value '{serializedValue}' can't be converted to enum Enum1")};
+ }
+
+ public global::System.Object Format(global::System.Object? runtimeValue)
+ {
+ return runtimeValue switch
+ {
+ Enum1._A => "_a",
+ Enum1._AB => "_a_b",
+ Enum1._1 => "_1",
+ Enum1._12 => "_1_2",
+ Enum1._2 => "__2",
+ _ => throw new global::StrawberryShake.GraphQLClientException($"Enum Enum1 value '{runtimeValue}' can't be converted to string")};
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.OperationDocumentGenerator
+ ///
+ /// Represents the operation service of the GetField1 GraphQL operation
+ ///
+ /// query GetField1 {
+ /// field1
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1QueryDocument : global::StrawberryShake.IDocument
+ {
+ private GetField1QueryDocument()
+ {
+ }
+
+ public static GetField1QueryDocument Instance { get; } = new GetField1QueryDocument();
+ public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query;
+ public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x47, 0x65, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x20, 0x7b, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x20, 0x7d};
+ public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("sha1Hash", "b505bdfe64c0b4ef198f5363575dea66cf6092df");
+ public override global::System.String ToString()
+ {
+#if NETCOREAPP3_1_OR_GREATER
+ return global::System.Text.Encoding.UTF8.GetString(Body);
+#else
+ return global::System.Text.Encoding.UTF8.GetString(Body.ToArray());
+#endif
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.OperationServiceGenerator
+ ///
+ /// Represents the operation service of the GetField1 GraphQL operation
+ ///
+ /// query GetField1 {
+ /// field1
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1Query : global::Foo.Bar.IGetField1Query
+ {
+ private readonly global::StrawberryShake.IOperationExecutor _operationExecutor;
+ public GetField1Query(global::StrawberryShake.IOperationExecutor operationExecutor)
+ {
+ _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor));
+ }
+
+ global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IGetField1Result);
+ public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var request = CreateRequest();
+ return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
+ }
+
+ public global::System.IObservable> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null)
+ {
+ var request = CreateRequest();
+ return _operationExecutor.Watch(request, strategy);
+ }
+
+ private global::StrawberryShake.OperationRequest CreateRequest()
+ {
+ return CreateRequest(null);
+ }
+
+ private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables)
+ {
+ return new global::StrawberryShake.OperationRequest(id: GetField1QueryDocument.Instance.Hash.Value, name: "GetField1", document: GetField1QueryDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default);
+ }
+
+ global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables)
+ {
+ return CreateRequest();
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.OperationServiceInterfaceGenerator
+ ///
+ /// Represents the operation service of the GetField1 GraphQL operation
+ ///
+ /// query GetField1 {
+ /// field1
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetField1Query : global::StrawberryShake.IOperationRequestFactory
+ {
+ global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default);
+ global::System.IObservable> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null);
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ClientGenerator
+ ///
+ /// Represents the FooClient GraphQL client
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class FooClient : global::Foo.Bar.IFooClient
+ {
+ private readonly global::Foo.Bar.IGetField1Query _getField1;
+ public FooClient(global::Foo.Bar.IGetField1Query getField1)
+ {
+ _getField1 = getField1 ?? throw new global::System.ArgumentNullException(nameof(getField1));
+ }
+
+ public static global::System.String ClientName => "FooClient";
+ public global::Foo.Bar.IGetField1Query GetField1 => _getField1;
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ClientInterfaceGenerator
+ ///
+ /// Represents the FooClient GraphQL client
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IFooClient
+ {
+ global::Foo.Bar.IGetField1Query GetField1 { get; }
+ }
+}
+
+namespace Foo.Bar.State
+{
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultDataFactoryGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1ResultFactory : global::StrawberryShake.IOperationResultDataFactory
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ public GetField1ResultFactory(global::StrawberryShake.IEntityStore entityStore)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ }
+
+ global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::Foo.Bar.IGetField1Result);
+ public GetField1Result Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ if (dataInfo is GetField1ResultInfo info)
+ {
+ return new GetField1Result(info.Field1);
+ }
+
+ throw new global::System.ArgumentException("GetField1ResultInfo expected.");
+ }
+
+ global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
+ {
+ return Create(dataInfo, snapshot);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInfoGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1ResultInfo : global::StrawberryShake.IOperationResultDataInfo
+ {
+ private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds;
+ private readonly global::System.UInt64 _version;
+ public GetField1ResultInfo(global::Foo.Bar.Enum1? field1, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version)
+ {
+ Field1 = field1;
+ _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
+ _version = version;
+ }
+
+ public global::Foo.Bar.Enum1? Field1 { get; }
+
+ public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds;
+ public global::System.UInt64 Version => _version;
+ public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
+ {
+ return new GetField1ResultInfo(Field1, _entityIds, version);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.JsonResultBuilderGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetField1Builder : global::StrawberryShake.OperationResultBuilder
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _enum1Parser;
+ public GetField1Builder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
+ ResultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
+ _enum1Parser = serializerResolver.GetLeafValueParser("Enum1") ?? throw new global::System.ArgumentException("No serializer for type `Enum1` found.");
+ }
+
+ protected override global::StrawberryShake.IOperationResultDataFactory ResultDataFactory { get; }
+
+ protected override global::StrawberryShake.IOperationResultDataInfo BuildData(global::System.Text.Json.JsonElement obj)
+ {
+ var entityIds = new global::System.Collections.Generic.HashSet();
+ global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
+ _entityStore.Update(session =>
+ {
+ snapshot = session.CurrentSnapshot;
+ });
+ return new GetField1ResultInfo(Deserialize_Enum1(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "field1")), entityIds, snapshot.Version);
+ }
+
+ private global::Foo.Bar.Enum1? Deserialize_Enum1(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ return null;
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ return null;
+ }
+
+ return _enum1Parser.Parse(obj.Value.GetString()!);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EntityIdFactoryGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class FooClientEntityIdFactory : global::StrawberryShake.IEntityIdSerializer
+ {
+ private static readonly global::System.Text.Json.JsonWriterOptions _options = new global::System.Text.Json.JsonWriterOptions()
+ {Indented = false};
+ public global::StrawberryShake.EntityId Parse(global::System.Text.Json.JsonElement obj)
+ {
+ global::System.String __typename = obj.GetProperty("__typename").GetString()!;
+ return __typename switch
+ {
+ _ => throw new global::System.NotSupportedException()};
+ }
+
+ public global::System.String Format(global::StrawberryShake.EntityId entityId)
+ {
+ return entityId.Name switch
+ {
+ _ => throw new global::System.NotSupportedException()};
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.StoreAccessorGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class FooClientStoreAccessor : global::StrawberryShake.StoreAccessor
+ {
+ public FooClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable requestFactories, global::System.Collections.Generic.IEnumerable resultDataFactories) : base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
+ {
+ }
+ }
+}
+
+namespace Microsoft.Extensions.DependencyInjection
+{
+ // StrawberryShake.CodeGeneration.CSharp.Generators.DependencyInjectionGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public static partial class FooClientServiceCollectionExtensions
+ {
+ public static global::StrawberryShake.IClientBuilder AddFooClient(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly)
+ {
+ var serviceCollection = new global::Microsoft.Extensions.DependencyInjection.ServiceCollection();
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp =>
+ {
+ ConfigureClientDefault(sp, serviceCollection, strategy);
+ return new ClientServiceProvider(global::Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(serviceCollection));
+ });
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::Foo.Bar.State.FooClientStoreAccessor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)));
+ return new global::StrawberryShake.ClientBuilder("FooClient", services, serviceCollection);
+ }
+
+ private static global::Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureClientDefault(global::System.IServiceProvider parentServices, global::Microsoft.Extensions.DependencyInjection.ServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly)
+ {
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton(services, sp => new global::StrawberryShake.OperationStore(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp =>
+ {
+ var clientFactory = global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(parentServices);
+ return new global::StrawberryShake.Transport.Http.HttpConnection(() => clientFactory.CreateClient("FooClient"));
+ });
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::StrawberryShake.Serialization.SerializerResolver(global::System.Linq.Enumerable.Concat(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(parentServices), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp))));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::Foo.Bar.State.GetField1ResultFactory>(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::Foo.Bar.State.GetField1Builder>(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::StrawberryShake.Json.JsonResultPatcher>(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp));
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp));
+ return services;
+ }
+
+ private sealed class ClientServiceProvider : System.IServiceProvider, System.IDisposable
+ {
+ private readonly System.IServiceProvider _provider;
+ public ClientServiceProvider(System.IServiceProvider provider)
+ {
+ _provider = provider;
+ }
+
+ public object? GetService(System.Type serviceType)
+ {
+ return _provider.GetService(serviceType);
+ }
+
+ public void Dispose()
+ {
+ if (_provider is System.IDisposable d)
+ {
+ d.Dispose();
+ }
+ }
+ }
+ }
+}
+
+