using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bowin.Common.Linq.Entity; using EMIS.Entities.Log; using System.Data.SqlClient; using System.Data; using System.Data.Entity; using System.Data.Entity.Validation; using System.Diagnostics; using System.Data.Entity.Core.Objects; using System.Data.Entity.Core.Metadata.Edm; using System.Data.Entity.Infrastructure; using System.Linq.Expressions; using System.Reflection; using System.Threading; using Bowin.Common.Linq; namespace EMIS.DataLogic { public class LogUnitOfWork : EMISNewLogContext, IDisposable { public LogUnitOfWork() : base("EMISNewLogContext") { } void IDisposable.Dispose() { Dispose(); } private static void WriteLogsThreading(object logList) { if (logList is IList) { try { (logList as List).ExecuteBulkCopy("EMISNewLogContext", "Log_Operate"); } catch (Exception ex) { throw ex; } } } public static void WriteLogs(IList logList) { Thread logThread = new Thread(WriteLogsThreading); logThread.Start(logList); } public void RemoveLogs(IList operateLogIDList) { this.Delete(x => operateLogIDList.Contains(x.OperateID)); } } }