using iWareLog.ORM;
|
using iWareLog.LOG.Entity;
|
using iWareLog.LOG.Dao;
|
using iWareCommon.Common.Service;
|
using iWareCommon.Utils;
|
using iWareLog.Properties;
|
using System;
|
|
namespace iWareLog.LOG.Service
|
{
|
public class OperationService : CommonService<OperationEntity, LOGOperation, DbModelLog>
|
{
|
private static object Lock = new object();
|
|
private OperationService() : base(OperationDao.GetInstance()) { }
|
|
private static OperationService Instance = null;
|
|
/// <summary>
|
/// 获取单例的方法
|
/// </summary>
|
/// <returns>log服务的单例实体</returns>
|
public static OperationService GetInstance()
|
{
|
|
if (Instance == null)
|
{
|
lock (Lock)
|
{
|
if (Instance == null)
|
{
|
Instance = new OperationService();
|
}
|
}
|
}
|
return Instance;
|
}
|
|
/// <summary>
|
/// 写入日志
|
/// </summary>
|
/// <param name="tt_new"></param>
|
/// <returns></returns>
|
public void Save(OperationEntity dateLog)
|
{
|
try
|
{
|
using (DbModelLog ml = new DbModelLog())
|
{
|
ml.LOGOperations.Add(dateLog.ToOrm());
|
ml.SaveChanges();
|
}
|
}
|
catch (Exception ex)
|
{
|
LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "Save", ex.Message);
|
|
}
|
}
|
}
|
}
|