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

Does .UseLazyLoadingProxies() not work in XUnitTests? #26597

Closed
bstrother1 opened this issue Nov 9, 2021 · 2 comments
Closed

Does .UseLazyLoadingProxies() not work in XUnitTests? #26597

bstrother1 opened this issue Nov 9, 2021 · 2 comments

Comments

@bstrother1
Copy link

bstrother1 commented Nov 9, 2021

Greetings,
As the header states, is this a known issue? Might be related to #15532

Example:

    class ExampleContextFactory
    {
        private DbConnection _connection;

        private DbContextOptions<ExampleContext> CreateOptions()
        {
            return new DbContextOptionsBuilder<ExampleContext>()
                .UseLazyLoadingProxies()
                .UseSqlite(_connection).Options;
        }

        public ExampleDbContext CreateContext()
        {
            if (_connection == null)
            {
                _connection = new SqliteConnection("DataSource=:memory:");
                _connection.Open();

                var options = CreateOptions();
                using (var context = new ExampleContext(options))
                {
                    context.Database.EnsureCreated();
                }
            }

            return new ExampleContext(CreateOptions());
        }

        public void Dispose()
        {
            if (_connection != null)
            {
                _connection.Dispose();
                _connection = null;
            }
        }
    }

EFCore: 3.1.14
Microsoft.EntityFrameworkCore.Proxies: 3.1.14

@ajcvickers
Copy link
Member

@bstrother1 I'm not aware of any issues here. If somethin is not working, then please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate. Also, try updating to a newer version of EF Core.

@ajcvickers
Copy link
Member

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

@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
Projects
None yet
Development

No branches or pull requests

2 participants