public void saveLacCellBvciDocumentSet(string sqlconn) { TcpDbContext context = null; try { context = new TcpDbContext(sqlconn); context.Configuration.AutoDetectChangesEnabled = false; int count = 0; LacCellBvciStaging lcb = new LacCellBvciStaging(); foreach (var cell in lcb.mongo_LacCellBvciStaging.QueryMongo()) { ++count; context = context.AddToContext(context, cell, count, bulksize, true, sqlconn); } context.SaveChanges(); } finally { if (context != null) context.Dispose(); } Console.WriteLine("LacCellBvciDocument->TcpDbContext->ok"); }
private static void BatchMakeLlcDataForMongo() { using (LacCellBvciStaging lcb = new LacCellBvciStaging()) lcb.CreatCollection(); GC.Collect(); using (LacCellBvciETL lcbs = new LacCellBvciETL()) lcbs.CreatCollection(); GC.Collect(); //using (LlcTlliSessionStaging tls = new LlcTlliSessionStaging()) // tls.CreateCollection(); //GC.Collect(); Console.WriteLine("BatchMakeLlcDataForMongo,Finish"); }
public void CreatCollection() { LacCellBvciStaging lcb = new LacCellBvciStaging(); var query = from p in lcb.mongo_LacCellBvciStaging.QueryMongo().ToList() group p by p.lac_cell into ttt select new LacCellBvciETLDocument { _id = GenerateId(), lac_ci = ttt.Key, bvci_aggre = ttt.Select(e => e.bvci.ToString()).Distinct().Aggregate((a, b) => a + "," + b), bvci_cnt = ttt.Select(e => e.bvci).Distinct().Count() }; mongo_LacCellBvciETL.BulkMongo(query.ToList(), true); Console.WriteLine("LacCellBvciETLDocument->mongo->ok"); }
public void CreateCollection() { LacCellBvciStaging lcb = new LacCellBvciStaging(); LookBvci = lcb.mongo_LacCellBvciStaging.QueryMongo() .Where(e => e.lac_cell != null) .ToLookup(e => e.bvci); for (int j = min_file_num; j < max_file_num; j++) { Console.WriteLine("file_num:{0}", j); CreateCollection(j); } Console.WriteLine("TcpPortSessionStagingDocument->mongo->ok"); }