Пример #1
0
        /// <summary>
        /// Polyfill to account for the fact that EF Extensions BulkIndex only
        /// works with SQLite and SQL Server.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="collection"></param>
        /// <param name="itemsToDelete"></param>
        /// <returns></returns>
        public bool BulkDelete <T>(BaseDBModel db, DbSet <T> collection, List <T> itemsToDelete) where T : class
        {
            collection.RemoveRange(itemsToDelete);

            int ret = db.SaveChanges("BulkSave");

            return(ret == itemsToDelete.Count);
        }
Пример #2
0
        /// <summary>
        /// Polyfill to account for the fact that EF Extensions BulkIndex only
        /// works with SQLite and SQL Server.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="collection"></param>
        /// <param name="itemsToSave"></param>
        /// <returns></returns>
        public bool BulkInsert <T>(BaseDBModel db, DbSet <T> collection, List <T> itemsToSave) where T : class
        {
            collection.AddRange(itemsToSave);

            int ret = db.SaveChanges("BulkSave");

            return(ret == itemsToSave.Count);
        }