Example #1
0
        public T Get(Expression <Func <T, bool> > filter, params string[] includes)
        {
            T entity = null;

            using (var uow = new Dota2UnitofWork())
            {
                entity = uow.Load <T>().Get(filter, includes);

                uow.Load <T>().ShowChangeTrackerEntriesStates();

                uow.Commit();
            }

            return(entity);
        }
Example #2
0
        public static void Save(Log log)
        {
            Task <bool> t = new Task <bool>(new Func <bool>(() =>
            {
                Thread.Sleep(2000 - DateTime.Now.Millisecond);

                //MsSqlConnection connection = new MsSqlConnection();

                //return SqlManager.ExecuteNonQuery("insert into Log (LogType,Category,Name,Description,EntityId,AddedDate,ModifiedDate,IsActive)"
                //                            + " values(@LogType,@Category,@Name,@Description,@EntityId,@AddedDate,@ModifiedDate,1)",
                //    new Dictionary<string, object>()
                //    {
                //        { "@LogType", log.LogType },
                //        { "@Category",log.Category },
                //        { "@Name", log.Name },
                //        { "@Description", log.Description.Replace("'"," ") },
                //        { "@EntityId", log.EntityId ?? (object)DBNull.Value },
                //        { "@AddedDate", DateTime.Now },
                //        { "@ModifiedDate", DateTime.Now }
                //    }) == 1;

                using (var uow = new Dota2UnitofWork())
                {
                    uow.Load <Log>().Create(log);

                    return(uow.Commit());
                }
            }));

            t.Start();
        }