public override void Init(ConcentratorDataContext context) { base.Init(context); context.ExecuteStoreCommand(_attributeGroupTableCreate); context.ExecuteStoreCommand(_attributeTableCreate); DownloadFile(url, LocalCacheLocation + ".gz"); BasicUnzip.Unzip(LocalCacheLocation + ".gz", LocalCacheLocation); using (var file = File.OpenRead(LocalCacheLocation)) { var reader = new XmlTextReader(file); var aR = new AttributeGroupReader(); aR.Load(reader); BulkLoad(AttributeGroupMetaTable, 1000, aR); } using (var file = File.OpenRead(LocalCacheLocation)) { var reader = new XmlTextReader(file); var aR = new AttributeReader(); aR.Load(reader); BulkLoad(AttributeMetaTable, 10000, aR); } // Deletes all attributes we do not have values for context.ExecuteStoreCommand(String.Format(@"DELETE A FROM {0} A WHERE ( SELECT COUNT(*) FROM {1} S WHERE S.CatFeatureID = A.CatFeatureID ) <= 0", AttributeMetaTable, ProductBulk.ProductSpecTable)); // Delete all attributegroups for which we do not have attributes context.ExecuteStoreCommand(String.Format(@"DELETE G FROM {0} G WHERE G.GroupID NOT IN ( SELECT S.CatGroupID FROM {1} S )", AttributeGroupMetaTable, AttributeMetaTable)); }