-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Data.Common; | ||
|
||
namespace cmstar.Data | ||
{ | ||
using System.Data.SqlClient; | ||
using MySql.Data.MySqlClient; | ||
|
||
public static class Db | ||
{ | ||
public static IDbClient Northwind | ||
=> new DbClient("server=.;database=Northwind;trusted_connection=true;", SqlClientFactory.Instance); | ||
|
||
public static IDbClient MysqlDb | ||
=> new DbClient("server=127.0.0.1;uid=test;pwd=123456;database=test", MySqlClientFactory.Instance); | ||
} | ||
|
||
|
||
public class FixedMySqlClientFactory : DbProviderFactoryWrapper | ||
{ | ||
public static readonly FixedMySqlClientFactory Instance = new FixedMySqlClientFactory(); | ||
|
||
private FixedMySqlClientFactory() : base(MySqlClientFactory.Instance) { } | ||
|
||
public override DbDataAdapter CreateDataAdapter() | ||
{ | ||
return base.CreateDataAdapter() ?? new MySqlDataAdapter(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters