Ejemplo n.º 1
0
        private static void CopyCommonBlobsToLocal(string politicianKey)
        {
            PoliticiansImagesBlobsTable table = null;

            try
            {
                table = PoliticiansImagesBlobs.GetCacheDataByPoliticianKey(politicianKey);
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch {}
            // suppress errors on Insert because a parallel thread may have already
            // copied the row into the local database
            try
            {
                if (table != null && table.Count == 1)
                {
                    var row = table[0];
                    DB.VoteImagesLocal.PoliticiansImagesBlobs.Upsert(politicianKey, null,
                                                                     row.Profile300, row.Profile200, row.Headshot100, row.Headshot75,
                                                                     row.Headshot50, row.Headshot35, row.Headshot25, row.Headshot20,
                                                                     row.Headshot15);
                }
                else if (table != null && table.Count == 0) // negative caching
                {
                    DB.VoteImagesLocal.PoliticiansImagesBlobs.Upsert(politicianKey, null, null,
                                                                     null, null, null, null, null, null, null, null);
                }
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch {}
        }