refactor: 移除AddMaps方法

This commit is contained in:
Argo Zhang 2019-05-10 19:46:36 +08:00
parent 245162c1aa
commit 49ab346d37
9 changed files with 20 additions and 16 deletions

View File

@ -18,21 +18,7 @@ namespace Bootstrap.DataAccess
{ {
var db = Longbow.Data.DbManager.Create(connectionName, keepAlive); var db = Longbow.Data.DbManager.Create(connectionName, keepAlive);
db.ExceptionThrown += (sender, args) => args.Exception.Log(new NameValueCollection() { ["LastCmd"] = db.LastCommand }); db.ExceptionThrown += (sender, args) => args.Exception.Log(new NameValueCollection() { ["LastCmd"] = db.LastCommand });
return db.AddMaps(); return db;
}
private static IDatabase AddMaps(this IDatabase database)
{
database.AddMap<Dict>("Dicts");
database.AddMap<User>("Users", new string[] { "Checked", "Period", "NewPassword", "UserStatus" });
database.AddMap<Exceptions>("Exceptions", new string[] { "Period" });
database.AddMap<Group>("Groups", new string[] { "Checked" });
database.AddMap<Log>("Logs");
database.AddMap<Menu>("Navigations", new string[] { "ParentName", "CategoryName", "Active", "Menus" });
database.AddMap<Role>("Roles", new string[] { "Checked" });
database.AddMap<Task>("Tasks");
database.AddMap<Trace>("Traces");
return database;
} }
} }
} }

View File

@ -1,6 +1,7 @@
using Bootstrap.Security; using Bootstrap.Security;
using Bootstrap.Security.DataAccess; using Bootstrap.Security.DataAccess;
using Longbow; using Longbow;
using PetaPoco;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -10,6 +11,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Dicts")]
public class Dict : BootstrapDict public class Dict : BootstrapDict
{ {
/// <summary> /// <summary>

View File

@ -60,6 +60,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 获得/设置 时间描述 2分钟内为刚刚 /// 获得/设置 时间描述 2分钟内为刚刚
/// </summary> /// </summary>
[ResultColumn]
public string Period { get; set; } public string Period { get; set; }
/// <summary> /// <summary>

View File

@ -1,5 +1,6 @@
using Bootstrap.Security.DataAccess; using Bootstrap.Security.DataAccess;
using Longbow.Data; using Longbow.Data;
using PetaPoco;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -9,6 +10,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Groups")]
public class Group public class Group
{ {
/// <summary> /// <summary>
@ -29,6 +31,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 获取/设置 用户群组关联状态 checked 标示已经关联 '' 标示未关联 /// 获取/设置 用户群组关联状态 checked 标示已经关联 '' 标示未关联
/// </summary> /// </summary>
[ResultColumn]
public string Checked { get; set; } public string Checked { get; set; }
/// <summary> /// <summary>

View File

@ -7,6 +7,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Logs")]
public class Log : Trace public class Log : Trace
{ {
/// <summary> /// <summary>

View File

@ -1,5 +1,6 @@
using Bootstrap.Security.DataAccess; using Bootstrap.Security.DataAccess;
using Longbow.Data; using Longbow.Data;
using PetaPoco;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -9,6 +10,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Roles")]
public class Role public class Role
{ {
/// <summary> /// <summary>
@ -29,6 +31,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 获取/设置 用户角色关联状态 checked 标示已经关联 '' 标示未关联 /// 获取/设置 用户角色关联状态 checked 标示已经关联 '' 标示未关联
/// </summary> /// </summary>
[ResultColumn]
public string Checked { get; set; } public string Checked { get; set; }
/// <summary> /// <summary>

View File

@ -1,4 +1,5 @@
using System; using PetaPoco;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Bootstrap.DataAccess namespace Bootstrap.DataAccess
@ -6,6 +7,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Tasks")]
public class Task public class Task
{ {
/// <summary> /// <summary>

View File

@ -7,6 +7,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[TableName("Traces")]
public class Trace public class Trace
{ {
/// <summary> /// <summary>

View File

@ -12,6 +12,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 用户表实体类 /// 用户表实体类
/// </summary> /// </summary>
[TableName("Users")]
public class User : BootstrapUser public class User : BootstrapUser
{ {
/// <summary> /// <summary>
@ -32,6 +33,7 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 获取/设置 角色用户关联状态 checked 标示已经关联 '' 标示未关联 /// 获取/设置 角色用户关联状态 checked 标示已经关联 '' 标示未关联
/// </summary> /// </summary>
[ResultColumn]
public string Checked { get; set; } public string Checked { get; set; }
/// <summary> /// <summary>
@ -57,16 +59,19 @@ namespace Bootstrap.DataAccess
/// <summary> /// <summary>
/// 获得/设置 用户当前状态 0 表示管理员注册用户 1 表示用户注册 2 表示更改密码 3 表示更改个人皮肤 4 表示更改显示名称 5 批复新用户注册操作 /// 获得/设置 用户当前状态 0 表示管理员注册用户 1 表示用户注册 2 表示更改密码 3 表示更改个人皮肤 4 表示更改显示名称 5 批复新用户注册操作
/// </summary> /// </summary>
[ResultColumn]
public UserStates UserStatus { get; set; } public UserStates UserStatus { get; set; }
/// <summary> /// <summary>
/// 获得/设置 通知描述 2分钟内为刚刚 /// 获得/设置 通知描述 2分钟内为刚刚
/// </summary> /// </summary>
[ResultColumn]
public string Period { get; set; } public string Period { get; set; }
/// <summary> /// <summary>
/// 获得/设置 新密码 /// 获得/设置 新密码
/// </summary> /// </summary>
[ResultColumn]
public string NewPassword { get; set; } public string NewPassword { get; set; }
/// <summary> /// <summary>