我需要使用petapoco创建DAL和存储库.出现的困难是,我不知道它如何管理它的连接.
如果我使用的是dapper,我知道连接过程是如何流动的,因为我控制它.我不知道用petapoco创建DAL的最佳做法是什么.
public class UserRepository
{
public IEnumerable<User> All()
{
var db = new PetaPoco.Database("Sqlite_Connection");//this line
var s = db.Query<User>("SELECT * FROM Users");
return s.ToList();
}
}
Run Code Online (Sandbox Code Playgroud)
我想将var db = new PetaPoco.Database("Sqlite_Connection");//this line
我的DALHelper类作为静态属性放置,但我担心可伸缩性
petapoco ×1