Пример #1
0
        public static DataAccessHelp Create(string sqlMapConfig)
        {
            try
            {
                ISqlMapper mapper = Mapper.Instance(sqlMapConfig);
                if (mapper != null)
                {
                    //START - Add by Robin 2013/07/10 for Version Bulk Add
                    //time触发启动新线程时不能操作IIS上的线程,要设置一个自定义会话像HybridWebThreadSessionStore才可以。需要添加“System.Web”引用
                    if (HttpContext.Current == null)
                    {
                        mapper.SessionStore = new HybridWebThreadSessionStore(mapper.Id);
                    }
                    //END - Add by Robin 2013/07/10 for Version Bulk Add
                    DataAccessHelp da = new DataAccessHelp();
                    da.sqlMapper = mapper;

                    return(da);
                }
            }
            catch (IBatisNet.Common.Exceptions.IBatisNetException bnx)
            {
                throw new ApplicationException(bnx.Message);
            }

            return(null);
        }
Пример #2
0
 public static IDataAccess Instance(string sqlMapConfig)
 {
     return(DataAccessHelp.Create(sqlMapConfig));
 }