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

Expose DbContext._options through public property #12225

Closed
MaceWindu opened this issue Jun 4, 2018 · 3 comments
Closed

Expose DbContext._options through public property #12225

MaceWindu opened this issue Jun 4, 2018 · 3 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@MaceWindu
Copy link

MaceWindu commented Jun 4, 2018

Created on request from @divega #11657 (comment)

linq2db integration with EF.Core needs access to DbContextOptions for specific DbContext instance or more precisely, to DbContextOptions.Extensions collection.

Current implementation uses reflection to read private field _options: https://github.com/linq2db/linq2db.EntityFrameworkCore/blob/master/Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs#L300

@ajcvickers
Copy link
Member

@MaceWindu For what reason do you need DbContextOptions? The reason I ask is because it is not intended that these options be obtained and used directly. Instead, the way to access options is from registered options extensions. For example:

var optionsExtension = context
    .GetService<IDbContextOptions>()
    .FindExtension<CoreOptionsExtension>();

@MaceWindu
Copy link
Author

I think you are right here. Will check and close this issue, if it will help

@MaceWindu
Copy link
Author

ok, we don't need it. Thank you :)

@ajcvickers ajcvickers added the closed-no-further-action The issue is closed and no further action is planned. label Jun 5, 2018
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

2 participants