Exemplo n.º 1
0
 public void Update(WmsContext db, List <Permission> opList, List <ButtonPermission> btnList)
 {
     using (TransactionScope ts = new TransactionScope())
     {
         // 让使用typeof(T).Name标签的所有缓存过期
         QueryCacheManager.ExpireTag(nameof(Permission));
         QueryCacheManager.ExpireTag(nameof(ButtonPermission));
         db.Set <Permission>().BulkUpdate(opList);
         db.Set <ButtonPermission>().BulkUpdate(btnList);
         ts.Complete();
     }
 }
Exemplo n.º 2
0
 public void Insert(WmsContext db, UsersInfo obj, List <Permission> pList, List <ButtonPermission> btnList)
 {
     using (TransactionScope ts = new TransactionScope())
     {
         // 让使用typeof(T).Name标签的所有缓存过期
         QueryCacheManager.ExpireTag(nameof(UsersInfo));
         QueryCacheManager.ExpireTag(nameof(Permission));
         QueryCacheManager.ExpireTag(nameof(ButtonPermission));
         db.Configuration.ValidateOnSaveEnabled = false;
         BaseDAL baseDAL = DALFty.Create <BaseDAL>();
         db.Set <UsersInfo>().Add(obj);
         db.SaveChanges();
         if (pList.Count > 0)
         {
             baseDAL.AddByBulkCopy <Permission>(db, pList);
         }
         if (btnList.Count > 0)
         {
             baseDAL.AddByBulkCopy <ButtonPermission>(db, btnList);
         }
         db.Configuration.ValidateOnSaveEnabled = true;
         ts.Complete();
     }
 }