Exemple #1
0
        static void Main(string[] args)
        {
            Logrila.Logging.NLogIntegration.NLogLogger.Use();
            Logrila.Logging.ILog _log = Logger.Get <Program>();

            _log.Warn("测试!");

            var db = DBContextFactory.Instance.CreateContext("IRAPContext");

            IRAPParameterEntity p = new IRAPParameterEntity()
            {
                PartitioningKey   = 0, ParameterID = 1
                , ParameterNameID = 1, ParameterValue = 12, ParameterValueStr = "test", TimeUpdated = DateTime.Now, UpdatedBy = "admin"
            };

            //db.Set<IRAPParameterEntity>().Attach(p);
            db.Entry(p).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            // var list= db.Set<ETreeBizClass>().Where(c => c.LeafID == 2361480).ToList();

            //  IRAPTreeModelSet treemodelSet = new IRAPTreeModelSet();
            //  treemodelSet.CreateATree(206, "保养周期目录树", 1000, 5, true, 2, "", "", 1, "", "", true, false, false, false, 1);

            //throw new Exception("Error!");

            //  var list2 = from a in list group a by a.LeafID into g select new { g.Key,items=g };


            //foreach (var r in list)
            //{
            //    Console.WriteLine("{0} {1}", r.TreeID,r.Leaf01);
            //}
            Console.WriteLine("saved.");
            Console.ReadKey();
        }
Exemple #2
0
        /// <summary>
        /// 通过NLog写本地文件日志
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="msg"></param>
        /// <param name="logType"></param>
        public void WriteMsg <T>(LogType logType, string msg) where T : class
        {
            Logrila.Logging.ILog _log = Logger.Get <T>();
            switch (logType)
            {
            case LogType.DEBUG:
                _log.Debug(msg);
                break;

            case LogType.ERROR:
                _log.Error(msg);
                break;

            case LogType.WARN:
                _log.Warn(msg);
                break;

            case LogType.INFO:
                _log.Info(msg);
                break;

            case LogType.FATAL:
                _log.Fatal(msg);
                break;

            default:
                _log.Info(msg);
                break;
            }
        }