public Task <IReadOnlyList <Environment> > GetEnvironmentsByIdAsync( [GraphQLType(typeof(NonNullType <ListType <NonNullType <IdType> > >))] string[] ids, [Service] IIdSerializer idSerializer, [DataLoader] EnvironmentByIdDataLoader dataLoader, CancellationToken cancellationToken) { if (ids.Length == 0) { throw new GraphQLException("No ids where provided."); } var deserializedIds = new Guid[ids.Length]; for (int i = 0; i < ids.Length; i++) { IdValue deserializedId = idSerializer.Deserialize(ids[i]); if (!deserializedId.TypeName.Equals(nameof(Environment), StringComparison.Ordinal)) { throw new GraphQLException("The specified id type is invalid."); } deserializedIds[i] = (Guid)deserializedId.Value; } return(dataLoader.LoadAsync(deserializedIds, cancellationToken)); }
public Task <Environment> GetEnvironmentByIdAsync( [GraphQLType(typeof(NonNullType <IdType>))] string id, [Service] IIdSerializer idSerializer, [DataLoader] EnvironmentByIdDataLoader dataLoader, CancellationToken cancellationToken) { IdValue deserializedId = idSerializer.Deserialize(id); if (!deserializedId.TypeName.Equals(nameof(Environment), StringComparison.Ordinal)) { throw new GraphQLException("The specified id type is invalid."); } return(dataLoader.LoadAsync((Guid)deserializedId.Value, cancellationToken)); }