Это невозможно в GraphQL, однако есть экспериментальный пакет, который может быть полезен для этой цели.
https://github.com/Sydsvenskan/node-graphql-partials
См. пример:
partial LinkFields {
links(
rel: String
type: String
): [Link]
}
partial DocumentFields using LinkFields {
uuid: ID!
# The document type, such as x-im/article
type: String
# If specified, then a list of the products to which this document's availability is limited
products: [String]
# The human readable name of the document, often used publicly to identify the document
title: String
# The specific path on the web page where this document is publicly available
path: String
# A single metadata block
metaBlock(
# The specific metadata block type to get
type: String
): MetadataBlock
}
interface Document using DocumentFields {}
type AuthorDocument implements Document using DocumentFields {}
Какой приводит к:
type AuthorDocument implements Document {
links(
rel: String
type: String
): [Link]
uuid: ID!
# The document type, such as x-im/article
type: String
# If specified, then a list of the products to which this document's availability is limited
products: [String]
# The human readable name of the document, often used publicly to identify the document
title: String
# The specific path on the web page where this document is publicly available
path: String
# A single metadata block
metaBlock(
# The specific metadata block type to get
type: String
): MetadataBlock
}
То, что вы также можете сделать, поскольку это всего лишь строки, это создать некоторые вспомогательные функции, которые изменяют строку и вставляют необходимые поля.
Если вы
Запись и перехват операций с базой данных в MSDN - это то, что вы ищете.
Свойству DbContext.Database.Log
можно назначить делегату для любого метода, который принимает строку , Чаще всего он используется с любым TextWriter
, устанавливая его на метод «Write» этого TextWriter. Все SQL, сгенерированные текущим контекстом, будут записываться в этот файл. Например, следующий код будет записывать SQL на консоль:
using (var context = new BlogContext())
{
context.Database.Log = Console.Write;
// Your code here...
}
Вы можете использовать эту строку для входа в окно «Выход», а не в окне консоли, снова в режиме отладки.
public class YourContext : DbContext
{
public YourContext()
{
Database.Log = sql => Debug.Write(sql);
}
}