增加功能:增加MongoDB数据库对登录日志支持 link #IS7RM
This commit is contained in:
parent
9924d8c3c4
commit
348438896c
|
@ -116,6 +116,17 @@ namespace Bootstrap.DataAccess.MongoDB
|
|||
return DBAccess.GetCollection<BootstrapMenu>("Navigations");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static IMongoCollection<DataAccess.LoginUser> LoginUsers
|
||||
{
|
||||
get
|
||||
{
|
||||
return DBAccess.GetCollection<DataAccess.LoginUser>("LoginLogs");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static void InitDb()
|
||||
|
@ -220,6 +231,15 @@ namespace Bootstrap.DataAccess.MongoDB
|
|||
md.IdMemberMap.SetIgnoreIfDefault(true);
|
||||
});
|
||||
}
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(DataAccess.LoginUser)))
|
||||
{
|
||||
BsonClassMap.RegisterClassMap<DataAccess.LoginUser>(md =>
|
||||
{
|
||||
md.AutoMap();
|
||||
md.IdMemberMap.SetSerializer(new StringSerializer(BsonType.ObjectId));
|
||||
md.IdMemberMap.SetIgnoreIfDefault(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
namespace Bootstrap.DataAccess.MongoDB
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LoginUser : DataAccess.LoginUser
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
public override bool Log(DataAccess.LoginUser user)
|
||||
{
|
||||
DbManager.LoginUsers.InsertOne(user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue