-
-
Notifications
You must be signed in to change notification settings - Fork 786
Open
Labels
Area: DataIssue is related to filtering, sorting, pagination or projectionsIssue is related to filtering, sorting, pagination or projectionsArea: ProjectionsArea: SpatialIssue is related to spatial typesIssue is related to spatial types🌶️ hot chocolate
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Product
Hot Chocolate
Describe the bug
I have enabled projection for my query and I have a MultiPoint (SpatialData) in my database
public class MyEntity
{
public Guid Id {get; set;}
[Column(TypeName="geometry (multipoint)")]
public MultiPoint MyMultiPoint { get; set;}
}
[UseProjection]
public static IQueryable<MyEntity> GetMyEntities([Service] MyDbContext dbContext) => dbContext.MyEntities;
I use an extensionType to wrap the multipoint to another type
public class GraphQLPoint
{
public double X { get; set; }
public double Y { get; set; }
}
[ExtendObjectType(typeof(MyEntity))]
public class MyEntityExtensions
{
public IEnumerable<GraphQLPoint>? NewPoint([Service] IUnitOfWork unitOfWork, [Parent] MyEntity myEntity)
{
return myEntity.MyMultiPoint.Select(v => new GraphQLPoint {X = v.Coordinate.X, Y = v.Coordinate.Y});
}
}
And I have an ObjectType
public class MyEntityObjectType : ObjectType<MyEntity>
{
protected override void Configure(IObjectTypeDescriptor<Zone> descriptor)
{
descriptor.Field(t => t.MyMultiPoint).IsProjected()
base.Configure(descriptor);
}
}
Steps to reproduce
-
If I now run a query
query {
myEntities {newPoint
{
x
}
}
}
The value at the extension method MyMultiPoint is always null, I I will get a NullReferenceException
[ExtendObjectType(typeof(MyEntity))]
public class MyEntityExtensions
{
public IEnumerable<GraphQLPoint>? NewPoint([Service] IUnitOfWork unitOfWork, [Parent] MyEntity myEntity)
{
return myEntity.**MyMultiPoint**.Select(v => new GraphQLPoint {X = v.Coordinate.X, Y = v.Coordinate.Y});
}
}
Relevant log output
No response
Additional Context?
No response
Version
13.0.5
Metadata
Metadata
Assignees
Labels
Area: DataIssue is related to filtering, sorting, pagination or projectionsIssue is related to filtering, sorting, pagination or projectionsArea: ProjectionsArea: SpatialIssue is related to spatial typesIssue is related to spatial types🌶️ hot chocolate