/// <summary> /// 插入日志 /// </summary> /// <param name="model">日志模型</param> /// <returns></returns> public string InsertLog(ZFTLogModel model) { byte[] by = new byte[Request.InputStream.Length]; Request.InputStream.Read(by, 0, by.Length); string a = System.Text.Encoding.UTF8.GetString(by); ZFTLogModel insert = Newtonsoft.Json.JsonConvert.DeserializeObject<ZFTLogModel>(a); var Dao = new MongoDBHelper<GeepLogSystem.Models.ZFTLogModel>(); var result = Dao.InsterOneAsync(insert); return null; }
public string inserttest(int num) { var Dao = new MongoDBHelper<GeepLogSystem.Models.ZFTLogModel>(); System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start(); for (int i = 1; i <= num; i++) { var model = new ZFTLogModel(); model.IsErrorLog = false; model.LogName = LogNameEnum.ZFT; model.AccNo = i.ToString(); model.Time = DateTime.Now; var result = Dao.InsterOneAsync(model); } watch.Stop(); return watch.Elapsed.ToStr(); }