如何动态的连接数据库
#1271
Replies: 3 comments 1 reply
-
https://freesql.net/extra/idlebus-freesql.html#%E4%BA%8C%E3%80%81%E4%BD%BF%E7%94%A8-freesql-cloud |
Beta Was this translation helpful? Give feedback.
0 replies
-
see: https://freesql.net/extra/idlebus-freesql.html#%E4%BA%8C%E3%80%81%E4%BD%BF%E7%94%A8-freesql-cloud class FreeSqlCloud : FreeSqlCloud<string>, IFreeSql
{
}
var fsql = new FreeSqlCloud();
fsql.Register("db1", () => new FreeSqlBuilder()
.UseConnectionString(DataType.Sqlite, @"Data Source=db1.db")
.Build());
fsql.Register("db2", () => new FreeSqlBuilder()
.UseConnectionString(DataType.Sqlite, @"Data Source=db2.db")
.Build());
fsql.Register("db3", () => new FreeSqlBuilder()
.UseConnectionString(DataType.Sqlite, @"Data Source=db3.db")
.Build()); |
Beta Was this translation helpful? Give feedback.
0 replies
-
我看文档这个好像还是单例模式,还是在程序入口定义吧,一开始就定死了,我要在程序运行的时候,去根据字符串获取连接,你这个好像是先定义多个连接,然后change切换 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
如何根据动态的连接字符串,去连接数据库,而不是已经定义好的单例连接池
Beta Was this translation helpful? Give feedback.
All reactions