コード例 #1
0
        private void CreateSimilarAnime(ISession session, List<Raw_AniDB_SimilarAnime> sims)
        {
            if (sims == null) return;

            AniDB_Anime_SimilarRepository repSim = new AniDB_Anime_SimilarRepository();

            List<AniDB_Anime_Similar> recsToSave = new List<AniDB_Anime_Similar>();

            foreach (Raw_AniDB_SimilarAnime rawsim in sims)
            {
                AniDB_Anime_Similar anime_sim = repSim.GetByAnimeIDAndSimilarID(session, rawsim.AnimeID, rawsim.SimilarAnimeID);
                if (anime_sim == null) anime_sim = new AniDB_Anime_Similar();

                anime_sim.Populate(rawsim);
                recsToSave.Add(anime_sim);
            }

            using (var transaction = session.BeginTransaction())
            {
                foreach (AniDB_Anime_Similar rec in recsToSave)
                    session.SaveOrUpdate(rec);

                transaction.Commit();
            }
        }
コード例 #2
0
 public List<AniDB_Anime_Similar> GetSimilarAnime(ISession session)
 {
     AniDB_Anime_SimilarRepository rep = new AniDB_Anime_SimilarRepository();
     return rep.GetByAnimeID(session, AnimeID);
 }