2019-05-01 16:46:24 +08:00
|
|
|
|
using PetaPoco;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.DataAccess
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class DbManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="connectionName"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static IDatabase Create(string connectionName = null, bool keepAlive = false)
|
|
|
|
|
{
|
|
|
|
|
var db = Longbow.Data.DbManager.Create(connectionName, keepAlive);
|
|
|
|
|
db.ExceptionThrown += (sender, args) => args.Exception.Log(new NameValueCollection() { ["LastCmd"] = db.LastCommand });
|
2019-05-10 19:46:36 +08:00
|
|
|
|
return db;
|
2019-05-01 16:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|