public static void BatchInsert(TagViewModel tag, IEnumerable <ImageViewModel> images) { if (images == null || images.Count() == 0) { s_logger.Warn("No images set."); return; } using (var dataOpUnit = new DataOperationUnit()) { dataOpUnit.Open(ConnectionManager.DefaultConnection); ImageTagDao dao = new ImageTagDao(); Queue <List <ImageViewModel> > processPool = Split(images); foreach (var process in processPool) { try { dao.BatchInsert(tag.ToEntity(), process.Select(i => i.ToEntity()), dataOpUnit.CurrentConnection); } catch (Exception e) { s_logger.Error(e); } } } }
private void ImportTag(ILibrary libManager, TagViewModel add) { TagDao tagDao = new TagDao(); tagDao.Insert(add.ToEntity(), _dataOpUnit.CurrentConnection); libManager.TagManager.Tags.Add(add); }
public static void Insert(TagViewModel target) { TagDao dao = new TagDao(); dao.Insert(target.ToEntity()); s_logger.Debug($"INSERT Tag:{target}"); }
public static void Update(TagViewModel target) { TagDao dao = new TagDao(); dao.Update(target.ToEntity()); }