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

使用FreeSql Cloud,Host服务停止的时候一直阻塞,要手动释放 #6

Open
lamjack opened this issue Sep 27, 2023 · 1 comment

Comments

@lamjack
Copy link

lamjack commented Sep 27, 2023

        {
            IConfiguration configuration = services.GetConfiguration();
            var freeSqlCloud = new FreeSqlCloud<string>()
            {
                DistributeTrace = Console.WriteLine
            };
            freeSqlCloud.Register(Constants.DefaultDb, () =>
                new FreeSqlBuilder()
                    .UseConnectionString(DataType.MySql, configuration.GetConnectionString(Constants.DefaultDb))
                    .Build());
            freeSqlCloud.Register(Constants.OldDb, () =>
                new FreeSqlBuilder()
                    .UseConnectionString(DataType.MySql, configuration.GetConnectionString(Constants.OldDb))
                    .Build());
            services.AddSingleton(freeSqlCloud);
            services.AddSingleton<IFreeSql>(freeSqlCloud);
            return services;
        }```
@2881099
Copy link
Owner

2881099 commented Sep 27, 2023

ioc认为是在外部new的,所以由你自己来dispose

办法:AddSingletion(() => new)

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