c# - Parallel.foreach kill thread process -
this code :
[threadstatic] private static webshopentities _data; public static webshopentities data { { if (_data == null) { _data = new webshopentities(); } return _data; } } parallel.foreach(list,item => { data.dp_articles.add(new dp_articles { prom_erp_partno = item.prom_erp_partno, prom_mfm_partno = item.prom_mfm_partno, prol_name = item.prol_name, mfm_short_name = item.mfm_short_name, prom_prfm_id = item.prom_prfm_id }); } data.savechanges(); });
after it's finished job cpu usage 99% , threads doesn't kill software automatically! searched enough nothing i'm found! how can solve problem ?
you using orm concurrently. not supported. can't stuff arbitrary code parallel loop.
Comments
Post a Comment