We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
采用这种方式进行数据库操作: 每次CRUD都会创建1个新的数据库链接 然后不能释放 一会儿就好几百个数据库链接了 改怎么改造呢? public class DbContextFactory { public static DbContext GetDb(string connString) { DbConnection connection = new SqlConnection(connString); if (connection.State != System.Data.ConnectionState.Open) connection.Open(); DbContext dbContext = DbContext.Init(connection, 60); return dbContext; } public static DbContext Default { get { return GetDb(Config.connString); } } }
The text was updated successfully, but these errors were encountered:
Sorry can't understand Chinese language, based on google translate you would like to now how to dispose the connection, its just by execute
DbContext.Dispose();
when the process complete.
Sorry, something went wrong.
No branches or pull requests
采用这种方式进行数据库操作:
每次CRUD都会创建1个新的数据库链接 然后不能释放 一会儿就好几百个数据库链接了
改怎么改造呢?
public class DbContextFactory
{
public static DbContext GetDb(string connString)
{
DbConnection connection = new SqlConnection(connString);
if (connection.State != System.Data.ConnectionState.Open)
connection.Open();
DbContext dbContext = DbContext.Init(connection, 60);
return dbContext;
}
public static DbContext Default
{
get { return GetDb(Config.connString); }
}
}
The text was updated successfully, but these errors were encountered: