You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CaiQie/DB/DbFactory.cs

32 lines
613 B
C#

3 months ago
using System.Data;
using Chloe;
using Chloe.PostgreSQL;
using Npgsql;
3 months ago
using Tool;
3 months ago
3 months ago
namespace DB
3 months ago
{
3 months ago
3 months ago
public class DbFactory
3 months ago
{
3 months ago
public static IDbContext GetContext
3 months ago
{
3 months ago
get
3 months ago
{
3 months ago
PostgreSQLContext context = new PostgreSQLContext(() =>
{
IDbConnection conn = new NpgsqlConnection(RfidSetting.Current.Db); //需要自己引入数据库驱动
return conn;
});
2 months ago
context.Options.ConvertToLowercase = true;
3 months ago
return context;
}
3 months ago
}
3 months ago
3 months ago
}
3 months ago
}