I have my entities defined as
public class MyEntity
{
public string Id { get; set; }
public string Name { get; set; }
}
public class MyEntityDetails: MyEntity
{
public string ExtendedField1 { get; set; }
public string ExtendedField2 { get; set; }
// ...etc
}
The entity object type looks like this
public class MyEntityObjectType : ObjectType<MyEntity>
{
protected override void Configure(IObjectTypeDescriptor<MyEntity> descriptor)
{
descriptor.Field<MyEntityDetailsResolver>(
t => t.GetDetailsAsync())
.Name("details")
.Type<NonNullType<myEntityDetailsType>>();
}
}
This exposes one 'details' field with MyEntity.
Now, I want to flatten the structure if possible, as that seems more logical. At the same time, I wish not to have to attach the resolver with multiple calls to descriptor.field
for each extended property after flattening. Is there an elegant approach for that? Is there any attribute that could be specified on the Model properties itself to specify its resolver, or, some other way?