修改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>
public override bool Log(Exception ex, NameValueCollection additionalInfo)
{
var excep = new Exceptions();
excep.Id = null;
excep.AppDomainName = AppDomain.CurrentDomain.FriendlyName;
excep.ErrorPage = additionalInfo?["ErrorPage"];
excep.ExceptionType = ex.GetType().FullName;
excep.LogTime = DateTime.Now;
excep.Message = ex.Message;
excep.StackTrace = ex.StackTrace;
excep.UserId = additionalInfo?["UserId"];
excep.UserIp = additionalInfo?["UserIp"];
var excep = new DataAccess.Exceptions
{
Id = null,
AppDomainName = AppDomain.CurrentDomain.FriendlyName,
ErrorPage = additionalInfo?["ErrorPage"],
ExceptionType = ex.GetType().FullName,
LogTime = DateTime.Now,
Message = ex.Message,
StackTrace = ex.StackTrace,
UserId = additionalInfo?["UserId"],
UserIp = additionalInfo?["UserIp"]
};
MongoDbAccessManager.Exceptions.InsertOne(excep);
ClearExceptions();
return true;

View File

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