Exemplo n.º 1
0
        public bool TruncateListRaw(List <RAW> listRaw)
        {
            bool result = false;

            try
            {
                if (IsNotNullOrEmpty(listRaw))
                {
                    using (var ctx = new AppContext())
                    {
                        System.Data.Entity.DbSet dbSet = ctx.GetDbSet <RAW>();
                        foreach (var raw in listRaw)
                        {
                            dbSet.Attach(raw);
                            dbSet.Remove(raw);
                        }
                        ctx.SaveChanges();
                        result = true;
                    }
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                Logging(LogUtil.TraceDbException(ex), LogType.Error);
                Logging(DungLH.Util.CommonLogging.LogUtil.TraceData("listRaw", listRaw), LogType.Error);
                LogSystem.Error(ex);
                result = false;
            }
            catch (Exception ex)
            {
                Logging(DungLH.Util.CommonLogging.LogUtil.TraceData("listRaw", listRaw), LogType.Error);
                LogSystem.Error(ex);
                result = false;
            }

            return(result);
        }
Exemplo n.º 2
0
 public DatenKontrolle(JgModelContainer Db)
 {
     _Db     = Db;
     _Entity = _Db.Set <T>();
 }