using PetaPoco; using System; using System.Collections.Specialized; namespace Bootstrap.DataAccess { /// /// /// public static class DbManager { /// /// /// /// /// 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 }); return db.AddMaps(); } private static IDatabase AddMaps(this IDatabase database) { database.AddMap("Dicts"); database.AddMap("Users", new string[] { "Checked", "Period", "NewPassword", "UserStatus" }); database.AddMap("Exceptions", new string[] { "Period" }); database.AddMap("Groups", new string[] { "Checked" }); database.AddMap("Logs"); database.AddMap("Navigations", new string[] { "ParentName", "CategoryName", "Active", "Menus" }); database.AddMap("Roles", new string[] { "Checked" }); database.AddMap("Tasks"); database.AddMap("Traces"); return database; } } }