diff --git a/docs/configuration.md b/docs/configuration.md
index 942e8aae..e33e51b7 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -688,24 +688,24 @@ Map a [table-per-hierarchy (TPH) EF Core pattern](https://docs.microsoft.com/en-
### EF Core Entities
-
-
+
+
```cs
-public abstract class InheritedEntity
+public abstract class BaseEntity
{
public Guid Id { get; set; } = Guid.NewGuid();
public string? Property { get; set; }
public IList ChildrenFromBase { get; set; } = [];
}
```
-snippet source | anchor
+snippet source | anchor
```cs
public class DerivedEntity :
- InheritedEntity;
+ BaseEntity;
```
snippet source | anchor
@@ -713,24 +713,20 @@ public class DerivedEntity :
### GraphQL types
-
-
+
+
```cs
-public class InterfaceGraphType :
- EfInterfaceGraphType
+public class BaseGraphType :
+ EfInterfaceGraphType
{
- public InterfaceGraphType(IEfGraphQLService graphQlService) :
- base(graphQlService)
- {
- Field(_ => _.Id);
- Field(_ => _.Property, nullable: true);
+ public BaseGraphType(IEfGraphQLService graphQlService) :
+ base(graphQlService) =>
AddNavigationConnectionField(
name: "childrenFromInterface",
- includeNames: [ "ChildrenFromBase" ]);
- }
+ includeNames: ["ChildrenFromBase"]);
}
```
-snippet source | anchor
+snippet source | anchor
@@ -746,7 +742,7 @@ public class DerivedGraphType :
name: "childrenFromInterface",
_ => _.Source.ChildrenFromBase);
AutoMap();
- Interface();
+ Interface();
IsTypeOf = obj => obj is DerivedEntity;
}
}
diff --git a/docs/mdsource/configuration.source.md b/docs/mdsource/configuration.source.md
index a4559fe0..1f8f5142 100644
--- a/docs/mdsource/configuration.source.md
+++ b/docs/mdsource/configuration.source.md
@@ -194,14 +194,14 @@ Map a [table-per-hierarchy (TPH) EF Core pattern](https://docs.microsoft.com/en-
### EF Core Entities
-snippet: InheritedEntity.cs
+snippet: BaseEntity.cs
snippet: DerivedEntity.cs
### GraphQL types
-snippet: InterfaceGraphType.cs
+snippet: BaseGraphType.cs
snippet: DerivedGraphType.cs
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 7e1d793b..e9716a3e 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -2,7 +2,7 @@
CS1591;NU5104;CS1573;CS9107;NU1608;NU1109
- 32.3.1
+ 32.4.0-beta.1
preview
1.0.0
EntityFrameworkCore, EntityFramework, GraphQL
diff --git a/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs b/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs
index 2e82b3bb..877b5ca7 100644
--- a/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs
+++ b/src/GraphQL.EntityFramework/GraphApi/EfInterfaceGraphType.cs
@@ -1,9 +1,15 @@
namespace GraphQL.EntityFramework;
-public class EfInterfaceGraphType(IEfGraphQLService graphQlService) :
- InterfaceGraphType
+public class EfInterfaceGraphType(
+ IEfGraphQLService graphQlService,
+ params Expression>[]? excludedProperties) :
+ AutoRegisteringInterfaceGraphType(excludedProperties)
where TDbContext : DbContext
{
+ public EfInterfaceGraphType(IEfGraphQLService graphQlService):this(graphQlService, null)
+ {
+ }
+
public IEfGraphQLService GraphQlService { get; } = graphQlService;
public ConnectionBuilder AddNavigationConnectionField(
diff --git a/src/Tests/IntegrationTests/Graphs/Inheritance/BaseGraphType.cs b/src/Tests/IntegrationTests/Graphs/Inheritance/BaseGraphType.cs
index 1368ea63..25d82606 100644
--- a/src/Tests/IntegrationTests/Graphs/Inheritance/BaseGraphType.cs
+++ b/src/Tests/IntegrationTests/Graphs/Inheritance/BaseGraphType.cs
@@ -2,12 +2,8 @@
EfInterfaceGraphType
{
public BaseGraphType(IEfGraphQLService graphQlService) :
- base(graphQlService)
- {
- Field(_ => _.Id);
- Field(_ => _.Property, nullable: true);
+ base(graphQlService) =>
AddNavigationConnectionField(
name: "childrenFromInterface",
- includeNames: [ "ChildrenFromBase" ]);
- }
+ includeNames: ["ChildrenFromBase"]);
}
\ No newline at end of file
diff --git a/src/Tests/IntegrationTests/IntegrationTests.SchemaPrint.verified.txt b/src/Tests/IntegrationTests/IntegrationTests.SchemaPrint.verified.txt
index ea247c31..dba976c3 100644
--- a/src/Tests/IntegrationTests/IntegrationTests.SchemaPrint.verified.txt
+++ b/src/Tests/IntegrationTests/IntegrationTests.SchemaPrint.verified.txt
@@ -461,7 +461,7 @@ type BaseConnection {
"A list of all of the edges returned in the connection."
edges: [BaseEdge]
"A list of all of the objects returned in the connection. This is a convenience field provided for quickly exploring the API; rather than querying for \"{ edges { node } }\" when no edge data is needed, this field can be used instead. Note that when clients like Relay need to fetch the \"cursor\" field on the edge to enable efficient pagination, this shortcut cannot be used, and the full \"{ edges { node } } \" version should be used instead."
- items: [Base]
+ items: [BaseEntity]
}
"An edge in a connection from an object to another object of type `Base`."
@@ -469,12 +469,13 @@ type BaseEdge {
"A cursor for use in pagination"
cursor: String!
"The item at the end of the edge"
- node: Base
+ node: BaseEntity
}
-interface Base {
+interface BaseEntity {
id: ID!
property: String
+ childrenFromBase: [DerivedChild!]!
childrenFromInterface(
"Only return edges after the specified cursor."
after: String,
@@ -489,6 +490,13 @@ interface Base {
ids: [ID!]): DerivedChildConnection!
}
+type DerivedChild {
+ id: ID!
+ parentId: ID
+ property: String
+ typedParentId: ID
+}
+
"A connection from an object to a list of objects of type `DerivedChild`."
type DerivedChildConnection {
"A count of the total number of objects in this connection, ignoring pagination. This allows a client to fetch the first five objects by passing \"5\" as the argument to `first`, then fetch the total count so it could display \"5 of 83\", for example. In cases where we employ infinite scrolling or don't have an exact count of entries, this field will return `null`."
@@ -509,13 +517,6 @@ type DerivedChildEdge {
node: DerivedChild!
}
-type DerivedChild {
- id: ID!
- parentId: ID
- property: String
- typedParentId: ID
-}
-
type ManyToManyLeft {
rights(id: ID, ids: [ID!], where: [WhereExpression!], orderBy: [OrderBy!], skip: Int, take: Int): [ManyToManyRight!]!
id: String!
@@ -567,7 +568,7 @@ type Mutation {
parentEntityMutation(id: ID, ids: [ID!], where: [WhereExpression!]): Parent!
}
-type Derived implements Base {
+type Derived implements BaseEntity {
childrenFromInterface(
"Only return edges after the specified cursor."
after: String,
@@ -585,7 +586,7 @@ type Derived implements Base {
property: String
}
-type DerivedWithNavigation implements Base {
+type DerivedWithNavigation implements BaseEntity {
childrenFromInterface(
"Only return edges after the specified cursor."
after: String,