diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/InheritanceGeneratorTests.cs b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/InheritanceGeneratorTests.cs
new file mode 100644
index 00000000000..9b6c8c675e1
--- /dev/null
+++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/InheritanceGeneratorTests.cs
@@ -0,0 +1,96 @@
+using static StrawberryShake.CodeGeneration.CSharp.GeneratorTestHelper;
+
+namespace StrawberryShake.CodeGeneration.CSharp;
+
+// Regression guard for ChilliCream/graphql-platform#5593, where two object types
+// sharing a common interface base (Exercise and Survey both implementing Activity)
+// caused the generator to emit a duplicate base class. The scenario generates
+// correctly on the current type-system pipeline; these tests lock that in.
+public class InheritanceGeneratorTests
+{
+ private const string EntityInterfaceSchema =
+ @"type Query {
+ activities: [Activity!]!
+ activitiesPaged: ActivitiesPagedConnection
+ }
+
+ interface Activity {
+ id: Uuid!
+ activityType: String!
+ description: String
+ name: String!
+ }
+
+ type Exercise implements Activity {
+ id: Uuid!
+ activityType: String!
+ category: ExerciseCategory!
+ description: String
+ name: String!
+ }
+
+ type Survey implements Activity {
+ id: Uuid!
+ activityType: String!
+ description: String
+ name: String!
+ }
+
+ type ActivitiesPagedConnection {
+ nodes: [Activity!]
+ totalCount: Int!
+ }
+
+ enum ExerciseCategory {
+ NONE
+ CATEGORY1
+ CATEGORY2
+ }
+
+ scalar Uuid";
+
+ [Fact]
+ public void Interface_Entity_With_Two_Implementations_InlineFragments()
+ {
+ AssertResult(
+ @"query GetActivities {
+ activities {
+ id
+ activityType
+ name
+ ... on Exercise {
+ category
+ }
+ ... on Survey {
+ description
+ }
+ }
+ }",
+ EntityInterfaceSchema,
+ "extend schema @key(fields: \"id\")");
+ }
+
+ [Fact]
+ public void Interface_Entity_Connection_With_Two_Implementations()
+ {
+ AssertResult(
+ @"query GetActivitiesPaged {
+ activitiesPaged {
+ nodes {
+ id
+ activityType
+ name
+ ... on Exercise {
+ category
+ }
+ ... on Survey {
+ description
+ }
+ }
+ totalCount
+ }
+ }",
+ EntityInterfaceSchema,
+ "extend schema @key(fields: \"id\")");
+ }
+}
diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_Connection_With_Two_Implementations.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_Connection_With_Two_Implementations.snap
new file mode 100644
index 00000000000..5e3a2c77ac8
--- /dev/null
+++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_Connection_With_Two_Implementations.snap
@@ -0,0 +1,1179 @@
+// ReSharper disable ArrangeObjectCreationWhenTypeEvident
+// ReSharper disable BuiltInTypeReferenceStyle
+// ReSharper disable ConvertToAutoProperty
+// ReSharper disable InconsistentNaming
+// ReSharper disable PartialTypeWithSinglePart
+// ReSharper disable PreferConcreteValueOverDefault
+// ReSharper disable RedundantNameQualifier
+// ReSharper disable SuggestVarOrType_SimpleTypes
+// ReSharper disable UnusedMember.Global
+// ReSharper disable UnusedMethodReturnValue.Local
+// ReSharper disable UnusedType.Global
+// ReSharper disable UnusedVariable
+
+// 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 GetActivitiesPagedResult : global::System.IEquatable, IGetActivitiesPagedResult
+ {
+ public GetActivitiesPagedResult(global::Foo.Bar.IGetActivitiesPaged_ActivitiesPaged? activitiesPaged)
+ {
+ ActivitiesPaged = activitiesPaged;
+ }
+
+ public global::Foo.Bar.IGetActivitiesPaged_ActivitiesPaged? ActivitiesPaged { get; }
+
+ public virtual global::System.Boolean Equals(GetActivitiesPagedResult? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (((ActivitiesPaged is null && other.ActivitiesPaged is null) || ActivitiesPaged != null && ActivitiesPaged.Equals(other.ActivitiesPaged)));
+ }
+
+ 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((GetActivitiesPagedResult)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ if (ActivitiesPaged != null)
+ {
+ hash ^= 397 * ActivitiesPaged.GetHashCode();
+ }
+
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection : global::System.IEquatable, IGetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection
+ {
+ public GetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection(global::System.Collections.Generic.IReadOnlyList? nodes, global::System.Int32 totalCount)
+ {
+ Nodes = nodes;
+ TotalCount = totalCount;
+ }
+
+ public global::System.Collections.Generic.IReadOnlyList? Nodes { get; }
+ public global::System.Int32 TotalCount { get; }
+
+ public virtual global::System.Boolean Equals(GetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (global::StrawberryShake.Internal.ComparisonHelper.SequenceEqual(Nodes, other.Nodes)) && global::System.Object.Equals(TotalCount, other.TotalCount);
+ }
+
+ 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((GetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ if (Nodes != null)
+ {
+ foreach (var Nodes_elm in Nodes)
+ {
+ hash ^= 397 * Nodes_elm.GetHashCode();
+ }
+ }
+
+ hash ^= 397 * TotalCount.GetHashCode();
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise : global::System.IEquatable, IGetActivitiesPaged_ActivitiesPaged_Nodes_Exercise
+ {
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise(global::System.Guid id, global::System.String activityType, global::System.String name, global::Foo.Bar.ExerciseCategory category)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Category = category;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+
+ public virtual global::System.Boolean Equals(GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (Id.Equals(other.Id)) && ActivityType.Equals(other.ActivityType) && Name.Equals(other.Name) && Category.Equals(other.Category);
+ }
+
+ 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((GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ hash ^= 397 * Id.GetHashCode();
+ hash ^= 397 * ActivityType.GetHashCode();
+ hash ^= 397 * Name.GetHashCode();
+ hash ^= 397 * Category.GetHashCode();
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPaged_ActivitiesPaged_Nodes_Survey : global::System.IEquatable, IGetActivitiesPaged_ActivitiesPaged_Nodes_Survey
+ {
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_Survey(global::System.Guid id, global::System.String activityType, global::System.String name, global::System.String? description)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Description = description;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::System.String? Description { get; }
+
+ public virtual global::System.Boolean Equals(GetActivitiesPaged_ActivitiesPaged_Nodes_Survey? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (Id.Equals(other.Id)) && ActivityType.Equals(other.ActivityType) && Name.Equals(other.Name) && ((Description is null && other.Description is null) || Description != null && Description.Equals(other.Description));
+ }
+
+ 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((GetActivitiesPaged_ActivitiesPaged_Nodes_Survey)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ hash ^= 397 * Id.GetHashCode();
+ hash ^= 397 * ActivityType.GetHashCode();
+ hash ^= 397 * Name.GetHashCode();
+ if (Description != null)
+ {
+ hash ^= 397 * Description.GetHashCode();
+ }
+
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPagedResult
+ {
+ public global::Foo.Bar.IGetActivitiesPaged_ActivitiesPaged? ActivitiesPaged { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPaged_ActivitiesPaged
+ {
+ public global::System.Collections.Generic.IReadOnlyList? Nodes { get; }
+ public global::System.Int32 TotalCount { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection : IGetActivitiesPaged_ActivitiesPaged
+ {
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPaged_ActivitiesPaged_Nodes
+ {
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPaged_ActivitiesPaged_Nodes_Exercise : IGetActivitiesPaged_ActivitiesPaged_Nodes
+ {
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPaged_ActivitiesPaged_Nodes_Survey : IGetActivitiesPaged_ActivitiesPaged_Nodes
+ {
+ public global::System.String? Description { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public enum ExerciseCategory
+ {
+ None,
+ Category1,
+ Category2
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumParserGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class ExerciseCategorySerializer : global::StrawberryShake.Serialization.IInputValueFormatter, global::StrawberryShake.Serialization.ILeafValueParser
+ {
+ public global::System.String TypeName => "ExerciseCategory";
+
+ public ExerciseCategory Parse(global::System.String serializedValue)
+ {
+ return serializedValue switch
+ {
+ "NONE" => ExerciseCategory.None,
+ "CATEGORY1" => ExerciseCategory.Category1,
+ "CATEGORY2" => ExerciseCategory.Category2,
+ _ => throw new global::StrawberryShake.GraphQLClientException($"String value '{serializedValue}' can't be converted to enum ExerciseCategory")};
+ }
+
+ public global::System.Object Format(global::System.Object? runtimeValue)
+ {
+ return runtimeValue switch
+ {
+ ExerciseCategory.None => "NONE",
+ ExerciseCategory.Category1 => "CATEGORY1",
+ ExerciseCategory.Category2 => "CATEGORY2",
+ _ => throw new global::StrawberryShake.GraphQLClientException($"Enum ExerciseCategory value '{runtimeValue}' can't be converted to string")};
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.OperationDocumentGenerator
+ ///
+ /// Represents the operation service of the GetActivitiesPaged GraphQL operation
+ ///
+ /// query GetActivitiesPaged {
+ /// activitiesPaged {
+ /// __typename
+ /// nodes {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// totalCount
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPagedQueryDocument : global::StrawberryShake.IDocument
+ {
+ private GetActivitiesPagedQueryDocument()
+ {
+ }
+
+ public static GetActivitiesPagedQueryDocument Instance { get; } = new GetActivitiesPagedQueryDocument();
+ public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query;
+ public global::System.ReadOnlySpan Body => "query GetActivitiesPaged { activitiesPaged { __typename nodes { __typename id activityType name ... on Exercise { category } ... on Survey { description } ... on Exercise { id } ... on Survey { id } } totalCount } }"u8;
+ public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("sha1Hash", "e74c91dc8aa85aec93c44c72552f0562c25151b6");
+
+ 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 GetActivitiesPaged GraphQL operation
+ ///
+ /// query GetActivitiesPaged {
+ /// activitiesPaged {
+ /// __typename
+ /// nodes {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// totalCount
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPagedQuery : global::Foo.Bar.IGetActivitiesPagedQuery
+ {
+ private readonly global::StrawberryShake.IOperationExecutor _operationExecutor;
+ private readonly global::System.Collections.Immutable.ImmutableArray> _configure = global::System.Collections.Immutable.ImmutableArray>.Empty;
+ public GetActivitiesPagedQuery(global::StrawberryShake.IOperationExecutor operationExecutor)
+ {
+ _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor));
+ }
+
+ private GetActivitiesPagedQuery(global::StrawberryShake.IOperationExecutor operationExecutor, global::System.Collections.Immutable.ImmutableArray> configure)
+ {
+ _operationExecutor = operationExecutor;
+ _configure = configure;
+ }
+
+ global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IGetActivitiesPagedResult);
+
+ public global::Foo.Bar.IGetActivitiesPagedQuery With(global::System.Action configure)
+ {
+ return new global::Foo.Bar.GetActivitiesPagedQuery(_operationExecutor, _configure.Add(configure));
+ }
+
+ public global::Foo.Bar.IGetActivitiesPagedQuery WithRequestUri(global::System.Uri requestUri)
+ {
+ return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.RequestUri"] = requestUri);
+ }
+
+ public global::Foo.Bar.IGetActivitiesPagedQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient)
+ {
+ return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.HttpClient"] = httpClient);
+ }
+
+ public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var request = CreateRequest();
+ foreach (var configure in _configure)
+ {
+ configure(request);
+ }
+
+ 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: GetActivitiesPagedQueryDocument.Instance.Hash.Value, name: "GetActivitiesPaged", document: GetActivitiesPagedQueryDocument.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 GetActivitiesPaged GraphQL operation
+ ///
+ /// query GetActivitiesPaged {
+ /// activitiesPaged {
+ /// __typename
+ /// nodes {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// totalCount
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesPagedQuery : global::StrawberryShake.IOperationRequestFactory
+ {
+ global::Foo.Bar.IGetActivitiesPagedQuery With(global::System.Action configure);
+ global::Foo.Bar.IGetActivitiesPagedQuery WithRequestUri(global::System.Uri requestUri);
+ global::Foo.Bar.IGetActivitiesPagedQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient);
+ 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.IGetActivitiesPagedQuery _getActivitiesPaged;
+ public FooClient(global::Foo.Bar.IGetActivitiesPagedQuery getActivitiesPaged)
+ {
+ _getActivitiesPaged = getActivitiesPaged ?? throw new global::System.ArgumentNullException(nameof(getActivitiesPaged));
+ }
+
+ public static global::System.String ClientName => "FooClient";
+ public global::Foo.Bar.IGetActivitiesPagedQuery GetActivitiesPaged => _getActivitiesPaged;
+ }
+
+ // 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.IGetActivitiesPagedQuery GetActivitiesPaged { get; }
+ }
+}
+
+namespace Foo.Bar.State
+{
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
+ public partial class ExerciseEntity
+ {
+ public ExerciseEntity(global::System.Guid id = default !, global::System.String activityType = default !, global::System.String name = default !, global::Foo.Bar.ExerciseCategory category = default !)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Category = category;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
+ public partial class SurveyEntity
+ {
+ public SurveyEntity(global::System.Guid id = default !, global::System.String activityType = default !, global::System.String name = default !, global::System.String? description = default !)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Description = description;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::System.String? Description { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultDataFactoryGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPagedResultFactory : global::StrawberryShake.IOperationResultDataFactory
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ private readonly global::StrawberryShake.IEntityMapper _getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper;
+ private readonly global::StrawberryShake.IEntityMapper _getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper;
+ public GetActivitiesPagedResultFactory(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityMapper getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper, global::StrawberryShake.IEntityMapper getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ _getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper = getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper ?? throw new global::System.ArgumentNullException(nameof(getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper));
+ _getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper = getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper ?? throw new global::System.ArgumentNullException(nameof(getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper));
+ }
+
+ global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::Foo.Bar.IGetActivitiesPagedResult);
+
+ public GetActivitiesPagedResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ if (dataInfo is GetActivitiesPagedResultInfo info)
+ {
+ return new GetActivitiesPagedResult(MapIGetActivitiesPaged_ActivitiesPaged(info.ActivitiesPaged, snapshot));
+ }
+
+ throw new global::System.ArgumentException("GetActivitiesPagedResultInfo expected.");
+ }
+
+ private global::Foo.Bar.IGetActivitiesPaged_ActivitiesPaged? MapIGetActivitiesPaged_ActivitiesPaged(global::Foo.Bar.State.ActivitiesPagedConnectionData? data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
+ {
+ if (data is null)
+ {
+ return null;
+ }
+
+ IGetActivitiesPaged_ActivitiesPaged returnValue = default !;
+ if (data.__typename.Equals("ActivitiesPagedConnection", global::System.StringComparison.Ordinal))
+ {
+ returnValue = new GetActivitiesPaged_ActivitiesPaged_ActivitiesPagedConnection(MapIGetActivitiesPaged_ActivitiesPaged_NodesNonNullableArray(data.Nodes, snapshot), data.TotalCount ?? throw new global::System.ArgumentNullException());
+ }
+ else
+ {
+ throw new global::System.NotSupportedException();
+ }
+
+ return returnValue;
+ }
+
+ private global::System.Collections.Generic.IReadOnlyList? MapIGetActivitiesPaged_ActivitiesPaged_NodesNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
+ {
+ if (list is null)
+ {
+ return null;
+ }
+
+ var activitys = new global::System.Collections.Generic.List();
+ foreach (global::StrawberryShake.EntityId child in list)
+ {
+ activitys.Add(MapNonNullableIGetActivitiesPaged_ActivitiesPaged_Nodes(child, snapshot));
+ }
+
+ return activitys;
+ }
+
+ private global::Foo.Bar.IGetActivitiesPaged_ActivitiesPaged_Nodes MapNonNullableIGetActivitiesPaged_ActivitiesPaged_Nodes(global::StrawberryShake.EntityId entityId, global::StrawberryShake.IEntityStoreSnapshot snapshot)
+ {
+ if (entityId.Name.Equals("Exercise", global::System.StringComparison.Ordinal))
+ {
+ return _getActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper.Map(snapshot.GetEntity(entityId) ?? throw new global::StrawberryShake.GraphQLClientException());
+ }
+
+ if (entityId.Name.Equals("Survey", global::System.StringComparison.Ordinal))
+ {
+ return _getActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper.Map(snapshot.GetEntity(entityId) ?? throw new global::StrawberryShake.GraphQLClientException());
+ }
+
+ throw new global::System.NotSupportedException();
+ }
+
+ 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 GetActivitiesPagedResultInfo : global::StrawberryShake.IOperationResultDataInfo
+ {
+ private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds;
+ private readonly global::System.UInt64 _version;
+ public GetActivitiesPagedResultInfo(global::Foo.Bar.State.ActivitiesPagedConnectionData? activitiesPaged, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version)
+ {
+ ActivitiesPaged = activitiesPaged;
+ _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
+ _version = version;
+ }
+
+ public global::Foo.Bar.State.ActivitiesPagedConnectionData? ActivitiesPaged { 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 GetActivitiesPagedResultInfo(ActivitiesPaged, _entityIds, version);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.JsonResultBuilderGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPagedBuilder : global::StrawberryShake.OperationResultBuilder
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _exerciseCategoryParser;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _intParser;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _uuidParser;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser;
+ public GetActivitiesPagedBuilder(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));
+ _exerciseCategoryParser = serializerResolver.GetLeafValueParser("ExerciseCategory") ?? throw new global::System.ArgumentException("No serializer for type `ExerciseCategory` found.");
+ _intParser = serializerResolver.GetLeafValueParser("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
+ _uuidParser = serializerResolver.GetLeafValueParser("Uuid") ?? throw new global::System.ArgumentException("No serializer for type `Uuid` found.");
+ _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` 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 !;
+ global::Foo.Bar.State.ActivitiesPagedConnectionData? activitiesPagedId = default !;
+ _entityStore.Update(session =>
+ {
+ activitiesPagedId = Deserialize_IGetActivitiesPaged_ActivitiesPaged(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activitiesPaged"), entityIds);
+ snapshot = session.CurrentSnapshot;
+ });
+ return new GetActivitiesPagedResultInfo(activitiesPagedId, entityIds, snapshot.Version);
+ }
+
+ private global::Foo.Bar.State.ActivitiesPagedConnectionData? Deserialize_IGetActivitiesPaged_ActivitiesPaged(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet entityIds)
+ {
+ if (!obj.HasValue)
+ {
+ return null;
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ return null;
+ }
+
+ var typename = obj.Value.GetProperty("__typename").GetString();
+ if (typename?.Equals("ActivitiesPagedConnection", global::System.StringComparison.Ordinal) ?? false)
+ {
+ return new global::Foo.Bar.State.ActivitiesPagedConnectionData(typename, nodes: Update_IGetActivitiesPaged_ActivitiesPaged_NodesEntityNonNullableArray(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "nodes"), entityIds), totalCount: Deserialize_NonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "totalCount")));
+ }
+
+ throw new global::System.NotSupportedException();
+ }
+
+ private global::System.Collections.Generic.IReadOnlyList? Update_IGetActivitiesPaged_ActivitiesPaged_NodesEntityNonNullableArray(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet entityIds)
+ {
+ if (!obj.HasValue)
+ {
+ return null;
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ return null;
+ }
+
+ var activitys = new global::System.Collections.Generic.List();
+ foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
+ {
+ activitys.Add(Update_NonNullableIGetActivitiesPaged_ActivitiesPaged_NodesEntity(session, child, entityIds));
+ }
+
+ return activitys;
+ }
+
+ private global::StrawberryShake.EntityId Update_NonNullableIGetActivitiesPaged_ActivitiesPaged_NodesEntity(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet entityIds)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value);
+ entityIds.Add(entityId);
+ if (entityId.Name.Equals("Exercise", global::System.StringComparison.Ordinal))
+ {
+ if (session.CurrentSnapshot.TryGetEntity(entityId, out global::Foo.Bar.State.ExerciseEntity? entity))
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.ExerciseEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_NonNullableExerciseCategory(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "category"))));
+ }
+ else
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.ExerciseEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_NonNullableExerciseCategory(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "category"))));
+ }
+
+ return entityId;
+ }
+
+ if (entityId.Name.Equals("Survey", global::System.StringComparison.Ordinal))
+ {
+ if (session.CurrentSnapshot.TryGetEntity(entityId, out global::Foo.Bar.State.SurveyEntity? entity))
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.SurveyEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description"))));
+ }
+ else
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.SurveyEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description"))));
+ }
+
+ return entityId;
+ }
+
+ throw new global::System.NotSupportedException();
+ }
+
+ private global::System.Guid Deserialize_NonNullableGuid(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _uuidParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::System.String Deserialize_NonNullableString(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _stringParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::Foo.Bar.ExerciseCategory Deserialize_NonNullableExerciseCategory(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _exerciseCategoryParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::System.String? Deserialize_String(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ return null;
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ return null;
+ }
+
+ return _stringParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::System.Int32 Deserialize_NonNullableInt32(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _intParser.Parse(obj.Value.GetInt32()!);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.DataTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
+ public partial class ActivitiesPagedConnectionData
+ {
+ public ActivitiesPagedConnectionData(global::System.String __typename, global::System.Collections.Generic.IReadOnlyList? nodes = default !, global::System.Int32? totalCount = default !)
+ {
+ this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
+ Nodes = nodes;
+ TotalCount = totalCount;
+ }
+
+ public global::System.String __typename { get; }
+ public global::System.Collections.Generic.IReadOnlyList? Nodes { get; }
+ public global::System.Int32? TotalCount { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper : global::StrawberryShake.IEntityMapper
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper(global::StrawberryShake.IEntityStore entityStore)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ }
+
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise Map(global::Foo.Bar.State.ExerciseEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ return new GetActivitiesPaged_ActivitiesPaged_Nodes_Exercise(entity.Id, entity.ActivityType, entity.Name, entity.Category);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper : global::StrawberryShake.IEntityMapper
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper(global::StrawberryShake.IEntityStore entityStore)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ }
+
+ public GetActivitiesPaged_ActivitiesPaged_Nodes_Survey Map(global::Foo.Bar.State.SurveyEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ return new GetActivitiesPaged_ActivitiesPaged_Nodes_Survey(entity.Id, entity.ActivityType, entity.Name, entity.Description);
+ }
+ }
+
+ // 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
+ {
+ "Exercise" => ParseExerciseEntityId(obj, __typename),
+ "Survey" => ParseSurveyEntityId(obj, __typename),
+ _ => throw new global::System.NotSupportedException()};
+ }
+
+ public global::System.String Format(global::StrawberryShake.EntityId entityId)
+ {
+ return entityId.Name switch
+ {
+ "Exercise" => FormatExerciseEntityId(entityId),
+ "Survey" => FormatSurveyEntityId(entityId),
+ _ => throw new global::System.NotSupportedException()};
+ }
+
+ private global::StrawberryShake.EntityId ParseExerciseEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
+ {
+ return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
+ }
+
+ private global::System.String FormatExerciseEntityId(global::StrawberryShake.EntityId entityId)
+ {
+ using var writer = new global::StrawberryShake.Internal.ArrayWriter();
+ using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
+ jsonWriter.WriteStartObject();
+ jsonWriter.WriteString("__typename", entityId.Name);
+ jsonWriter.WriteString("id", (global::System.String)entityId.Value);
+ jsonWriter.WriteEndObject();
+ jsonWriter.Flush();
+ return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
+ }
+
+ private global::StrawberryShake.EntityId ParseSurveyEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
+ {
+ return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
+ }
+
+ private global::System.String FormatSurveyEntityId(global::StrawberryShake.EntityId entityId)
+ {
+ using var writer = new global::StrawberryShake.Internal.ArrayWriter();
+ using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
+ jsonWriter.WriteStartObject();
+ jsonWriter.WriteString("__typename", entityId.Name);
+ jsonWriter.WriteString("id", (global::System.String)entityId.Value);
+ jsonWriter.WriteEndObject();
+ jsonWriter.Flush();
+ return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
+ }
+ }
+
+ // 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)));
+ 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, global::Foo.Bar.State.GetActivitiesPaged_ActivitiesPaged_Nodes_ExerciseFromExerciseEntityMapper>(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::Foo.Bar.State.GetActivitiesPaged_ActivitiesPaged_Nodes_SurveyFromSurveyEntityMapper>(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);
+ 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, new global::StrawberryShake.Serialization.UUIDSerializer("Uuid"));
+ 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.GetActivitiesPagedResultFactory>(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.GetActivitiesPagedBuilder>(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();
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_With_Two_Implementations_InlineFragments.snap b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_With_Two_Implementations_InlineFragments.snap
new file mode 100644
index 00000000000..e6302afe5ff
--- /dev/null
+++ b/src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/__snapshots__/InheritanceGeneratorTests.Interface_Entity_With_Two_Implementations_InlineFragments.snap
@@ -0,0 +1,1007 @@
+// ReSharper disable ArrangeObjectCreationWhenTypeEvident
+// ReSharper disable BuiltInTypeReferenceStyle
+// ReSharper disable ConvertToAutoProperty
+// ReSharper disable InconsistentNaming
+// ReSharper disable PartialTypeWithSinglePart
+// ReSharper disable PreferConcreteValueOverDefault
+// ReSharper disable RedundantNameQualifier
+// ReSharper disable SuggestVarOrType_SimpleTypes
+// ReSharper disable UnusedMember.Global
+// ReSharper disable UnusedMethodReturnValue.Local
+// ReSharper disable UnusedType.Global
+// ReSharper disable UnusedVariable
+
+// 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 GetActivitiesResult : global::System.IEquatable, IGetActivitiesResult
+ {
+ public GetActivitiesResult(global::System.Collections.Generic.IReadOnlyList activities)
+ {
+ Activities = activities;
+ }
+
+ public global::System.Collections.Generic.IReadOnlyList Activities { get; }
+
+ public virtual global::System.Boolean Equals(GetActivitiesResult? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (global::StrawberryShake.Internal.ComparisonHelper.SequenceEqual(Activities, other.Activities));
+ }
+
+ 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((GetActivitiesResult)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ foreach (var Activities_elm in Activities)
+ {
+ hash ^= 397 * Activities_elm.GetHashCode();
+ }
+
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivities_Activities_Exercise : global::System.IEquatable, IGetActivities_Activities_Exercise
+ {
+ public GetActivities_Activities_Exercise(global::System.Guid id, global::System.String activityType, global::System.String name, global::Foo.Bar.ExerciseCategory category)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Category = category;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+
+ public virtual global::System.Boolean Equals(GetActivities_Activities_Exercise? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (Id.Equals(other.Id)) && ActivityType.Equals(other.ActivityType) && Name.Equals(other.Name) && Category.Equals(other.Category);
+ }
+
+ 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((GetActivities_Activities_Exercise)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ hash ^= 397 * Id.GetHashCode();
+ hash ^= 397 * ActivityType.GetHashCode();
+ hash ^= 397 * Name.GetHashCode();
+ hash ^= 397 * Category.GetHashCode();
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivities_Activities_Survey : global::System.IEquatable, IGetActivities_Activities_Survey
+ {
+ public GetActivities_Activities_Survey(global::System.Guid id, global::System.String activityType, global::System.String name, global::System.String? description)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Description = description;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::System.String? Description { get; }
+
+ public virtual global::System.Boolean Equals(GetActivities_Activities_Survey? other)
+ {
+ if (ReferenceEquals(null, other))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, other))
+ {
+ return true;
+ }
+
+ if (other.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return (Id.Equals(other.Id)) && ActivityType.Equals(other.ActivityType) && Name.Equals(other.Name) && ((Description is null && other.Description is null) || Description != null && Description.Equals(other.Description));
+ }
+
+ 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((GetActivities_Activities_Survey)obj);
+ }
+
+ public override global::System.Int32 GetHashCode()
+ {
+ unchecked
+ {
+ int hash = 5;
+ hash ^= 397 * Id.GetHashCode();
+ hash ^= 397 * ActivityType.GetHashCode();
+ hash ^= 397 * Name.GetHashCode();
+ if (Description != null)
+ {
+ hash ^= 397 * Description.GetHashCode();
+ }
+
+ return hash;
+ }
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesResult
+ {
+ public global::System.Collections.Generic.IReadOnlyList Activities { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivities_Activities
+ {
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivities_Activities_Exercise : IGetActivities_Activities
+ {
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultInterfaceGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivities_Activities_Survey : IGetActivities_Activities
+ {
+ public global::System.String? Description { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public enum ExerciseCategory
+ {
+ None,
+ Category1,
+ Category2
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EnumParserGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class ExerciseCategorySerializer : global::StrawberryShake.Serialization.IInputValueFormatter, global::StrawberryShake.Serialization.ILeafValueParser
+ {
+ public global::System.String TypeName => "ExerciseCategory";
+
+ public ExerciseCategory Parse(global::System.String serializedValue)
+ {
+ return serializedValue switch
+ {
+ "NONE" => ExerciseCategory.None,
+ "CATEGORY1" => ExerciseCategory.Category1,
+ "CATEGORY2" => ExerciseCategory.Category2,
+ _ => throw new global::StrawberryShake.GraphQLClientException($"String value '{serializedValue}' can't be converted to enum ExerciseCategory")};
+ }
+
+ public global::System.Object Format(global::System.Object? runtimeValue)
+ {
+ return runtimeValue switch
+ {
+ ExerciseCategory.None => "NONE",
+ ExerciseCategory.Category1 => "CATEGORY1",
+ ExerciseCategory.Category2 => "CATEGORY2",
+ _ => throw new global::StrawberryShake.GraphQLClientException($"Enum ExerciseCategory value '{runtimeValue}' can't be converted to string")};
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.OperationDocumentGenerator
+ ///
+ /// Represents the operation service of the GetActivities GraphQL operation
+ ///
+ /// query GetActivities {
+ /// activities {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesQueryDocument : global::StrawberryShake.IDocument
+ {
+ private GetActivitiesQueryDocument()
+ {
+ }
+
+ public static GetActivitiesQueryDocument Instance { get; } = new GetActivitiesQueryDocument();
+ public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query;
+ public global::System.ReadOnlySpan Body => "query GetActivities { activities { __typename id activityType name ... on Exercise { category } ... on Survey { description } ... on Exercise { id } ... on Survey { id } } }"u8;
+ public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("sha1Hash", "f7584ae9a139721b18d721a2f763e2a6b0c44cad");
+
+ 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 GetActivities GraphQL operation
+ ///
+ /// query GetActivities {
+ /// activities {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesQuery : global::Foo.Bar.IGetActivitiesQuery
+ {
+ private readonly global::StrawberryShake.IOperationExecutor _operationExecutor;
+ private readonly global::System.Collections.Immutable.ImmutableArray> _configure = global::System.Collections.Immutable.ImmutableArray>.Empty;
+ public GetActivitiesQuery(global::StrawberryShake.IOperationExecutor operationExecutor)
+ {
+ _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor));
+ }
+
+ private GetActivitiesQuery(global::StrawberryShake.IOperationExecutor operationExecutor, global::System.Collections.Immutable.ImmutableArray> configure)
+ {
+ _operationExecutor = operationExecutor;
+ _configure = configure;
+ }
+
+ global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IGetActivitiesResult);
+
+ public global::Foo.Bar.IGetActivitiesQuery With(global::System.Action configure)
+ {
+ return new global::Foo.Bar.GetActivitiesQuery(_operationExecutor, _configure.Add(configure));
+ }
+
+ public global::Foo.Bar.IGetActivitiesQuery WithRequestUri(global::System.Uri requestUri)
+ {
+ return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.RequestUri"] = requestUri);
+ }
+
+ public global::Foo.Bar.IGetActivitiesQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient)
+ {
+ return With(r => r.ContextData["StrawberryShake.Transport.Http.HttpConnection.HttpClient"] = httpClient);
+ }
+
+ public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var request = CreateRequest();
+ foreach (var configure in _configure)
+ {
+ configure(request);
+ }
+
+ 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: GetActivitiesQueryDocument.Instance.Hash.Value, name: "GetActivities", document: GetActivitiesQueryDocument.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 GetActivities GraphQL operation
+ ///
+ /// query GetActivities {
+ /// activities {
+ /// __typename
+ /// id
+ /// activityType
+ /// name
+ /// ... on Exercise {
+ /// category
+ /// }
+ /// ... on Survey {
+ /// description
+ /// }
+ /// ... on Exercise {
+ /// id
+ /// }
+ /// ... on Survey {
+ /// id
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial interface IGetActivitiesQuery : global::StrawberryShake.IOperationRequestFactory
+ {
+ global::Foo.Bar.IGetActivitiesQuery With(global::System.Action configure);
+ global::Foo.Bar.IGetActivitiesQuery WithRequestUri(global::System.Uri requestUri);
+ global::Foo.Bar.IGetActivitiesQuery WithHttpClient(global::System.Net.Http.HttpClient httpClient);
+ 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.IGetActivitiesQuery _getActivities;
+ public FooClient(global::Foo.Bar.IGetActivitiesQuery getActivities)
+ {
+ _getActivities = getActivities ?? throw new global::System.ArgumentNullException(nameof(getActivities));
+ }
+
+ public static global::System.String ClientName => "FooClient";
+ public global::Foo.Bar.IGetActivitiesQuery GetActivities => _getActivities;
+ }
+
+ // 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.IGetActivitiesQuery GetActivities { get; }
+ }
+}
+
+namespace Foo.Bar.State
+{
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
+ public partial class ExerciseEntity
+ {
+ public ExerciseEntity(global::System.Guid id = default !, global::System.String activityType = default !, global::System.String name = default !, global::Foo.Bar.ExerciseCategory category = default !)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Category = category;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::Foo.Bar.ExerciseCategory Category { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.EntityTypeGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "0.0.0.0")]
+ public partial class SurveyEntity
+ {
+ public SurveyEntity(global::System.Guid id = default !, global::System.String activityType = default !, global::System.String name = default !, global::System.String? description = default !)
+ {
+ Id = id;
+ ActivityType = activityType;
+ Name = name;
+ Description = description;
+ }
+
+ public global::System.Guid Id { get; }
+ public global::System.String ActivityType { get; }
+ public global::System.String Name { get; }
+ public global::System.String? Description { get; }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultDataFactoryGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesResultFactory : global::StrawberryShake.IOperationResultDataFactory
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ private readonly global::StrawberryShake.IEntityMapper _getActivities_Activities_ExerciseFromExerciseEntityMapper;
+ private readonly global::StrawberryShake.IEntityMapper _getActivities_Activities_SurveyFromSurveyEntityMapper;
+ public GetActivitiesResultFactory(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityMapper getActivities_Activities_ExerciseFromExerciseEntityMapper, global::StrawberryShake.IEntityMapper getActivities_Activities_SurveyFromSurveyEntityMapper)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ _getActivities_Activities_ExerciseFromExerciseEntityMapper = getActivities_Activities_ExerciseFromExerciseEntityMapper ?? throw new global::System.ArgumentNullException(nameof(getActivities_Activities_ExerciseFromExerciseEntityMapper));
+ _getActivities_Activities_SurveyFromSurveyEntityMapper = getActivities_Activities_SurveyFromSurveyEntityMapper ?? throw new global::System.ArgumentNullException(nameof(getActivities_Activities_SurveyFromSurveyEntityMapper));
+ }
+
+ global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::Foo.Bar.IGetActivitiesResult);
+
+ public GetActivitiesResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ if (dataInfo is GetActivitiesResultInfo info)
+ {
+ return new GetActivitiesResult(MapNonNullableIGetActivities_ActivitiesNonNullableArray(info.Activities, snapshot));
+ }
+
+ throw new global::System.ArgumentException("GetActivitiesResultInfo expected.");
+ }
+
+ private global::System.Collections.Generic.IReadOnlyList MapNonNullableIGetActivities_ActivitiesNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
+ {
+ if (list is null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ var activitys = new global::System.Collections.Generic.List();
+ foreach (global::StrawberryShake.EntityId child in list)
+ {
+ activitys.Add(MapNonNullableIGetActivities_Activities(child, snapshot));
+ }
+
+ return activitys;
+ }
+
+ private global::Foo.Bar.IGetActivities_Activities MapNonNullableIGetActivities_Activities(global::StrawberryShake.EntityId entityId, global::StrawberryShake.IEntityStoreSnapshot snapshot)
+ {
+ if (entityId.Name.Equals("Exercise", global::System.StringComparison.Ordinal))
+ {
+ return _getActivities_Activities_ExerciseFromExerciseEntityMapper.Map(snapshot.GetEntity(entityId) ?? throw new global::StrawberryShake.GraphQLClientException());
+ }
+
+ if (entityId.Name.Equals("Survey", global::System.StringComparison.Ordinal))
+ {
+ return _getActivities_Activities_SurveyFromSurveyEntityMapper.Map(snapshot.GetEntity(entityId) ?? throw new global::StrawberryShake.GraphQLClientException());
+ }
+
+ throw new global::System.NotSupportedException();
+ }
+
+ 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 GetActivitiesResultInfo : global::StrawberryShake.IOperationResultDataInfo
+ {
+ private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds;
+ private readonly global::System.UInt64 _version;
+ public GetActivitiesResultInfo(global::System.Collections.Generic.IReadOnlyList activities, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version)
+ {
+ Activities = activities;
+ _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
+ _version = version;
+ }
+
+ public global::System.Collections.Generic.IReadOnlyList Activities { 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 GetActivitiesResultInfo(Activities, _entityIds, version);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.JsonResultBuilderGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivitiesBuilder : global::StrawberryShake.OperationResultBuilder
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _exerciseCategoryParser;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _uuidParser;
+ private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser;
+ public GetActivitiesBuilder(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));
+ _exerciseCategoryParser = serializerResolver.GetLeafValueParser("ExerciseCategory") ?? throw new global::System.ArgumentException("No serializer for type `ExerciseCategory` found.");
+ _uuidParser = serializerResolver.GetLeafValueParser("Uuid") ?? throw new global::System.ArgumentException("No serializer for type `Uuid` found.");
+ _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` 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 !;
+ global::System.Collections.Generic.IReadOnlyList activitiesId = default !;
+ _entityStore.Update(session =>
+ {
+ activitiesId = Update_NonNullableIGetActivities_ActivitiesEntityNonNullableArray(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activities"), entityIds);
+ snapshot = session.CurrentSnapshot;
+ });
+ return new GetActivitiesResultInfo(activitiesId, entityIds, snapshot.Version);
+ }
+
+ private global::System.Collections.Generic.IReadOnlyList Update_NonNullableIGetActivities_ActivitiesEntityNonNullableArray(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet entityIds)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ var activitys = new global::System.Collections.Generic.List();
+ foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
+ {
+ activitys.Add(Update_NonNullableIGetActivities_ActivitiesEntity(session, child, entityIds));
+ }
+
+ return activitys;
+ }
+
+ private global::StrawberryShake.EntityId Update_NonNullableIGetActivities_ActivitiesEntity(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet entityIds)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value);
+ entityIds.Add(entityId);
+ if (entityId.Name.Equals("Exercise", global::System.StringComparison.Ordinal))
+ {
+ if (session.CurrentSnapshot.TryGetEntity(entityId, out global::Foo.Bar.State.ExerciseEntity? entity))
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.ExerciseEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_NonNullableExerciseCategory(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "category"))));
+ }
+ else
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.ExerciseEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_NonNullableExerciseCategory(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "category"))));
+ }
+
+ return entityId;
+ }
+
+ if (entityId.Name.Equals("Survey", global::System.StringComparison.Ordinal))
+ {
+ if (session.CurrentSnapshot.TryGetEntity(entityId, out global::Foo.Bar.State.SurveyEntity? entity))
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.SurveyEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description"))));
+ }
+ else
+ {
+ session.SetEntity(entityId, new global::Foo.Bar.State.SurveyEntity(Deserialize_NonNullableGuid(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "activityType")), Deserialize_NonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), Deserialize_String(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description"))));
+ }
+
+ return entityId;
+ }
+
+ throw new global::System.NotSupportedException();
+ }
+
+ private global::System.Guid Deserialize_NonNullableGuid(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _uuidParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::System.String Deserialize_NonNullableString(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _stringParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::Foo.Bar.ExerciseCategory Deserialize_NonNullableExerciseCategory(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ throw new global::System.ArgumentNullException();
+ }
+
+ return _exerciseCategoryParser.Parse(obj.Value.GetString()!);
+ }
+
+ private global::System.String? Deserialize_String(global::System.Text.Json.JsonElement? obj)
+ {
+ if (!obj.HasValue)
+ {
+ return null;
+ }
+
+ if (obj.Value.ValueKind == global::System.Text.Json.JsonValueKind.Null)
+ {
+ return null;
+ }
+
+ return _stringParser.Parse(obj.Value.GetString()!);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivities_Activities_ExerciseFromExerciseEntityMapper : global::StrawberryShake.IEntityMapper
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ public GetActivities_Activities_ExerciseFromExerciseEntityMapper(global::StrawberryShake.IEntityStore entityStore)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ }
+
+ public GetActivities_Activities_Exercise Map(global::Foo.Bar.State.ExerciseEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ return new GetActivities_Activities_Exercise(entity.Id, entity.ActivityType, entity.Name, entity.Category);
+ }
+ }
+
+ // StrawberryShake.CodeGeneration.CSharp.Generators.ResultFromEntityTypeMapperGenerator
+ [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.0.0")]
+ public partial class GetActivities_Activities_SurveyFromSurveyEntityMapper : global::StrawberryShake.IEntityMapper
+ {
+ private readonly global::StrawberryShake.IEntityStore _entityStore;
+ public GetActivities_Activities_SurveyFromSurveyEntityMapper(global::StrawberryShake.IEntityStore entityStore)
+ {
+ _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
+ }
+
+ public GetActivities_Activities_Survey Map(global::Foo.Bar.State.SurveyEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
+ {
+ if (snapshot is null)
+ {
+ snapshot = _entityStore.CurrentSnapshot;
+ }
+
+ return new GetActivities_Activities_Survey(entity.Id, entity.ActivityType, entity.Name, entity.Description);
+ }
+ }
+
+ // 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
+ {
+ "Exercise" => ParseExerciseEntityId(obj, __typename),
+ "Survey" => ParseSurveyEntityId(obj, __typename),
+ _ => throw new global::System.NotSupportedException()};
+ }
+
+ public global::System.String Format(global::StrawberryShake.EntityId entityId)
+ {
+ return entityId.Name switch
+ {
+ "Exercise" => FormatExerciseEntityId(entityId),
+ "Survey" => FormatSurveyEntityId(entityId),
+ _ => throw new global::System.NotSupportedException()};
+ }
+
+ private global::StrawberryShake.EntityId ParseExerciseEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
+ {
+ return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
+ }
+
+ private global::System.String FormatExerciseEntityId(global::StrawberryShake.EntityId entityId)
+ {
+ using var writer = new global::StrawberryShake.Internal.ArrayWriter();
+ using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
+ jsonWriter.WriteStartObject();
+ jsonWriter.WriteString("__typename", entityId.Name);
+ jsonWriter.WriteString("id", (global::System.String)entityId.Value);
+ jsonWriter.WriteEndObject();
+ jsonWriter.Flush();
+ return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
+ }
+
+ private global::StrawberryShake.EntityId ParseSurveyEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
+ {
+ return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
+ }
+
+ private global::System.String FormatSurveyEntityId(global::StrawberryShake.EntityId entityId)
+ {
+ using var writer = new global::StrawberryShake.Internal.ArrayWriter();
+ using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
+ jsonWriter.WriteStartObject();
+ jsonWriter.WriteString("__typename", entityId.Name);
+ jsonWriter.WriteString("id", (global::System.String)entityId.Value);
+ jsonWriter.WriteEndObject();
+ jsonWriter.Flush();
+ return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
+ }
+ }
+
+ // 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)));
+ 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, global::Foo.Bar.State.GetActivities_Activities_ExerciseFromExerciseEntityMapper>(services);
+ global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::Foo.Bar.State.GetActivities_Activities_SurveyFromSurveyEntityMapper>(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);
+ 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, new global::StrawberryShake.Serialization.UUIDSerializer("Uuid"));
+ 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.GetActivitiesResultFactory>(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