Exemple #1
0
 public void Add(T entity)
 {
     using (RadioContext context = new RadioContext())
     {
         context.GetTable <T>().InsertOnSubmit(entity);
         context.SubmitChanges();
     }
 }
Exemple #2
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();
                }
            }
        }