Esempio n. 1
0
        public void DeleteAll(Expression <Func <T, bool> > predicate)
        {
            using (RadioContext context = new RadioContext())
            {
                var entitys = context.GetTable <T>().Where(predicate).ToList();

                if (entitys != null && entitys.Count > 0)
                {
                    context.GetTable <T>().DeleteAllOnSubmit(entitys);
                    context.SubmitChanges();
                }
            }
        }
Esempio n. 2
0
 public T Find(Expression <Func <T, bool> > predicate)
 {
     using (RadioContext context = new RadioContext())
     {
         return(context.GetTable <T>().FirstOrDefault(predicate));
     }
 }
Esempio n. 3
0
 public List <T> FindAll(Expression <Func <T, bool> > predicate)
 {
     using (RadioContext context = new RadioContext())
     {
         return(context.GetTable <T>().Where(predicate).ToList());
     }
 }
Esempio n. 4
0
 public void Add(T entity)
 {
     using (RadioContext context = new RadioContext())
     {
         context.GetTable <T>().InsertOnSubmit(entity);
         context.SubmitChanges();
     }
 }