コード例 #1
0
 public DbContextParameterExpressionBuilder(DbContextKind kind)
 {
     _kind = kind switch
     {
         DbContextKind.Pooled => ServiceKind.Pooled,
         DbContextKind.Resolver => ServiceKind.Resolver,
         _ => ServiceKind.Synchronized
     };
 }
コード例 #2
0
 /// <summary>
 /// Registers a well-known <see cref="DbContext"/> with the resolver compiler.
 /// The <see cref="DbContext"/> does no longer need any annotation in the resolver.
 /// </summary>
 /// <param name="builder">
 /// The <see cref="IRequestExecutorBuilder"/>.
 /// </param>
 /// <param name="kind">
 /// The <see cref="DbContext"/> kind defines the way a <see cref="DbContext"/> is injected
 /// and handled by the execution engine.
 /// </param>
 /// <typeparam name="TDbContext">
 /// The <see cref="DbContext"/> type.
 /// </typeparam>
 /// <returns>
 /// An <see cref="IRequestExecutorBuilder"/> that can be used to configure a schema
 /// and its execution.
 /// </returns>
 public static IRequestExecutorBuilder RegisterDbContext <TDbContext>(
     this IRequestExecutorBuilder builder,
     DbContextKind kind = DbContextKind.Synchronized)
     where TDbContext : DbContext
 {
     builder.Services.AddSingleton <IParameterExpressionBuilder>(
         new DbContextParameterExpressionBuilder <TDbContext>(kind));
     return(builder);
 }