Example #1
0
        internal void Insert()
        {
            InitializeHashes();

            InsertAudioChannels();
            InsertAudioContents();
            InsertAudioFormats();
            InsertCaseTypes();
            InsertCastAndCrew();
            InsertCollectionTypes();
            InsertCountriesOfOrigin();
            InsertCreditTypes();
            InsertCreditSubtypes();
            InsertDVDIdTypes();
            InsertEventTypes();
            InsertGenres();
            InsertLinkCategories();
            InsertLocalities();
            InsertMediaTypes();
            InsertPlugins();
            InsertPurchasePlace();
            InsertStudiosAndMediaCompanies();
            InsertSubtitles();
            InsertTags();
            InsertUsers();
            InsertVideoStandards();

            _context.ChangeTracker.DetectChanges();
            _context.SaveChanges();
        }
Example #2
0
        internal void Insert(IEnumerable <Profiler.DVD> profiles)
        {
            if (profiles == null)
            {
                return;
            }

            var valid = profiles.Where(IsNotNull).Where(dvd => !string.IsNullOrEmpty(dvd.ID)).ToList();

            _maxProgress = valid.Count;

            ReportStart();

            var counter = 0;

            foreach (var profile in valid)
            {
                Insert(profile);

                if (((++counter) % 100) == 0)
                {
                    _context.ChangeTracker.DetectChanges();
                    _context.SaveChanges();
                }
            }

            _context.ChangeTracker.DetectChanges();
            _context.SaveChanges();

            _currentDVDEntity = null;

            foreach (var profile in valid)
            {
                InsertBoxSetChildren(profile);
            }

            _context.ChangeTracker.DetectChanges();
            _context.SaveChanges();

            ReportFinish();
        }