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