Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use secrets.json #55

Closed
tschennie opened this issue Dec 20, 2022 · 1 comment
Closed

Use secrets.json #55

tschennie opened this issue Dec 20, 2022 · 1 comment

Comments

@tschennie
Copy link

For our integration tests, we created a DbContext like this:

DbContextOptions<TestDbContext>? options = this.CreateUniqueMethodOptions<TestDbContext>();
await using TestDbContext dbContext = new(options);

How is it possible to use the connection string from the secrets.json?

@JonPSmith
Copy link
Owner

Hi @tschennie,

The CreateUniqueMethodOptions<TContext> and other similar use the normal .NET access the project's configuration. This means if you Enable secret storage on the your test project, then you can set up a secret that overrides the appsettings.json version.

The connection strings names can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants