首页 新闻 搜索 专区 学院

这段代码 频繁的报 这个错误,求大神解决

0
悬赏园豆:15 [已关闭问题] 关闭于 2016-03-19 17:32

private
readonly object _thislock = new object(); /// <summary> /// /// </summary> /// <param name="HdlLevel"></param> /// <param name="HdlPersonDep">检查人</param> /// <param name="ApprovalType"></param> /// <param name="HdlResponsibleDep"></param> /// <returns></returns> public POCO.SysMang.AplStrate GetAplStrateInHdlLevelAndHdlPersonDep(long? HdlLevel, string HdlPersonDep, long ApprovalType, long HdlResponsibleDep) { lock (_thislock) { long dengji = 0; //获得字典级别对应的关系 string LevelRl = CommonUtils.ConstObj.HdlLevelAndApprovalLevel; string[] LevelStrA = LevelRl.Split(';'); lock (LevelStrA) { foreach (string strA in LevelStrA) { if (HdlLevel != null && strA.Split(',')[0] == HdlLevel.Value.ToString()) { if (strA.Split(',').Length > 1) { bool typ = long.TryParse(strA.Split(',')[1], out dengji); if (!typ) { dengji = CommonUtils.ConstObj.ApprovalLevelC; } } } } } POCO.BaseInfo.DepMang newdep = new DepMang(); if (!string.IsNullOrEmpty(HdlPersonDep)) { string[] HdlPersonDepAll = HdlPersonDep.Split(','); lock (newdep) { if (HdlPersonDepAll.Length == 1) { if (HdlPersonDepAll[0] != null) { newdep = cmsMipBaseObjImp.Get<POCO.BaseInfo.DepMang, long>(Convert.ToInt64(HdlPersonDepAll[0])); } } if (HdlPersonDepAll.Length > 1) { //newdep = GetFunBaseDepMang(depMang); //获得部门中那个最短的部门 IList<POCO.BaseInfo.DepMang> GList = new List<POCO.BaseInfo.DepMang>(); foreach (string var in HdlPersonDepAll) { POCO.BaseInfo.DepMang one = cmsMipBaseObjImp.Get<POCO.BaseInfo.DepMang, long>(Convert.ToInt64(var)); GList.Add(one); } if (GList.Count > 0) { IList<POCO.BaseInfo.DepMang> Alist = GList.OrderByDescending(m => m.DepCode.Length).ToList(); newdep = Alist[0]; } } } lock (newdep) { if (newdep != null) { POCO.SysMang.AplStrate strates = new AplStrate(); if (newdep.EntityDepMangByTopDepId.DepLevel == 113008) { strates = FunJituanAplStrate(dengji, newdep, ApprovalType, HdlResponsibleDep); } else { strates = FunAplStrate(dengji, newdep, ApprovalType, HdlResponsibleDep); } if (strates == null) { string hql = "from AplStrate where "; if (dengji != 0) hql += "ApprovalLevel = " + dengji + " and "; if (newdep.DepLevel == CommonUtils.ConstObj.DepLevelJiTuan) { hql += "ApprovalMain=" + CommonUtils.ConstObj.ApprovalZhuTiJiTuan; } else if (newdep.DepLevel == CommonUtils.ConstObj.DepLevelKuang) { hql += "ApprovalMain=" + CommonUtils.ConstObj.ApprovalZhuTiKuang; } else { POCO.BaseInfo.DepMang topdep = cmsMipDepMangLogic.GetTopDepMang(newdep); if (topdep.DepLevel == CommonUtils.ConstObj.DepLevelJiTuan) hql += "ApprovalMain=" + CommonUtils.ConstObj.ApprovalZhuTiJiTuan; else if (topdep.DepLevel == CommonUtils.ConstObj.DepLevelKuang) hql += "ApprovalMain=" + CommonUtils.ConstObj.ApprovalZhuTiKuang; else hql += "ApprovalMain=" + CommonUtils.ConstObj.ApprovalZhuTiJiTuan; } hql += " and ApprovalType=" + ApprovalType + "and ApprovalDep is null or ApprovalDep=0"; POCO.SysMang.AplStrate aplStrate = cmsMipBaseObjImp.Find<POCO.SysMang.AplStrate>(hql, null); return aplStrate; } else { return strates; } } } } else { string hql = "from AplStrate where ApprovalType=" + ApprovalType; if (dengji != 0) { hql += " and ApprovalLevel = " + dengji + " and "; } if (HdlResponsibleDep == 0) { hql += " and ApprovalDep is null or ApprovalDep=0 "; } else { hql += " and ApprovalDep=" + HdlResponsibleDep; } POCO.SysMang.AplStrate aplStrate = cmsMipBaseObjImp.Find<POCO.SysMang.AplStrate>(hql, null); if (aplStrate == null) { string hqlA = "from AplStrate where ApprovalType=" + ApprovalType; if (dengji != 0) { hqlA += " and ApprovalLevel = " + dengji + " and "; } if (HdlResponsibleDep == 0) { hqlA += " and ApprovalDep is null or ApprovalDep=0 "; } else { POCO.BaseInfo.DepMang HdlResponsibleDepMang = cmsMipBaseObjImp.Get<POCO.BaseInfo.DepMang, long>(HdlResponsibleDep); lock (HdlResponsibleDepMang) { POCO.BaseInfo.DepMang HdlResponsibleTopDep = cmsMipDepMangLogic.GetTopDepMang(HdlResponsibleDepMang); hqlA += " and ApprovalDep=" + HdlResponsibleTopDep.Id; } } return cmsMipBaseObjImp.Find<POCO.SysMang.AplStrate>(hqlA, null); } return aplStrate; } return null; } }

 

 

这段代码  频繁的报 这个错误,求大神解决

Spring.Data.NHibernate.HibernateSystemException: could not load an entity: [HKTD.CMSMIP.POCO.BaseInfo.DepMang#1355] ---> System.IndexOutOfRangeException: 在复制内存时检测到可能的 I/O 争用条件。默认情况下,I/O 包不是线程安全的。在多线程应用程序中,必须以线程安全方式(如 TextReader 或 TextWriter 的 Synchronized 方法返回的线程安全包装)访问流。这也适用于 StreamWriter 和 StreamReader 这样的类。
   在 System.Buffer.InternalBlockCopy(Array src, Int32 srcOffsetBytes, Array dst, Int32 dstOffsetBytes, Int32 byteCount)
   在 System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
   在 System.IO.TextWriter.WriteLine(String value)
   在 System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
   在 NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
   在 NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
   在 NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   在 NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
   在 NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister)
   --- 内部异常堆栈跟踪的结尾 ---
   在 NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister)
   在 NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
   在 NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session)
   在 NHibernate.Event.Default.DefaultLoadEventListener.LoadFromDatasource(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
   在 NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
   在 NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType)
   在 NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType)
   在 NHibernate.Impl.SessionImpl.Get(String entityName, Object id)
   在 NHibernate.Impl.SessionImpl.Get(Type entityClass, Object id)
   在 NHibernate.Impl.SessionImpl.Get[T](Object id)
   在 Spring.Data.NHibernate.Generic.HibernateTemplate.Execute[T](IHibernateCallback`1 action, Boolean exposeNativeSession)
   --- 内部异常堆栈跟踪的结尾 ---
   在 Spring.Data.NHibernate.Generic.HibernateTemplate.Execute[T](IHibernateCallback`1 action, Boolean exposeNativeSession)
   在 HKTD.PL.EnityNhibrenateDao.GetFromDb[T,TPk](TPk tpk, ConfigPara cp)
   在 HKTD.PL.EnityNhibrenateDao.GetMem[T,TPk](TPk tpk)
   在 HKTD.PL.EnityNhibrenateDao.Get[T,TPk](TPk tpk)
   在 CompositionAopProxy_49085370a10d4fa28184bad8969820a7.Get[T,Tpk](Tpk id)
   在 HKTD.CMSMIP.WORKFLOW.BLL.CmsMipAplStrateLogic.GetAplStrateInHdlLevelAndHdlPersonDep(Nullable`1 HdlLevel, String HdlPersonDep, Int64 ApprovalType, Int64 HdlResponsibleDep)
   在 HKTD.CMSMIP.WORKFLOW.BLL.CmsMipWorkFlowImp.GetAplStrateInHdlLevelAndHdlPersonDep(Nullable`1 HdlLevel, String HdlPersonDep, Int64 ApprovalType, Int64 HdlResponsibleDep)
   在 HKTD.CMSMIP.UniSvc.CmsMipWorkFlowLogic.GetAplStrateInHdlLevelAndHdlPersonDep(Nullable`1 HdlLevel, String HdlPersonDep, Int64 ApprovalType, Int64 HdlResponsibleDep)
   在 HKTD.CMSMIP.UI.Areas.SafeCheck.Models.CheckHdlRecordConvert.InsertRecoTestingAplStrate(CheckHdlRecord checkHdlRecord)

这段代码  频繁的报 这个错误,求大神解决

多罗贝勒的主页 多罗贝勒 | 初学一级 | 园豆:16
提问于:2016-03-04 10:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册