Пример #1
0
        /// <summary>
        /// 插入一组Album对象
        /// </summary>
        /// <param name="albums"></param>
        /// <returns></returns>
        public bool Insert(IEnumerable <Album> albums)
        {
            var paras = from album in albums
                        select new SQLiteParameter[] {
                new SQLiteParameter("@XId", album.XId),
                new SQLiteParameter("@Title", album.Title),
                new SQLiteParameter("@Subtitle", album.Subtitle),
                new SQLiteParameter("@ImagePath", album.ImagePath),
                new SQLiteParameter("@Rating", album.Rating),
                new SQLiteParameter("@XArtistId", album.XArtistId),
                new SQLiteParameter("@Language", album.Language),
                new SQLiteParameter("@Publisher", album.Publisher),
                new SQLiteParameter("@PublishDate", album.PublishDate),
                new SQLiteParameter("@MediaType", album.MediaType),
                new SQLiteParameter("@Genre", album.Genre),
                new SQLiteParameter("@ListenCount", album.ListenCount),
                new SQLiteParameter("@ShareCount", album.ShareCount),
                new SQLiteParameter("@CommentCount", album.CommentCount),
                new SQLiteParameter("@LikeCount", album.LikeCount),
                new SQLiteParameter("@DiscCount", album.DiscCount),
                new SQLiteParameter("@Introduction", album.Introduction),
                new SQLiteParameter("@LastUpdate", album.LastUpdate)
            };
            var result = db.ExecuteNonQueryRange(REPLACE_ALBUM, paras);

            return(albums.Count() == result);
        }