修改BUG:Exceptions保存时更改为DataAccess.Exceptions,Period字段不进行保存

This commit is contained in:
Argo-MacBookPro 2018-10-31 21:29:42 +08:00
parent dfe6841f2f
commit af1af907a8
2 changed files with 13 additions and 10 deletions

View File

@ -35,16 +35,18 @@ namespace Bootstrap.DataAccess.MongoDB
/// <returns></returns> /// <returns></returns>
public override bool Log(Exception ex, NameValueCollection additionalInfo) public override bool Log(Exception ex, NameValueCollection additionalInfo)
{ {
var excep = new Exceptions(); var excep = new DataAccess.Exceptions
excep.Id = null; {
excep.AppDomainName = AppDomain.CurrentDomain.FriendlyName; Id = null,
excep.ErrorPage = additionalInfo?["ErrorPage"]; AppDomainName = AppDomain.CurrentDomain.FriendlyName,
excep.ExceptionType = ex.GetType().FullName; ErrorPage = additionalInfo?["ErrorPage"],
excep.LogTime = DateTime.Now; ExceptionType = ex.GetType().FullName,
excep.Message = ex.Message; LogTime = DateTime.Now,
excep.StackTrace = ex.StackTrace; Message = ex.Message,
excep.UserId = additionalInfo?["UserId"]; StackTrace = ex.StackTrace,
excep.UserIp = additionalInfo?["UserIp"]; UserId = additionalInfo?["UserId"],
UserIp = additionalInfo?["UserIp"]
};
MongoDbAccessManager.Exceptions.InsertOne(excep); MongoDbAccessManager.Exceptions.InsertOne(excep);
ClearExceptions(); ClearExceptions();
return true; return true;

View File

@ -206,6 +206,7 @@ namespace Bootstrap.DataAccess.MongoDB
md.AutoMap(); md.AutoMap();
md.IdMemberMap.SetSerializer(new StringSerializer(BsonType.ObjectId)); md.IdMemberMap.SetSerializer(new StringSerializer(BsonType.ObjectId));
md.IdMemberMap.SetIgnoreIfDefault(true); md.IdMemberMap.SetIgnoreIfDefault(true);
md.UnmapMember(ex => ex.Period);
}); });
} }
if (!BsonClassMap.IsClassMapRegistered(typeof(DataAccess.Log))) if (!BsonClassMap.IsClassMapRegistered(typeof(DataAccess.Log)))