//数据库连接
info.Connections = [new Known.ConnectionInfo
{
Name = "Default",
DatabaseType = DatabaseType.SQLite,
ProviderType = typeof(Microsoft.Data.Sqlite.SqliteFactory),
//DatabaseType = DatabaseType.Access,
//ProviderType = typeof(System.Data.OleDb.OleDbFactory),
//DatabaseType = DatabaseType.SqlServer,
//ProviderType = typeof(System.Data.SqlClient.SqlClientFactory),
//DatabaseType = DatabaseType.MySql,
//ProviderType = typeof(MySqlConnector.MySqlConnectorFactory),
//DatabaseType = DatabaseType.PgSql,
//ProviderType = typeof(Npgsql.NpgsqlFactory),
//DatabaseType = DatabaseType.DM,
//ProviderType = typeof(Dm.DmClientFactory),
ConnectionString = builder.Configuration.GetSection("ConnStringDefault").Get<string>()
},
new Known.ConnectionInfo
{
Name = "other",
DatabaseType = DatabaseType.SqlServer,
// ProviderType = typeof(Microsoft.Data.Sqlite.SqliteFactory),
//DatabaseType = DatabaseType.Access,
//ProviderType = typeof(System.Data.OleDb.OleDbFactory),
//DatabaseType = DatabaseType.SqlServer,
ProviderType = typeof(Microsoft.Data.SqlClient.SqlClientFactory),
//DatabaseType = DatabaseType.MySql,
//ProviderType = typeof(MySqlConnector.MySqlConnectorFactory),
//DatabaseType = DatabaseType.PgSql,
//ProviderType = typeof(Npgsql.NpgsqlFactory),
//DatabaseType = DatabaseType.DM,
//ProviderType = typeof(Dm.DmClientFactory),
ConnectionString = builder.Configuration.GetSection("ConnString").Get<string>()
}
];
builder.Services.AddKnownFreeSql(option =>
{
option.UseConnectionString(DataType.SqlServer, builder.Configuration.GetSection("ConnString").Get<string>())
.UseMonitorCommand(cmd => Console.WriteLine($"Sql:{cmd.CommandText}"))
.UseAutoSyncStructure(true); //自动同步实体结构到数据库,只有CRUD时才会生成表
});
默认是Default 使用 freesql ,怎么才能制定other 使用 freesql