public void TruncateCompositeLTHoldings() { try { _dumper.Write("TRUNCATE TABLE [GF_COMPOSITE_LTHOLDINGS] ... "); var db = new AIMS_MainEntities(); ObjectContext objCtx = ((IObjectContextAdapter)db).ObjectContext; objCtx.ExecuteStoreCommand("TRUNCATE TABLE [GF_COMPOSITE_LTHOLDINGS]"); _dumper.WriteLine(" truncated.", true); } catch (Exception ex) { LogException(ex); } }
private AIMS_MainEntities AddToContext(AIMS_MainEntities context, GF_COMPOSITE_LTHOLDINGS entity, int count, int commitCount, bool recreateContext) { context.Set <GF_COMPOSITE_LTHOLDINGS>().Add(entity); if (count % commitCount == 0) { _dumper.Write(string.Format("{0},", count.ToString(CultureInfo.InvariantCulture))); context.SaveChanges(); if (recreateContext) { context.Dispose(); context = new AIMS_MainEntities(); context.Configuration.AutoDetectChangesEnabled = false; } } return(context); }