public TcpDbContext AddToContext(TcpDbContext context, LacCellBvciStagingDocument entity, int count, int commitCount, bool recreateContext, string sqlconn)
 {
     context.Set<LacCellBvciStagingDocument>().Add(entity);
     return AddToContextCon(context, count, commitCount, recreateContext, sqlconn);
 }
        public void CreatCollection()
        {
            foshan_llc_dataEntities gb = new foshan_llc_dataEntities();
            //GuangZhou_Gb_LLC_ReTransmission gb = new GuangZhou_Gb_LLC_ReTransmission();
            //GuangZhou_Gb_TCP_ReTransmission gb = new GuangZhou_Gb_TCP_ReTransmission();
            gb.CommandTimeout = 0;
            gb.ContextOptions.LazyLoadingEnabled = true;
            gb.Gb_LLC_ReTransmission.MergeOption = MergeOption.NoTracking;

            var fc = from p in gb.Gb_LLC_ReTransmission
                     group p by new
                     {
                         p.bssgp_lac,
                         p.bssgp_ci,
                         p.nsip_bvci,
                         p.ip_src_host,
                         p.ip_dst_host,
                     } into ttt
                     select new
                     {
                         ttt.Key.bssgp_lac,
                         ttt.Key.bssgp_ci,
                         ttt.Key.nsip_bvci,
                         ttt.Key.ip_src_host,
                         ttt.Key.ip_dst_host,
                         cnt = ttt.Count(),
                         //msg = ttt.Select(e => e.LLC_MsgType).FirstOrDefault(),//.First(),
                         //callid = ttt.Select(e => e.BeginFrameNum).FirstOrDefault(),//.Distinct().First(),
                         /*
                         //http://stackoverflow.com/questions/1066760/problem-with-converting-int-to-string-in-linq-to-entities
                         callid = ttt.Select(e => SqlFunctions.StringConvert((double)e.BeginFileNum.Value).Trim()
                             + "-" + SqlFunctions.StringConvert((double)e.BeginFrameNum.Value).Trim()).Distinct()
                          * */

                     };

            foreach (var p in fc)
            {
                LacCellBvciStagingDocument lcbd = new LacCellBvciStagingDocument();
                lcbd._id = GenerateId();
                if (p.bssgp_lac != null)
                    lcbd.lac = p.bssgp_lac.ToString();
                if (p.bssgp_lac != null && p.bssgp_ci != null)
                    lcbd.lac_cell = p.bssgp_lac.ToString() + "-" + p.bssgp_ci.ToString();
                lcbd.src = p.ip_src_host;
                lcbd.dst = p.ip_dst_host;
                lcbd.bvci = p.nsip_bvci;
                lcbd.cnt = p.cnt;
                //lcbd.msg = p.msg;
                //if (p.callid != null)
                //    lcbd.callid = p.callid.Value.ToString();

                mongo_LacCellBvciStaging.MongoCol.Insert(lcbd);
            }

            //mongo_lac_cell_bvci.BulkMongo(bv.ToList(), true);

            Console.WriteLine("LacCellBvciStagingDocument->mongo->ok");

            //BulkMongo(bv.ToList());
        }