Пример #1
0
 /// <summary>
 /// Adds the ability for this graphql server to raise subscription events as well
 /// as creates a subscription server that can accept connected clients and respond to subscription events. This extension will attempt to inject subscription related
 /// middleware into the primary query excution pipeline and replace it. Call this method before injecting or
 /// adding your own query execution middleware items.
 /// </summary>
 /// <typeparam name="TSchema">The type of the schema being built.</typeparam>
 /// <param name="schemaBuilder">The schema builder.</param>
 /// <param name="options">An action function to configure the subscription options.</param>
 /// <returns>ISchemaBuilder&lt;TSchema&gt;.</returns>
 public static ISchemaBuilder <TSchema> AddSubscriptions <TSchema>(
     this ISchemaBuilder <TSchema> schemaBuilder,
     Action <SubscriptionServerOptions <TSchema> > options = null)
     where TSchema : class, ISchema
 {
     // publsihing is registered AFTER the subscription server
     // because subscription server rebuilds the query execution pipeline
     // then publishing adds one additional middleware component
     return(schemaBuilder
            .AddSubscriptionServer(options)
            .AddSubscriptionPublishing());
 }