BigQuery.EntityFrameworkCore extension for Microsoft.Extensions.DependencyInjection
$ dotnet add package BigQuery.EntityFrameworkCore.DependencyInjectionTo use, with an IServiceCollection instance:
services.AddBqContext<MyBqContext>(x =>
{
x.ProjectId = "your-project-id";
x.GoogleCredential = GoogleCredential.FromJson(Configuration["your_google_auth_key"]);
});
This registers:
BqContextOptionsIQueryProvider service with BigQueryProvider implBigQueryRowParserBigQueryClientFactoryIExpressionPrinter instances as transientIExecuteQuery instances as transientTable instances as scopedDataset<> instances as scopedBqContext instance as scopedTo use at runtime, add a dependency on BqContext:
public class EmployeesController {
private readonly YourBqContext _context;
public EmployeesController(YourBqContext context)
=> _context = context;
// use the _context
}